/*
 * My Account — Header, Sidebar, Dashboard
 *
 * All colors/spacing reuse existing tokens (base/variables.css) — no
 * new design system, matching the project's established pattern. The
 * sidebar's dark navy background is --qehs-primary, the active-item
 * accent is --qehs-secondary, matching the Figma reference.
 */

/* --- Logged-in account header --- */

.qehs-account-header {
	height: 80px;
	border-bottom: 1px solid var(--qehs-border);
	background-color: var(--qehs-background);
}

.qehs-account-header__inner {
	max-width: var(--qehs-header-container-max);
	height: 100%;
	margin-inline: auto;
	padding-inline: 24px;
	display: flex;
	align-items: center;
	gap: var(--qehs-space-lg);
}

.qehs-account-header__logo img {
	display: block;
	max-height: var(--qehs-header-logo-height);
	width: auto;
}

.qehs-account-header__search {
	flex: 1 1 auto;
	max-width: 480px;
	margin-inline: auto;
	display: flex;
	align-items: center;
	border: 1px solid var(--qehs-border);
	border-radius: 999px;
	overflow: hidden;
}

.qehs-account-header__search input {
	flex: 1 1 auto;
	border: none;
	padding: var(--qehs-space-sm) var(--qehs-space-lg);
	font-family: inherit;
	font-size: 0.95rem;
	color: var(--qehs-text);
}

.qehs-account-header__search input:focus-visible {
	outline: none;
}

.qehs-account-header__search button {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 3px;
	border: none;
	border-radius: 999px;
	background-color: var(--qehs-secondary);
	cursor: pointer;
}

.qehs-account-header__search button:focus-visible {
	outline: 2px solid var(--qehs-primary);
	outline-offset: 2px;
}

.qehs-account-header__right {
	flex-shrink: 0;
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 32px;
}

.qehs-account-header__user {
	position: relative;
}

.qehs-account-header__user-toggle {
	display: flex;
	align-items: center;
	gap: var(--qehs-space-sm);
	background: none;
	border: none;
	cursor: pointer;
	color: var(--qehs-text);
	font-family: inherit;
}

.qehs-account-header__user-toggle:focus-visible {
	outline: 2px solid var(--qehs-secondary);
	outline-offset: 2px;
	border-radius: var(--qehs-radius-sm);
}

.qehs-account-header__avatar {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 999px;
	background-color: var(--qehs-success-tint);
	color: var(--qehs-primary);
	font-weight: 700;
	font-size: 0.9rem;
}

.qehs-account-header__name {
	font-weight: 600;
	font-size: 0.95rem;
}

.qehs-account-header__user-menu {
	position: absolute;
	top: calc(100% + var(--qehs-space-sm));
	right: 0;
	margin: 0;
	padding: var(--qehs-space-xs);
	list-style: none;
	background-color: var(--qehs-background);
	border: 1px solid var(--qehs-border);
	border-radius: var(--qehs-radius-md);
	box-shadow: var(--qehs-shadow-md);
	min-width: 160px;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-4px);
	transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}

.qehs-account-header__user-toggle[aria-expanded='true'] + .qehs-account-header__user-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.qehs-account-header__user-menu a {
	display: block;
	padding: var(--qehs-space-sm) var(--qehs-space-md);
	border-radius: var(--qehs-radius-sm);
	color: var(--qehs-text);
	font-size: 0.9rem;
}

.qehs-account-header__user-menu a:hover,
.qehs-account-header__user-menu a:focus-visible {
	background-color: var(--qehs-background-alt);
}

/* --- Shell: sidebar + main --- */

.qehs-account-shell {
	background-color: var(--qehs-background);
}

.qehs-account-shell__inner {
	display: grid;
	grid-template-columns: 300px minmax(0, 1fr);
	align-items: start;
}

.qehs-account-shell__main {
	min-width: 0;
	padding: 32px;
}

.qehs-account-shell__main > * {
	max-width: 1160px;
}

/* --- Sidebar --- */

.qehs-account-sidebar {
	position: sticky;
	top: 0;
	align-self: stretch;
	background-color: #002554;
	color: #ffffff;
	padding: 32px 24px;
	display: flex;
	flex-direction: column;
	min-height: 100%;
}

.qehs-account-sidebar__title {
	margin: 0 0 var(--qehs-space-lg);
	font-size: 18px;
	font-weight: 700;
	color: #ffffff;
}

.qehs-account-sidebar__nav ul {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: var(--qehs-space-md);
}

.qehs-account-sidebar__item a {
	display: flex;
	align-items: center;
	gap: var(--qehs-space-sm);
	padding: var(--qehs-space-sm) var(--qehs-space-md);
	border-left: 3px solid transparent;
	border-radius: var(--qehs-radius-sm);
	color: rgba(255, 255, 255, 0.8);
	font-size: 0.95rem;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.qehs-account-sidebar__item a:hover,
.qehs-account-sidebar__item a:focus-visible {
	background-color: rgba(255, 255, 255, 0.08);
	color: #ffffff;
}

.qehs-account-sidebar__item.is-active a {
	border-left-color: var(--qehs-secondary);
	background-color: rgba(255, 255, 255, 0.08);
	color: #ffffff;
	font-weight: 600;
}

.qehs-account-sidebar__logout {
	display: flex;
	align-items: center;
	gap: var(--qehs-space-sm);
	margin-top: var(--qehs-space-lg);
	padding: var(--qehs-space-sm) var(--qehs-space-md);
	color: rgba(255, 255, 255, 0.8);
	font-size: 0.95rem;
}

.qehs-account-sidebar__logout:hover,
.qehs-account-sidebar__logout:focus-visible {
	color: #ffffff;
}

.qehs-account-sidebar__help {
	margin-top: auto;
	padding: var(--qehs-space-lg);
	border: 1px solid rgba(255, 255, 255, 0.3);
	border-radius: 16px;
	background-color: #002554;
}

.qehs-account-sidebar__help-icon {
	display: inline-flex;
	color: rgba(255, 255, 255, 0.85);
	margin-bottom: var(--qehs-space-sm);
}

.qehs-account-sidebar__help strong {
	display: block;
	margin-bottom: var(--qehs-space-xs);
}

.qehs-account-sidebar__help p {
	margin: 0 0 var(--qehs-space-md);
	font-size: 0.85rem;
	color: rgba(255, 255, 255, 0.7);
	line-height: 1.5;
}

.qehs-account-sidebar__help-cta {
	display: block;
	text-align: center;
	padding: var(--qehs-space-sm);
	border: 1px solid var(--qehs-secondary);
	border-radius: var(--qehs-radius-md);
	color: var(--qehs-secondary);
	font-weight: 600;
	font-size: 0.9rem;
}

.qehs-account-sidebar__help-cta:hover,
.qehs-account-sidebar__help-cta:focus-visible {
	background-color: var(--qehs-secondary);
	color: #ffffff;
}

/* --- Dashboard heading --- */

.qehs-account-dashboard__heading {
	margin-bottom: 48px;
}

.qehs-account-dashboard__heading h1 {
	margin: 0 0 var(--qehs-space-xs);
	font-size: 2rem;
	font-weight: 700;
	color: var(--qehs-text);
}

.qehs-account-dashboard__breadcrumb {
	display: flex;
	align-items: center;
	gap: var(--qehs-space-xs);
	font-size: 0.9rem;
	color: var(--qehs-text-muted);
}

.qehs-account-dashboard__breadcrumb a {
	color: var(--qehs-secondary);
	font-weight: 600;
}

/* --- Stat cards --- */

.qehs-account-dashboard__stats {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: var(--qehs-space-md);
	margin-bottom: var(--qehs-space-xl);
}

.qehs-account-stat-card {
	display: flex;
	flex-direction: column;
	padding: var(--qehs-space-lg);
	border: 1px solid #E5E7EB;
	border-radius: var(--qehs-radius-lg);
}

.qehs-account-stat-card__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border-radius: var(--qehs-radius-md);
	margin-bottom: var(--qehs-space-md);
}

.qehs-account-stat-card__icon--download { background-color: var(--qehs-success-tint); color: var(--qehs-secondary); }
.qehs-account-stat-card__icon--orders { background-color: var(--qehs-accent-blue-tint); color: var(--qehs-accent-blue); }
.qehs-account-stat-card__icon--bundles { background-color: var(--qehs-accent-purple-tint); color: var(--qehs-accent-purple); }
.qehs-account-stat-card__icon--wishlist { background-color: var(--qehs-warning-tint); color: var(--qehs-warning); }

.qehs-account-stat-card__label {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--qehs-text);
}

.qehs-account-stat-card__value {
	font-size: 1.75rem;
	font-weight: 700;
	color: var(--qehs-text);
	margin: 2px 0;
}

.qehs-account-stat-card__desc {
	font-size: 0.85rem;
	color: var(--qehs-text-muted);
	margin-bottom: var(--qehs-space-md);
}

.qehs-account-stat-card__cta {
	margin-top: auto;
	display: inline-flex;
	align-items: center;
	gap: var(--qehs-space-xs);
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--qehs-secondary);
}

/* --- List cards (Recent Downloads / Recent Orders) --- */

.qehs-account-dashboard__lists {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--qehs-space-lg);
	margin-bottom: var(--qehs-space-xl);
}

.qehs-account-list-card {
	height: 100%;
	border: 1px solid #E5E7EB;
	border-radius: var(--qehs-radius-lg);
	padding: var(--qehs-space-lg);
	display: flex;
	flex-direction: column;
}

.qehs-account-list-card__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: var(--qehs-space-md);
}

.qehs-account-list-card__header h2 {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 700;
	color: var(--qehs-text);
}

.qehs-account-list-card__header a,
.qehs-account-list-card__view-all {
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--qehs-secondary);
}

.qehs-account-list-card__view-all {
	display: inline-flex;
	align-items: center;
	gap: var(--qehs-space-xs);
	margin-top: var(--qehs-space-md);
	align-self: center;
}

.qehs-account-download-list,
.qehs-account-order-list {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: var(--qehs-space-sm);
}

.qehs-account-download-list li {
	display: flex;
	align-items: center;
	gap: var(--qehs-space-sm);
	padding: var(--qehs-space-sm);
	border: 1px solid var(--qehs-border);
	border-radius: var(--qehs-radius-md);
}

.qehs-account-download-list__icon {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: var(--qehs-radius-sm);
	background-color: var(--qehs-primary);
	color: #ffffff;
	font-size: 0.6rem;
	font-weight: 700;
}

.qehs-account-download-list__info {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
}

.qehs-account-download-list__info strong {
	font-size: 0.9rem;
	color: var(--qehs-text);
}

.qehs-account-download-list__info span {
	font-size: 0.8rem;
	color: var(--qehs-text-muted);
}

.qehs-account-download-list__date {
	flex-shrink: 0;
	font-size: 0.85rem;
	color: var(--qehs-text-muted);
}

.qehs-account-download-list__button {
	flex-shrink: 0;
	padding: var(--qehs-space-xs) var(--qehs-space-md);
	border: 1px solid var(--qehs-secondary);
	border-radius: var(--qehs-radius-md);
	color: var(--qehs-secondary);
	font-size: 0.85rem;
	font-weight: 600;
	white-space: nowrap;
}

.qehs-account-download-list__button:hover,
.qehs-account-download-list__button:focus-visible {
	background-color: var(--qehs-secondary);
	color: #ffffff;
}

.qehs-account-order-list li {
	display: flex;
	align-items: center;
	gap: var(--qehs-space-sm);
	padding: var(--qehs-space-sm) 0;
	border-bottom: 1px solid var(--qehs-border);
}

.qehs-account-order-list li:last-child {
	border-bottom: none;
}

.qehs-account-order-list__info {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
}

.qehs-account-order-list__info strong {
	font-size: 0.9rem;
	color: var(--qehs-text);
}

.qehs-account-order-list__info span {
	font-size: 0.8rem;
	color: var(--qehs-text-muted);
}

.qehs-account-order-list__total {
	flex-shrink: 0;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--qehs-text);
}

.qehs-account-order-list__status {
	flex-shrink: 0;
	padding: 2px 10px;
	border-radius: 999px;
	background-color: var(--qehs-success-tint);
	color: var(--qehs-success);
	font-size: 0.8rem;
	font-weight: 600;
}

.qehs-account-order-list a {
	flex-shrink: 0;
	color: var(--qehs-text-muted);
}

/* --- Bottom CTA banner --- */

.qehs-account-dashboard__cta {
	display: flex;
	align-items: center;
	gap: var(--qehs-space-lg);
	padding: var(--qehs-space-lg);
	border-radius: 18px;
	background-color: var(--qehs-success-tint);
}

.qehs-account-dashboard__cta-icon {
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 999px;
	background-color: var(--qehs-background);
	color: var(--qehs-secondary);
}

.qehs-account-dashboard__cta-text {
	flex: 1 1 auto;
	min-width: 0;
}

.qehs-account-dashboard__cta-text strong {
	display: block;
	font-size: 1.1rem;
	color: var(--qehs-text);
	margin-bottom: 2px;
}

.qehs-account-dashboard__cta-text p {
	margin: 0;
	font-size: 0.9rem;
	color: var(--qehs-text-muted);
}

.qehs-account-dashboard__cta-actions {
	flex-shrink: 0;
	display: flex;
	gap: var(--qehs-space-sm);
}

.qehs-account-dashboard__cta-button {
	display: inline-flex;
	align-items: center;
	gap: var(--qehs-space-xs);
	padding: var(--qehs-space-sm) var(--qehs-space-lg);
	border-radius: var(--qehs-radius-md);
	font-weight: 600;
	font-size: 0.9rem;
	white-space: nowrap;
}

.qehs-account-dashboard__cta-button--primary {
	background-color: var(--qehs-primary);
	color: #ffffff;
	border: 1px solid var(--qehs-primary);
}

.qehs-account-dashboard__cta-button--secondary {
	background-color: var(--qehs-secondary);
	color: #ffffff;
	border: 1px solid var(--qehs-secondary);
}

.qehs-account-dashboard__cta-button:hover,
.qehs-account-dashboard__cta-button:focus-visible {
	filter: brightness(1.1);
}

/* --- Tablet --- */
@media (max-width: 1024px) {
	.qehs-account-shell__inner {
		grid-template-columns: 1fr;
	}

	.qehs-account-sidebar {
		position: static;
		min-height: 0;
	}

	.qehs-account-header__search {
		display: none;
	}

	.qehs-account-dashboard__stats {
		grid-template-columns: 1fr 1fr;
	}

	.qehs-account-dashboard__lists {
		grid-template-columns: 1fr;
	}
}

/* --- Mobile --- */
@media (max-width: 480px) {
	.qehs-account-dashboard__stats {
		grid-template-columns: 1fr;
	}

	.qehs-account-header__name {
		display: none;
	}

	.qehs-account-dashboard__cta {
		flex-direction: column;
		align-items: flex-start;
	}

	.qehs-account-dashboard__cta-actions {
		flex-direction: column;
		width: 100%;
	}

	.qehs-account-dashboard__cta-button {
		flex: 1 1 auto;
		justify-content: center;
	}

	.qehs-account-download-list li {
		flex-wrap: wrap;
	}
}
