/**
 * Cheviot HR eLearning - Manager Dashboard styles
 *
 * Sidebar nav layout with three tab panels (Overview, Course Overview,
 * Employee Progress). White/purple aesthetic with #635bff accent.
 *
 * Class prefix: che-md (cheviot manager dashboard)
 */

/* ============ Layout ============ */
.che-md {
	display: flex;
	gap: 2rem;
	max-width: 1280px;
	margin: 2rem auto;
	padding: 0 1.25rem;
	min-height: 600px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	color: #1a1a1a;
}

.che-md--gate {
	max-width: 600px;
	text-align: center;
	padding: 4rem 1.25rem;
}

/* ============ Sidebar ============ */
.che-md__sidebar {
	flex: 0 0 240px;
	background: #fff;
	border: 1px solid #e9eaf3;
	border-radius: 12px;
	padding: 1.5rem 0;
	height: fit-content;
	position: sticky;
	top: 100px;
}

.che-md__sidebar-header {
	padding: 0 1.5rem 1.25rem;
	border-bottom: 1px solid #f1f2f9;
	margin-bottom: 1rem;
}

.che-md__sidebar-title {
	font-size: 1.1rem;
	font-weight: 600;
	color: #1a1a1a;
	margin: 0 0 0.25rem;
}

.che-md__sidebar-company {
	font-size: 0.85rem;
	color: #6b7280;
	margin: 0;
}

.che-md__nav {
	display: flex;
	flex-direction: column;
}

.che-md__nav-item {
	background: transparent;
	border: 0;
	text-align: left;
	padding: 0.75rem 1.5rem;
	font-size: 0.95rem;
	color: #4b5563;
	cursor: pointer;
	border-left: 3px solid transparent;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
	font-family: inherit;
}

.che-md__nav-item:hover {
	background: #f7f7fc;
	color: #1a1a1a;
}

.che-md__nav-item.is-active {
	background: #f3f2ff;
	color: #635bff;
	border-left-color: #635bff;
	font-weight: 600;
}

/* ============ Main panels ============ */
.che-md__main {
	flex: 1;
	min-width: 0;
}

.che-md__panel {
	display: none;
	animation: che-md-fade 0.25s ease;
}

.che-md__panel.is-active {
	display: block;
}

@keyframes che-md-fade {
	from { opacity: 0; transform: translateY(4px); }
	to   { opacity: 1; transform: translateY(0); }
}

.che-md__panel-header {
	margin-bottom: 1.5rem;
}

.che-md__panel-title {
	font-size: 1.75rem;
	font-weight: 600;
	margin: 0 0 0.25rem;
	color: #1a1a1a;
}

.che-md__panel-subtitle {
	color: #6b7280;
	margin: 0;
	font-size: 0.95rem;
}

/* ============ Stat cards ============ */
.che-md__stat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 1rem;
	margin-bottom: 2rem;
}

.che-md__stat-card {
	background: #fff;
	border: 1px solid #e9eaf3;
	border-radius: 10px;
	padding: 1.25rem 1.5rem;
}

.che-md__stat-card--success {
	border-color: #d4f5e0;
	background: linear-gradient(135deg, #fff 0%, #f0fdf4 100%);
}

.che-md__stat-card--accent {
	border-color: #d6d4f5;
	background: linear-gradient(135deg, #fff 0%, #f3f2ff 100%);
}

.che-md__stat-label {
	display: block;
	font-size: 0.85rem;
	color: #6b7280;
	margin-bottom: 0.5rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	font-weight: 600;
}

.che-md__stat-value {
	display: block;
	font-size: 2rem;
	font-weight: 700;
	color: #1a1a1a;
	line-height: 1;
}

/* ============ Charts ============ */
.che-md__chart-row {
	display: grid;
	grid-template-columns: 1fr 1.5fr;
	gap: 1.25rem;
	margin-bottom: 2rem;
}

.che-md__chart-card {
	background: #fff;
	border: 1px solid #e9eaf3;
	border-radius: 10px;
	padding: 1.5rem;
}

.che-md__chart-title {
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 1.25rem;
	color: #1a1a1a;
}

.che-md__donut-wrap {
	display: flex;
	align-items: center;
	gap: 1.5rem;
}

.che-md__donut {
	width: 160px;
	height: 160px;
	flex-shrink: 0;
}

.che-md__donut-pct {
	font-size: 18px;
	font-weight: 700;
	fill: #1a1a1a;
}

.che-md__legend {
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 0.9rem;
	color: #4b5563;
}

.che-md__legend li {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-bottom: 0.5rem;
}

.che-md__legend-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
}

/* Bar chart */
.che-md__bars {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	height: 200px;
	gap: 0.5rem;
	padding-top: 1rem;
}

.che-md__bar-col {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	height: 100%;
}

.che-md__bar-wrap {
	flex: 1;
	width: 100%;
	display: flex;
	align-items: flex-end;
	justify-content: center;
}

.che-md__bar {
	width: 70%;
	background: linear-gradient(180deg, #635bff 0%, #a5a1ff 100%);
	border-radius: 6px 6px 0 0;
	min-height: 4px;
	position: relative;
	transition: opacity 0.15s ease;
	display: flex;
	justify-content: center;
	align-items: flex-start;
}

.che-md__bar:hover {
	opacity: 0.85;
}

.che-md__bar-value {
	color: #fff;
	font-size: 0.75rem;
	font-weight: 600;
	margin-top: 0.25rem;
}

.che-md__bar-label {
	font-size: 0.75rem;
	color: #6b7280;
	margin-top: 0.5rem;
	text-align: center;
}

/* ============ Toolbar ============ */
.che-md__toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	flex-wrap: wrap;
	margin-bottom: 1.25rem;
}

.che-md__filter-tabs {
	display: flex;
	gap: 0.25rem;
	background: #f3f4f8;
	border-radius: 8px;
	padding: 0.25rem;
}

.che-md__filter {
	background: transparent;
	border: 0;
	padding: 0.5rem 0.875rem;
	font-size: 0.875rem;
	color: #6b7280;
	cursor: pointer;
	border-radius: 6px;
	transition: background 0.15s ease, color 0.15s ease;
	font-family: inherit;
}

.che-md__filter:hover {
	color: #1a1a1a;
}

.che-md__filter.is-active {
	background: #fff;
	color: #635bff;
	font-weight: 600;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.che-md__toolbar-right {
	display: flex;
	gap: 0.5rem;
	align-items: center;
}

.che-md__search {
	border: 1px solid #e0e2eb;
	border-radius: 8px;
	padding: 0.5rem 0.875rem;
	font-size: 0.9rem;
	min-width: 220px;
	font-family: inherit;
}

.che-md__search:focus {
	outline: 2px solid #635bff;
	outline-offset: -1px;
	border-color: #635bff;
}

.che-md__export {
	background: #635bff;
	color: #fff;
	border: 0;
	padding: 0.5rem 1rem;
	font-size: 0.9rem;
	font-weight: 600;
	border-radius: 8px;
	cursor: pointer;
	font-family: inherit;
	transition: background 0.15s ease;
}

.che-md__export:hover {
	background: #4f47d6;
}

.che-md__export:disabled {
	opacity: 0.6;
	cursor: not-allowed;
}

/* ============ Tables ============ */
.che-md__table-wrap {
	background: #fff;
	border: 1px solid #e9eaf3;
	border-radius: 10px;
	overflow: hidden;
	overflow-x: auto;
}

.che-md__table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9rem;
}

.che-md__table thead th {
	background: #f7f7fc;
	color: #6b7280;
	font-size: 0.78rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 0.875rem 1rem;
	text-align: left;
	border-bottom: 1px solid #e9eaf3;
}

.che-md__table tbody td {
	padding: 1rem;
	border-bottom: 1px solid #f1f2f9;
	vertical-align: middle;
}

.che-md__table tbody tr:last-child td {
	border-bottom: 0;
}

.che-md__table--employees tbody tr {
	cursor: pointer;
	transition: background 0.12s ease;
}

.che-md__table--employees tbody tr:hover {
	background: #f7f7fc;
}

.che-md__row.is-hidden {
	display: none;
}

.che-md__muted {
	color: #6b7280;
	font-size: 0.85rem;
}

/* Progress bars in tables */
.che-md__progress {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-width: 140px;
}

.che-md__table .che-md__progress {
	background: #f1f2f9;
	border-radius: 3px;
	height: 6px;
	flex: 1;
	position: relative;
}

.che-md__table .che-md__progress-bar {
	background: #635bff;
	height: 100%;
	border-radius: 3px;
	transition: width 0.4s ease;
}

.che-md__progress-pct {
	font-size: 0.8rem;
	font-weight: 600;
	color: #6b7280;
	min-width: 50px;
	text-align: right;
}

/* ============ Status pills ============ */
.che-md__status {
	display: inline-block;
	padding: 0.25rem 0.625rem;
	border-radius: 999px;
	font-size: 0.78rem;
	font-weight: 600;
	border: 1px solid transparent;
}

.che-md__status--fully {
	background: #ecfdf5;
	color: #047857;
	border-color: #d1fae5;
}

.che-md__status--progress {
	background: #f3f2ff;
	color: #4f47d6;
	border-color: #d6d4f5;
}

.che-md__status--notstarted {
	background: #fef2f2;
	color: #b91c1c;
	border-color: #fecaca;
}

.che-md__empty {
	background: #fff;
	border: 1px solid #e9eaf3;
	border-radius: 10px;
	padding: 2.5rem;
	text-align: center;
	color: #6b7280;
}

/* ============ Responsive ============ */
@media (max-width: 1024px) {
	.che-md__chart-row {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 782px) {
	.che-md {
		flex-direction: column;
		gap: 1rem;
	}

	.che-md__sidebar {
		flex: 1;
		position: static;
	}

	.che-md__nav {
		flex-direction: row;
		overflow-x: auto;
		padding-bottom: 0.5rem;
	}

	.che-md__nav-item {
		border-left: 0;
		border-bottom: 3px solid transparent;
		white-space: nowrap;
	}

	.che-md__nav-item.is-active {
		border-left: 0;
		border-bottom-color: #635bff;
	}

	.che-md__panel-title {
		font-size: 1.4rem;
	}

	.che-md__toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.che-md__toolbar-right {
		justify-content: flex-end;
	}

	.che-md__search {
		flex: 1;
		min-width: 0;
	}
}

/* ============ Six-card stat grid (Overview) ============ */
.che-md__stat-grid--six {
	grid-template-columns: repeat(6, minmax(0, 1fr));
}

@media (max-width: 1100px) {
	.che-md__stat-grid--six {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 600px) {
	.che-md__stat-grid--six {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.che-md__stat-card--muted {
	border-color: #e9eaf3;
	background: linear-gradient(135deg, #fff 0%, #f7f7fc 100%);
}

/* ============ Top Courses mini-table (Overview) ============ */
.che-md__top-courses {
	margin-bottom: 1.25rem;
}

.che-md__top-courses-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 1rem;
	margin-bottom: 0.75rem;
	flex-wrap: wrap;
}

.che-md__top-courses-header .che-md__chart-title {
	margin: 0;
}

.che-md__link-btn {
	background: transparent;
	border: 0;
	color: #635bff;
	font-weight: 600;
	font-size: 0.85rem;
	cursor: pointer;
	font-family: inherit;
	padding: 0.25rem 0;
}

.che-md__link-btn:hover {
	text-decoration: underline;
}

.che-md__table--mini {
	font-size: 0.875rem;
}

.che-md__table--mini thead th,
.che-md__table--mini tbody td {
	padding: 0.6rem 0.75rem;
}

.che-md__cell-numeric {
	text-align: right;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

/* ============ Person cell (avatar + name + email) ============ */
.che-md__person {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.che-md__avatar {
	flex-shrink: 0;
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 0.78rem;
	font-weight: 700;
	color: #1a1a1a;
	letter-spacing: 0.02em;
	user-select: none;
}

.che-md__person-meta {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.che-md__person-meta strong {
	font-weight: 600;
	color: #1a1a1a;
}

.che-md__person-meta .che-md__muted {
	margin-top: 1px;
}

/* ============ Manager-include toggle ============ */
.che-md__toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.85rem;
	color: #4b5563;
	cursor: pointer;
	user-select: none;
	padding-right: 0.5rem;
}

.che-md__toggle input[type="checkbox"] {
	accent-color: #635bff;
	cursor: pointer;
}

/* ============ Drill-down drawer ============ */
.che-md-drawer {
	position: fixed;
	inset: 0;
	z-index: 1000;
}

.che-md-drawer[hidden] {
	display: none;
}

.che-md-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba(15, 17, 38, 0.45);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.che-md-drawer.is-open .che-md-drawer__overlay {
	opacity: 1;
}

.che-md-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(560px, 92vw);
	background: #fff;
	box-shadow: -8px 0 32px rgba(15, 17, 38, 0.12);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.25s ease;
}

.che-md-drawer.is-open .che-md-drawer__panel {
	transform: translateX(0);
}

.che-md-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid #f1f2f9;
}

.che-md-drawer__title {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	color: #1a1a1a;
}

.che-md-drawer__close {
	background: transparent;
	border: 0;
	font-size: 1.5rem;
	line-height: 1;
	color: #6b7280;
	cursor: pointer;
	padding: 0.25rem 0.5rem;
	border-radius: 6px;
}

.che-md-drawer__close:hover {
	background: #f3f4f8;
	color: #1a1a1a;
}

.che-md-drawer__body {
	flex: 1;
	overflow-y: auto;
	padding: 1.25rem;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
	color: #1a1a1a;
}

.che-md-drawer__loading {
	color: #6b7280;
	padding: 2rem 1rem;
	text-align: center;
}

/* Larger avatar in drawer header */
.che-md__avatar--lg {
	width: 56px;
	height: 56px;
	font-size: 1.05rem;
}

.che-md-detail__header {
	border-bottom: 1px solid #f1f2f9;
	padding-bottom: 1rem;
	margin-bottom: 1rem;
}

.che-md-detail__name {
	font-size: 1.05rem;
}

.che-md-detail__meta {
	display: flex;
	gap: 1.5rem;
	margin-top: 1rem;
	flex-wrap: wrap;
}

.che-md-detail__meta-item {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
}

.che-md-detail__meta-item strong {
	font-size: 1.05rem;
	color: #1a1a1a;
}

.che-md-detail__list {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.che-md-detail__row {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.875rem 1rem;
	background: #fff;
	border: 1px solid #e9eaf3;
	border-radius: 10px;
}

.che-md-detail__row-main {
	flex: 1;
	min-width: 0;
}

.che-md-detail__row-title {
	margin: 0 0 0.35rem;
	font-size: 0.95rem;
	font-weight: 600;
	color: #1a1a1a;
	line-height: 1.35;
}

.che-md-detail__row-title a {
	color: inherit;
	text-decoration: none;
}

.che-md-detail__row-title a:hover {
	color: #635bff;
}

.che-md-detail__row-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	font-size: 0.82rem;
	color: #6b7280;
}

.che-md-detail__row-progress {
	margin-top: 0.5rem;
	max-width: 240px;
}

@media (max-width: 600px) {
	.che-md-drawer__panel {
		width: 100vw;
	}
}

/* ============ Reminder action bar (in drill-down drawer) ============ */
.che-md-detail__actions {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
	margin-top: 1rem;
	padding-top: 1rem;
	border-top: 1px solid #f1f2f9;
}

.che-md-detail__remind {
	background: #635bff;
	color: #fff;
	border: 0;
	padding: 0.55rem 1rem;
	font-size: 0.9rem;
	font-weight: 600;
	border-radius: 8px;
	cursor: pointer;
	font-family: inherit;
	transition: background 0.15s ease, opacity 0.15s ease;
}

.che-md-detail__remind:hover {
	background: #4f47d6;
}

.che-md-detail__remind:disabled,
.che-md-detail__remind.is-disabled {
	opacity: 0.55;
	cursor: not-allowed;
	background: #635bff;
}

.che-md-detail__remind.is-sending {
	opacity: 0.7;
	cursor: progress;
}

.che-md-detail__remind.is-sent {
	background: #047857;
}

.che-md-detail__remind-status {
	font-size: 0.85rem;
	color: #6b7280;
}

.che-md-detail__remind-status.is-error {
	color: #b91c1c;
}

.che-md-detail__remind-status.is-success {
	color: #047857;
}

/* ============ Clickable course rows (Course Overview + Top Courses) ============ */
.che-md__course-row {
	cursor: pointer;
	transition: background 0.12s ease;
}

.che-md__course-row:hover {
	background: #f7f7fc;
}

.che-md__course-row:focus-visible {
	outline: 2px solid #635bff;
	outline-offset: -2px;
	background: #f3f2ff;
}

/* Make the course title look subtly link-like to hint at the interaction. */
.che-md__course-row td:first-child {
	color: #1a1a1a;
	font-weight: 500;
}

.che-md__course-row:hover td:first-child {
	color: #635bff;
}

/* Course-detail drawer header tweaks (no avatar so the title takes centre stage) */
.che-md-detail__header .che-md-detail__name {
	display: block;
	margin: 0 0 0.5rem;
}

.che-md-detail__header .che-md-detail__name a {
	color: inherit;
	text-decoration: none;
}

.che-md-detail__header .che-md-detail__name a:hover {
	color: #635bff;
	text-decoration: underline;
}

/* ============ Skeleton loading placeholders ============ */
@keyframes che-skel-shimmer {
	0%   { background-position: -400px 0; }
	100% { background-position: 400px 0; }
}

.che-skel {
	background: linear-gradient(90deg, #eef0f8 0%, #f7f7fc 50%, #eef0f8 100%);
	background-size: 800px 100%;
	animation: che-skel-shimmer 1.4s ease-in-out infinite;
	border-radius: 6px;
	display: block;
}

.che-skel--line {
	height: 0.75rem;
	width: 100%;
	margin: 0.5rem 0;
}

.che-skel--sm {
	height: 0.6rem;
	width: 50%;
}

.che-skel--lg {
	height: 1.5rem;
	width: 60%;
	margin-top: 0.5rem;
}

.che-skel--circle {
	width: 160px;
	height: 160px;
	border-radius: 50%;
	margin: 1rem auto;
}

.che-skel--sm-circle {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	margin-right: 0.75rem;
	display: inline-block;
}

.che-skel--bars {
	height: 200px;
	width: 100%;
	margin-top: 1rem;
	background-image:
		linear-gradient(90deg, #eef0f8 0%, #f7f7fc 50%, #eef0f8 100%);
	background-size: 800px 100%;
}

.che-skel-row {
	display: flex;
	align-items: center;
	padding: 0.875rem 1rem;
	border-bottom: 1px solid #f1f2f9;
}

.che-skel-row:last-child {
	border-bottom: 0;
}

.che-skel-row .che-skel--line {
	margin: 0;
}

/* Fade-in for swapped-in real content. */
@keyframes che-panel-fadein {
	from { opacity: 0; transform: translateY(4px); }
	to   { opacity: 1; transform: translateY(0); }
}

.che-md__panel.is-loaded {
	animation: che-panel-fadein 0.2s ease;
}

/* ============ Per-row reminder (in course drawer) ============ */
.che-md-detail__row-side {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.5rem;
	flex-shrink: 0;
}

.che-md-detail__row-reminder {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.25rem;
}

.che-md-detail__remind--sm {
	padding: 0.35rem 0.7rem;
	font-size: 0.78rem;
}

.che-md-detail__row-reminder .che-md-detail__remind-status {
	font-size: 0.75rem;
	text-align: right;
}
