// WordPress Admin Colors
$wp-admin-blue: #007cba;
$wp-admin-blue-hover: #006ba1;
$wp-admin-text: #1d2327;
$wp-admin-text-secondary: #50575e;
$wp-admin-border: #c3c4c7;
$wp-admin-border-light: #e0e0e0;
$wp-admin-success: #00a32a;
$wp-admin-error: #d63638;
$wp-admin-warning: #dba617;
$wp-admin-bg: #f0f0f1;

// Utility classes
.text-negative {
	color: $wp-admin-error;
}
.text-positive {
	color: $wp-admin-success;
}
.text-caption {
	font-size: 12px;
	font-weight: 400;
	color: $wp-admin-text-secondary;
}

// Skeleton animation
@keyframes skeleton-pulse {
	0% {
		opacity: 1;
	}
	50% {
		opacity: 0.4;
	}
	100% {
		opacity: 1;
	}
}

.skeleton {
	background-color: $wp-admin-border-light;
	border-radius: 2px;
	animation: skeleton-pulse 1.5s ease-in-out infinite;

	&--text {
		height: 1em;
		width: 100%;
		margin-bottom: 0.5rem;
	}

	&--circle {
		border-radius: 50%;
	}

	&--button {
		height: 36px;
		width: 100px;
	}
}

// Account skeleton
.account-skeleton {
	&__header {
		display: flex;
		justify-content: space-between;
		margin-bottom: 1rem;
		padding-bottom: 1rem;
		border-bottom: 1px solid $wp-admin-border-light;
	}
	&__info {
		display: flex;
		flex-direction: column;
		gap: 0.5rem;
	}
}

// Account card styles
.account-info {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.account-status {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-bottom: 1rem;
	border-bottom: 1px solid $wp-admin-border-light;
}

.status-indicator {
	display: inline-flex;
	align-items: center;
	gap: 0.25rem;
	font-size: 13px;
	font-weight: 500;

	&--connected {
		color: $wp-admin-success;
	}

	&--disconnected {
		color: $wp-admin-error;
	}
}

.account-details {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.account-detail-row {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.account-label {
	font-size: 11px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	color: $wp-admin-text-secondary;
}

.account-value {
	font-size: 14px;
	color: $wp-admin-text;
	font-weight: 500;
}

// Course skeleton
.course-skeleton {
	padding: 16px;
	border: 1px solid $wp-admin-border-light;
	border-radius: 2px;
	margin-bottom: 12px;

	&__header {
		display: flex;
		justify-content: space-between;
		margin-bottom: 12px;
	}
	&__details {
		display: flex;
		flex-direction: column;
		gap: 0.5rem;
		padding: 12px 0;
		border-top: 1px solid $wp-admin-border-light;
	}
}

// Course list styles
.course-list {
	list-style-type: none;
	padding: 0;
	margin: 0;
}

// Course item - WordPress native style
.course-item {
	padding: 16px;
	background: #fff;
	border: 1px solid $wp-admin-border;
	border-radius: 2px;
	margin-bottom: 12px;
	transition: border-color 0.1s;

	&:hover {
		border-color: $wp-admin-blue;
	}

	&__header {
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		margin-bottom: 12px;
	}

	&__title-group {
		display: flex;
		flex-direction: column;
		gap: 2px;
	}

	&__title {
		margin: 0;
		font-size: 14px;
		font-weight: 600;
		color: $wp-admin-text;
		line-height: 1.4;
	}

	&__ref {
		font-size: 12px;
		color: $wp-admin-text-secondary;
	}

	&__meta {
		display: flex;
		flex-wrap: wrap;
		gap: 16px;
		margin-bottom: 12px;
		padding: 12px 0;
		border-top: 1px solid $wp-admin-border-light;
		border-bottom: 1px solid $wp-admin-border-light;
	}

	&__meta-item {
		display: inline-flex;
		align-items: center;
		gap: 6px;
		font-size: 13px;
		color: $wp-admin-text-secondary;

		svg {
			width: 18px;
			height: 18px;
			fill: $wp-admin-text-secondary;
		}
	}

	&__footer {
		display: flex;
		justify-content: flex-end;
	}
}

// Badge - WordPress native style
.badge {
	display: inline-flex;
	align-items: center;
	padding: 0 8px;
	height: 24px;
	font-size: 12px;
	font-weight: 500;
	border-radius: 2px;
	white-space: nowrap;

	&--success {
		background-color: #d7f4e3;
		color: #00450c;
	}

	&--error {
		background-color: #fcebeb;
		color: #8a2424;
	}
}

// Course header controls
.course-header-controls {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
	padding-bottom: 16px;
	border-bottom: 1px solid $wp-admin-border-light;
}

// Main settings layout
.cloudapps-course-manager-settings {
	gap: 2rem;
	margin-top: 2rem;

	// Card header styles
	.components-card__header h2 {
		margin: 0;
		font-size: 14px;
		font-weight: 600;
		color: $wp-admin-text;
	}

	.account-card {
		width: 100%;
	}

	.auth-card {
		max-width: 400px;
	}

	.auth-tabs {
		.components-tab-panel__tabs {
			margin-bottom: 1.5rem;
			border-bottom: 1px solid $wp-admin-border-light;
		}

		.components-tab-panel__tabs-item {
			padding: 0.75rem 1.5rem;
			font-weight: 500;

			&.is-active {
				border-bottom: 2px solid $wp-admin-blue;
				color: $wp-admin-blue;
			}
		}
	}

	.welcome-section {
		max-width: 600px;
		margin-bottom: 1.5rem;

		h2 {
			margin: 0 0 0.5rem;
			font-size: 1.5rem;
			font-weight: 600;
		}

		.welcome-subtitle {
			margin: 0 0 1rem;
			font-size: 1rem;
			color: $wp-admin-text-secondary;
		}

		.welcome-features {
			margin: 0 0 1rem;
			padding-left: 0;
			list-style: none;

			li {
				position: relative;
				padding-left: 1.5rem;
				margin-bottom: 0.5rem;
				color: $wp-admin-text-secondary;

				&::before {
					content: "✓";
					position: absolute;
					left: 0;
					color: $wp-admin-success;
					font-weight: bold;
				}
			}
		}

		.welcome-cta {
			margin: 0;
			font-weight: 500;
		}
	}

	.courses {
		margin-top: 1rem;
		width: 100%;
	}
}

@media screen and (min-width: 1024px) {
	.cloudapps-course-manager-settings {
		display: flex;

		.account-card {
			width: auto;
			min-width: 280px;
		}
		.courses {
			margin-top: 0;
			width: 100%;
			max-width: 750px;
		}
	}
}
