/**
 * Real Boost Hub — customer dashboard.
 *
 * Loaded after frontend.css and scoped to .rbh-dashboard, so the rest of the
 * plugin's screens keep their existing styling. Every colour resolves from the
 * same custom properties the admin colour settings write, which is why the
 * dark scheme only has to redefine surfaces rather than the brand hues.
 */

.rbh-dashboard {
	--rbh-rail-width: 252px;
	--rbh-surface: var(--rbh-white);
	--rbh-surface-sunk: var(--rbh-background);
	--rbh-ring: rgba(108, 92, 231, .35);
	--rbh-radius-lg: 18px;
	--rbh-elevate: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px -12px rgba(16, 24, 40, .18);

	display: grid;
	grid-template-columns: var(--rbh-rail-width) minmax(0, 1fr);
	gap: 22px;
	align-items: start;
	font-variant-numeric: tabular-nums;
}

/* Dark scheme. Only surfaces and text move; brand colours stay as configured. */
.rbh-dashboard[data-theme="dark"] {
	--rbh-white: #151923;
	--rbh-surface: #1b2030;
	--rbh-surface-sunk: #10131c;
	--rbh-background: #10131c;
	--rbh-text: #c7cddb;
	--rbh-dark: #f2f4f8;
	--rbh-muted: #8b94a8;
	--rbh-border: #2a3145;
	--rbh-elevate: 0 1px 2px rgba(0, 0, 0, .3), 0 14px 34px -14px rgba(0, 0, 0, .7);

	color: var(--rbh-text);
}

.rbh-dashboard[data-theme="dark"] .rbh-table th,
.rbh-dashboard[data-theme="dark"] .rbh-table td,
.rbh-dashboard[data-theme="dark"] .rbh-input,
.rbh-dashboard[data-theme="dark"] .rbh-panel,
.rbh-dashboard[data-theme="dark"] .rbh-card {
	border-color: var(--rbh-border);
	color: var(--rbh-text);
	background-color: var(--rbh-surface);
}

.rbh-dashboard[data-theme="dark"] .rbh-page-title,
.rbh-dashboard[data-theme="dark"] .rbh-h3,
.rbh-dashboard[data-theme="dark"] .rbh-stat__value {
	color: var(--rbh-dark);
}

/* -------------------------------------------------------------------- Rail */

.rbh-rail {
	position: sticky;
	top: 20px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 12px;
	border: 1px solid var(--rbh-border);
	border-radius: var(--rbh-radius-lg);
	background: var(--rbh-surface);
	box-shadow: var(--rbh-elevate);
}

.rbh-rail__brand {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 4px 6px 12px;
	margin-bottom: 4px;
	border-bottom: 1px solid var(--rbh-border);
}

.rbh-rail__logo {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	min-width: 0;
	color: var(--rbh-dark);
	font-weight: 700;
	text-decoration: none;
}

.rbh-rail__logo img {
	max-height: 34px;
	width: auto;
}

.rbh-rail__mark {
	display: inline-grid;
	place-items: center;
	width: 30px;
	height: 30px;
	flex: 0 0 30px;
	border-radius: 9px;
	color: #fff;
	background: linear-gradient(135deg, var(--rbh-primary), var(--rbh-accent));
}

.rbh-rail__name {
	overflow: hidden;
	font-size: 15px;
	letter-spacing: -0.01em;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.rbh-rail__close {
	display: none;
	padding: 6px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--rbh-muted);
	cursor: pointer;
}

.rbh-rail__foot {
	margin-top: auto;
	padding-top: 8px;
	border-top: 1px solid var(--rbh-border);
}

/* frontend.css turns .rbh-nav into a horizontal scroller on small screens for
   the old sidebar. The drawer stacks instead, so those rules are reset here. */
.rbh-dashboard .rbh-nav {
	display: grid;
	gap: 2px;
	grid-auto-flow: row;
	grid-auto-columns: auto;
	overflow-x: visible;
}

.rbh-dashboard .rbh-nav__link {
	position: relative;
	display: flex;
	align-items: center;
	gap: 11px;
	padding: 10px 11px;
	border-radius: 11px;
	color: var(--rbh-text);
	font-size: 14.5px;
	font-weight: 550;
	text-decoration: none;
	border: 0;
	transition: background-color .16s ease, color .16s ease;
}

.rbh-dashboard .rbh-nav__icon {
	display: inline-grid;
	place-items: center;
	width: 30px;
	height: 30px;
	flex: 0 0 30px;
	border-radius: 9px;
	background: var(--rbh-surface-sunk);
	color: var(--rbh-muted);
	transition: background-color .16s ease, color .16s ease;
}

.rbh-dashboard .rbh-nav__link:hover {
	background: var(--rbh-surface-sunk);
	color: var(--rbh-dark);
}

.rbh-dashboard .rbh-nav__link.is-active {
	background: color-mix(in srgb, var(--rbh-primary) 12%, transparent);
	color: var(--rbh-primary);
}

.rbh-dashboard .rbh-nav__link.is-active .rbh-nav__icon {
	background: var(--rbh-primary);
	color: #fff;
}

.rbh-dashboard .rbh-nav__link:focus-visible,
.rbh-dashboard .rbh-icon-btn:focus-visible,
.rbh-dashboard .rbh-avatar:focus-visible,
.rbh-dashboard .rbh-stat:focus-visible {
	outline: 2px solid var(--rbh-primary);
	outline-offset: 2px;
}

.rbh-dashboard .rbh-nav__badge {
	margin-left: auto;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--rbh-danger);
	color: #fff;
	font-size: 11px;
	font-style: normal;
	font-weight: 700;
}

.rbh-dashboard .rbh-nav__link--muted {
	margin-top: 0;
	padding-top: 10px;
	border-top: 0;
	color: var(--rbh-muted);
}

/* ------------------------------------------------------------------ Topbar */

.rbh-shell {
	min-width: 0;
}

.rbh-topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 4px;
	margin-bottom: 4px;
	background: linear-gradient(to bottom, var(--rbh-background) 72%, transparent);
}

.rbh-topbar__title {
	min-width: 0;
	flex: 1 1 auto;
}

.rbh-topbar__heading {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--rbh-dark);
}

.rbh-topbar__actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.rbh-topbar .rbh-topbar__menu {
	display: none;
}

.rbh-icon-btn {
	position: relative;
	display: inline-grid;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 0;
	border: 1px solid var(--rbh-border);
	border-radius: 11px;
	background: var(--rbh-surface);
	color: var(--rbh-text);
	cursor: pointer;
	text-decoration: none;
	transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}

.rbh-icon-btn:hover {
	border-color: var(--rbh-primary);
	color: var(--rbh-primary);
}

.rbh-icon-btn__dark {
	display: none;
}

.rbh-dashboard[data-theme="dark"] .rbh-icon-btn__light {
	display: none;
}

.rbh-dashboard[data-theme="dark"] .rbh-icon-btn__dark {
	display: inline-grid;
	place-items: center;
}

.rbh-icon-btn__dot {
	position: absolute;
	top: -5px;
	right: -5px;
	min-width: 18px;
	padding: 1px 5px;
	border-radius: 999px;
	background: var(--rbh-danger);
	color: #fff;
	font-size: 10.5px;
	font-style: normal;
	font-weight: 700;
	line-height: 16px;
	text-align: center;
}

.rbh-avatar {
	display: inline-grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 11px;
	background: linear-gradient(135deg, var(--rbh-primary), var(--rbh-secondary));
	color: #fff;
	font-size: 13.5px;
	font-weight: 700;
	letter-spacing: .02em;
	text-decoration: none;
}

/* -------------------------------------------------------------------- Hero */

.rbh-hero {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	align-items: flex-end;
	justify-content: space-between;
	padding: 26px;
	margin-bottom: 18px;
	overflow: hidden;
	border-radius: var(--rbh-radius-lg);
	background:
		radial-gradient(120% 140% at 88% 8%, color-mix(in srgb, var(--rbh-accent) 55%, transparent), transparent 58%),
		linear-gradient(135deg, var(--rbh-primary), var(--rbh-secondary));
	color: #fff;
	box-shadow: var(--rbh-elevate);
}

.rbh-hero__body {
	min-width: 0;
}

.rbh-hero__eyebrow {
	margin: 0 0 3px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .09em;
	text-transform: uppercase;
	opacity: .82;
}

.rbh-hero__title {
	margin: 0;
	font-size: 27px;
	font-weight: 700;
	letter-spacing: -0.025em;
	line-height: 1.2;
	color: #fff;
}

.rbh-hero__sub {
	max-width: 46ch;
	margin: 7px 0 0;
	opacity: .88;
}

.rbh-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 18px;
}

.rbh-hero .rbh-btn--primary {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	background: #fff;
	border-color: #fff;
	color: var(--rbh-primary);
}

.rbh-hero .rbh-btn--primary:hover {
	background: #fff;
	color: var(--rbh-primary);
	transform: translateY(-1px);
}

.rbh-btn--on-hero {
	border-color: rgba(255, 255, 255, .5);
	color: #fff;
	background: rgba(255, 255, 255, .1);
}

.rbh-btn--on-hero:hover {
	background: rgba(255, 255, 255, .2);
	border-color: #fff;
	color: #fff;
}

.rbh-hero__aside {
	padding: 14px 18px;
	border-radius: 14px;
	background: rgba(255, 255, 255, .14);
	backdrop-filter: blur(6px);
}

.rbh-hero__aside-label {
	display: block;
	font-size: 11.5px;
	letter-spacing: .07em;
	text-transform: uppercase;
	opacity: .85;
}

.rbh-hero__aside-value {
	display: block;
	margin-top: 3px;
	font-size: 25px;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.rbh-hero__aside-meta {
	display: block;
	margin-top: 1px;
	font-size: 12.5px;
	opacity: .82;
}

/* ------------------------------------------------------------------- Stats */

.rbh-dashboard .rbh-stats {
	display: grid;
	gap: 14px;
	grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
	margin-bottom: 18px;
}

.rbh-dashboard .rbh-stat {
	position: relative;
	display: block;
	padding: 16px 18px 17px;
	overflow: hidden;
	border: 1px solid var(--rbh-border);
	border-left-width: 1px;
	border-radius: 15px;
	background: var(--rbh-surface);
	box-shadow: var(--rbh-elevate);
	color: inherit;
	text-decoration: none;
	transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.rbh-dashboard .rbh-stat::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 3px;
	background: var(--rbh-primary);
}

.rbh-dashboard .rbh-stat--warning::before { background: var(--rbh-warning); }
.rbh-dashboard .rbh-stat--info::before    { background: var(--rbh-accent); }
.rbh-dashboard .rbh-stat--success::before { background: var(--rbh-success); }

.rbh-dashboard .rbh-stat:hover {
	transform: translateY(-2px);
	border-color: color-mix(in srgb, var(--rbh-primary) 40%, var(--rbh-border));
}

.rbh-stat__icon {
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	margin-bottom: 11px;
	border-radius: 10px;
	background: var(--rbh-surface-sunk);
	color: var(--rbh-primary);
}

.rbh-stat--warning .rbh-stat__icon { color: var(--rbh-warning); }
.rbh-stat--info .rbh-stat__icon    { color: var(--rbh-accent); }
.rbh-stat--success .rbh-stat__icon { color: var(--rbh-success); }

.rbh-dashboard .rbh-stat__label {
	display: block;
	color: var(--rbh-muted);
	font-size: 12.5px;
	font-weight: 500;
	letter-spacing: .01em;
	text-transform: none;
}

.rbh-dashboard .rbh-stat__value {
	display: block;
	margin-top: 2px;
	font-size: 26px;
	font-weight: 700;
	letter-spacing: -0.03em;
	color: var(--rbh-dark);
}

/* ------------------------------------------------------------------ Panels */

.rbh-dashboard .rbh-panel {
	padding: 18px 20px 20px;
	margin-bottom: 18px;
	border: 1px solid var(--rbh-border);
	border-radius: var(--rbh-radius-lg);
	background: var(--rbh-surface);
	box-shadow: var(--rbh-elevate);
}

.rbh-dashboard .rbh-panel__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
}

.rbh-dashboard .rbh-panel__head .rbh-h3 {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
}

/* --------------------------------------------------------- Live deliveries */

.rbh-live-dot {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--rbh-success);
	box-shadow: 0 0 0 0 color-mix(in srgb, var(--rbh-success) 60%, transparent);
	animation: rbh-pulse 2.4s ease-out infinite;
}

@keyframes rbh-pulse {
	0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--rbh-success) 55%, transparent); }
	70%  { box-shadow: 0 0 0 7px transparent; }
	100% { box-shadow: 0 0 0 0 transparent; }
}

.rbh-delivery-list {
	display: grid;
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.rbh-delivery-item__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 7px;
}

.rbh-delivery-item__name {
	color: var(--rbh-dark);
	font-weight: 600;
	text-decoration: none;
}

.rbh-delivery-item__name:hover {
	color: var(--rbh-primary);
}

.rbh-delivery-item__pct {
	flex: 0 0 auto;
	color: var(--rbh-primary);
	font-size: 13.5px;
	font-weight: 700;
}

.rbh-delivery-item__meta {
	margin: 6px 0 0;
	color: var(--rbh-muted);
	font-size: 12.5px;
}

.rbh-meter {
	display: block;
	height: 8px;
	border-radius: 999px;
	background: var(--rbh-surface-sunk);
	overflow: hidden;
}

.rbh-dashboard[data-theme="dark"] .rbh-meter {
	background: #2a3145;
}

.rbh-meter__fill {
	display: block;
	height: 100%;
	min-width: 4px;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--rbh-primary), var(--rbh-accent));
	transition: width .5s cubic-bezier(.4, 0, .2, 1);
}

/* ------------------------------------------------------------------ Tabbar */

.rbh-tabbar {
	display: none;
}

/* -------------------------------------------------------------- Responsive */

@media screen and (max-width: 900px) {
	.rbh-dashboard {
		grid-template-columns: minmax(0, 1fr);
		gap: 0;
	}

	.rbh-rail {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		z-index: 100;
		width: min(84vw, var(--rbh-rail-width));
		border-radius: 0 var(--rbh-radius-lg) var(--rbh-radius-lg) 0;
		transform: translateX(-102%);
		transition: transform .24s cubic-bezier(.4, 0, .2, 1);
		overflow-y: auto;
	}

	.rbh-dashboard.is-rail-open .rbh-rail {
		transform: translateX(0);
	}

	.rbh-rail__close {
		display: inline-grid;
		place-items: center;
	}

	.rbh-rail-backdrop {
		position: fixed;
		inset: 0;
		z-index: 99;
		background: rgba(8, 11, 18, .5);
		backdrop-filter: blur(2px);
	}

	.rbh-topbar .rbh-topbar__menu {
		display: inline-grid;
		place-items: center;
	}

	.rbh-main {
		padding-bottom: 76px;
	}

	.rbh-tabbar {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 90;
		display: grid;
		grid-auto-flow: column;
		grid-auto-columns: 1fr;
		padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
		border-top: 1px solid var(--rbh-border);
		background: var(--rbh-surface);
	}

	.rbh-tabbar__link {
		position: relative;
		display: grid;
		gap: 3px;
		justify-items: center;
		padding: 7px 4px;
		border-radius: 10px;
		color: var(--rbh-muted);
		font-size: 11px;
		font-weight: 600;
		text-decoration: none;
	}

	.rbh-tabbar__link.is-active {
		color: var(--rbh-primary);
	}

	.rbh-tabbar__dot {
		position: absolute;
		top: 5px;
		right: 50%;
		width: 7px;
		height: 7px;
		margin-right: -14px;
		border-radius: 50%;
		background: var(--rbh-danger);
	}

	.rbh-hero {
		padding: 22px;
	}

	.rbh-hero__title {
		font-size: 23px;
	}

	.rbh-hero__aside {
		width: 100%;
	}
}

@media screen and (max-width: 480px) {
	.rbh-dashboard .rbh-stats {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.rbh-dashboard .rbh-stat__value {
		font-size: 22px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rbh-dashboard *,
	.rbh-dashboard *::before,
	.rbh-dashboard *::after {
		animation-duration: .001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .001ms !important;
	}
}

/* Fallback for browsers without color-mix(): keep the active state readable. */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
	.rbh-dashboard .rbh-nav__link.is-active {
		background: rgba(108, 92, 231, .12);
	}
}

/* -------------------------------------------------- Order delivery details */

.rbh-panel--delivery .rbh-meter {
	height: 10px;
	margin-bottom: 14px;
}

.rbh-delivery-stats {
	display: grid;
	gap: 10px 26px;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	margin: 0 0 10px;
}

.rbh-delivery-stats dt {
	color: var(--rbh-muted);
	font-size: 12.5px;
}

.rbh-delivery-stats dd {
	margin: 2px 0 0;
	color: var(--rbh-dark);
	font-size: 16px;
	font-weight: 650;
	letter-spacing: -0.01em;
}

/* The delivery panel also renders outside the dashboard shell (order pages
   built from the shortcode), so it needs its own token fallbacks. */
.rbh-panel--delivery .rbh-live-dot {
	background: var(--rbh-success, #16A34A);
}

/* --------------------------------------------------- Specificity hardening */

/* See the matching section at the end of frontend.css: a theme or page
   builder's global heading/link styles (e.g. Elementor's Kit CSS, which
   targets bare tags via ".elementor-kit-27 h2" / "...a") can be more
   specific than a single class, so the rail, topbar and hero re-assert
   their own type here with an extra ancestor class to guarantee they win. */

.rbh-dashboard .rbh-topbar__heading {
	font-family: inherit;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -0.02em;
	color: var(--rbh-dark);
}

.rbh-dashboard .rbh-hero__title {
	font-family: inherit;
	font-size: 27px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.025em;
	color: #fff;
}

.rbh-dashboard .rbh-rail__logo,
.rbh-dashboard .rbh-rail__name {
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
	color: var(--rbh-dark);
}

.rbh-dashboard .rbh-btn--on-hero {
	font-family: inherit;
	text-decoration: none;
	color: #fff;
}

.rbh-dashboard .rbh-tabbar__link {
	font-family: inherit;
	font-size: 11px;
	font-weight: 600;
	text-decoration: none;
	color: var(--rbh-muted);
}

.rbh-dashboard .rbh-tabbar__link.is-active {
	color: var(--rbh-primary);
}
