/**
 * TB POS — Themes
 *
 * Three looks over one system. Loaded after tokens.css; each block re-declares
 * only the tokens whose VALUES change. Type scale, spacing, radius ramp,
 * touch targets and z-index are shared — a theme changes the surface, never
 * the ergonomics.
 *
 * resort   (default, no attribute) — Bahamian hospitality. Champagne, warm
 *          stone, editorial serif. The look TB POS shipped with.
 * service  — Light, flat, high contrast. Utility typeface, solid structure.
 *           For back office and daylight service.
 * night    — Dark throughout. The KDS treatment extended to every staff
 *           screen. For evening events and outdoor bars.
 *
 * Guest-facing surfaces (.tb-customer) are pinned to resort further down:
 * those pages sell an experience and should not follow a staff preference.
 *
 * Adding a theme = one more block here. Do not hard-code colours in screen CSS.
 */

/* ===================================================================
   SERVICE — light, flat, high contrast
   =================================================================== */

#tb-pos-app[data-tb-theme="service"],
.tb-pos-root[data-tb-theme="service"] {
	/* Brand — teal darkened for contrast on white; gold demoted to guest/VIP only */
	--tb-teal: #0f5158;
	--tb-teal-deep: #0a393e;
	--tb-teal-wash: #e3eff0;
	--tb-shell-gold: #c9a227;
	--tb-shell-gold-deep: #8a6d12;
	--tb-shell-cream: #f3f1ec;
	--tb-coral: #c9776a;
	--tb-coral-deep: #a3574b;
	--tb-deep-rose: #8e4a40;
	--tb-ink: #16191c;
	--tb-ink-soft: #1f2327;

	/* Surfaces — flat. No gradient atmosphere: it costs paint time on cheap
	   tills and lowers contrast in daylight. */
	--tb-bg: #edece8;
	--tb-bg-glow: none;
	--tb-surface: #ffffff;
	--tb-surface-solid: #ffffff;
	--tb-surface-alt: #e3e2dd;
	--tb-header-bg: #ffffff;
	--tb-sidebar: #16191c;
	--tb-sidebar-solid: #16191c;
	--tb-sidebar-hover: rgba(255, 255, 255, 0.09);
	--tb-sidebar-text: #c9ccce;
	--tb-sidebar-text-muted: #8b9095;

	/* Text */
	--tb-text-primary: #16191c;
	--tb-text-secondary: #55595d;
	--tb-text-inverse: #ffffff;
	--tb-text-on-teal: #ffffff;
	/* Coral is lightened for this theme, so white on it measured 3.32:1. */
	--tb-text-on-coral: #2a0f0a;
	--tb-text-on-gold: #1a1405;
	--tb-text-on-gold-deep: #ffffff;

	--tb-inverse-surface: #16191c;
	--tb-text-on-inverse: #ffffff;
	--tb-sidebar-text-active: #ffffff;
	--tb-field-bg: #ffffff;
	--tb-field-bg-solid: #ffffff;

	/* Borders — solid and load-bearing. Hairlines at 8% vanish under glare. */
	--tb-border: #dddbd5;
	--tb-border-strong: #16191c;
	--tb-border-gold: #c9a227;

	/* Operational */
	--tb-success: #147a52;
	--tb-success-wash: #e4f2ea;
	--tb-success-text: #147a52;
	--tb-text-on-success: #ffffff;

	/* Deepened from #a76a00, which left white text at 4.46:1 — a hair under
	   AA, and this is the theme chosen for daylight service. */
	--tb-warning: #8f5b00;
	--tb-warning-wash: #fbeedb;
	--tb-warning-text: #8f5b00;
	--tb-text-on-warning: #ffffff;

	--tb-danger: #b3261e;
	--tb-danger-wash: #fbe9e7;
	--tb-danger-text: #b3261e;
	--tb-text-on-danger: #ffffff;

	--tb-info: #0f5158;
	--tb-info-wash: #e3eff0;
	--tb-info-text: #0f5158;
	--tb-text-on-info: #ffffff;

	--tb-muted: #55595d;
	--tb-muted-wash: #e8e7e2;
	--tb-muted-text: #55595d;

	/* Status */
	--tb-status-requested: #0f5158;
	--tb-status-picking: #8f5b00;
	--tb-status-ready: #147a52;
	--tb-status-urgent: #b3261e;
	--tb-status-fulfilled: #3d7a63;

	/* Type — one utility face for every staff screen. The serif stays on
	   guest surfaces, where warmth is doing a job. */
	--tb-font-display: "Archivo", "Helvetica Neue", Helvetica, sans-serif;
	--tb-font: "Archivo", "Helvetica Neue", Helvetica, sans-serif;

	/* Geometry — tighter radii read as equipment rather than editorial */
	--tb-radius-sm: 4px;
	--tb-radius-md: 6px;
	--tb-radius-lg: 8px;
	--tb-radius-xl: 10px;

	/* Elevation — structure comes from borders, not shadow */
	--tb-shadow-sm: none;
	--tb-shadow-md: 0 2px 8px rgba(22, 25, 28, 0.08);
	--tb-focus-ring: #0a393e;
	--tb-shadow-focus: 0 0 0 2px var(--tb-surface-solid), 0 0 0 4px var(--tb-focus-ring);
}

/* ===================================================================
   NIGHT — dark throughout
   =================================================================== */

#tb-pos-app[data-tb-theme="night"],
.tb-pos-root[data-tb-theme="night"] {
	--tb-teal: #17a2b8;
	/* On a dark UI "deep" has to mean *brighter*, not darker: a hover state
	   recedes otherwise. The old #128394 also sat in the dead zone where
	   neither white (4.47:1) nor ink (4.36:1) cleared AA. */
	--tb-teal-deep: #2fb0c4;
	--tb-teal-wash: #0d2a30;
	--tb-shell-gold: #c9a227;
	--tb-shell-gold-deep: #e3c05e;
	--tb-shell-cream: #1f2327;
	--tb-coral: #e08a7a;
	--tb-coral-deep: #c9776a;
	--tb-deep-rose: #e0a79c;
	--tb-ink: #04252a;
	--tb-ink-soft: #0b0d0f;

	--tb-bg: #0b0d0f;
	--tb-bg-glow: none;
	--tb-surface: #171b1f;
	--tb-surface-solid: #171b1f;
	--tb-surface-alt: #1a2026;
	--tb-header-bg: rgba(23, 27, 31, 0.86);
	--tb-sidebar: #12161a;
	--tb-sidebar-solid: #12161a;
	--tb-sidebar-hover: rgba(255, 255, 255, 0.08);
	--tb-sidebar-text: #c9ccce;
	--tb-sidebar-text-muted: #9aa1a7;

	--tb-text-primary: #f2f4f5;
	--tb-text-secondary: #9aa1a7;
	--tb-text-inverse: #0b0d0f;
	--tb-text-on-teal: #04252a;
	--tb-text-on-coral: #1a0d09;
	--tb-text-on-gold: #1a1405;
	/* Night's gold-deep (#e3c05e) is lighter than its gold, so ink. */
	--tb-text-on-gold-deep: #1a1405;

	/* Inverted the other way here: on a dark console the panel that must jump
	   forward is a LIGHT one. This is the pair that was white-on-white. */
	--tb-inverse-surface: #f2f4f5;
	--tb-text-on-inverse: #0b0d0f;

	/* The sidebar stays dark even here, so its active label stays white —
	   --tb-text-inverse is #0b0d0f in this theme and would vanish. */
	--tb-sidebar-text-active: #ffffff;

	--tb-field-bg: #1f262c;
	--tb-field-bg-solid: #1f262c;

	--tb-border: #2a3037;
	--tb-border-strong: #69757f;
	--tb-border-gold: #c9a227;

	/* Night's accents are tuned to glow on a dark page, which makes them far
	   too light to carry white text — every one of these measured near 3:1
	   with #fff. Text sitting ON them is ink; text on the dark washes is the
	   accent itself. */
	--tb-success: #34c77b;
	--tb-success-wash: #0e2a1d;
	--tb-success-text: #34c77b;
	--tb-text-on-success: #0b0d0f;

	--tb-warning: #f0a92b;
	--tb-warning-wash: #2b2109;
	--tb-warning-text: #f0a92b;
	--tb-text-on-warning: #0b0d0f;

	--tb-danger: #ff5c52;
	--tb-danger-wash: #2e100d;
	--tb-danger-text: #ff5c52;
	--tb-text-on-danger: #0b0d0f;

	--tb-info: #17a2b8;
	--tb-info-wash: #0d2a30;
	--tb-info-text: #17a2b8;
	--tb-text-on-info: #0b0d0f;

	--tb-muted: #9aa1a7;
	--tb-muted-wash: #1a2026;
	--tb-muted-text: #9aa1a7;

	--tb-status-requested: #17a2b8;
	--tb-status-picking: #f0a92b;
	--tb-status-ready: #34c77b;
	--tb-status-urgent: #ff5c52;
	--tb-status-fulfilled: #4d8a72;

	--tb-font-display: "Archivo", "Helvetica Neue", Helvetica, sans-serif;
	--tb-font: "Archivo", "Helvetica Neue", Helvetica, sans-serif;

	--tb-radius-sm: 4px;
	--tb-radius-md: 6px;
	--tb-radius-lg: 8px;
	--tb-radius-xl: 10px;

	--tb-shadow-sm: none;
	--tb-shadow-md: 0 2px 10px rgba(0, 0, 0, 0.5);
	--tb-focus-ring: #5fd0e3;
	--tb-shadow-focus: 0 0 0 2px var(--tb-surface-solid), 0 0 0 4px var(--tb-focus-ring);

	color-scheme: dark;
}

/* Night: the page itself, so WordPress chrome around the app does not
   flash white behind a dark console. */
body.tb-pos-root[data-tb-theme="night"],
body.tb-pos-staff-app[data-tb-theme="night"],
body.tb-pos-login-body[data-tb-theme="night"] {
	background: var(--tb-bg);
	color: var(--tb-text-primary);
}

/* ===================================================================
   Guest surfaces stay on the brand look
   ===================================================================
   A promoter choosing Night for their bar staff must not turn the guest
   VIP pages dark. These re-assert the resort values regardless of the
   attribute inherited from an ancestor. */

.tb-pos-root.tb-customer,
.tb-customer {
	--tb-teal: #1a6b74;
	--tb-teal-deep: #0f4f56;
	--tb-teal-wash: #e8f2f3;
	--tb-shell-gold: #c4a574;
	--tb-shell-gold-deep: #7d6540;
	--tb-shell-cream: #e8ddd6;
	--tb-coral: #e8a090;
	--tb-coral-deep: #c97b6c;
	--tb-deep-rose: #8a554f;

	--tb-bg: #f3efe8;
	--tb-surface: rgba(255, 252, 248, 0.92);
	--tb-surface-solid: #fffcf8;
	--tb-surface-alt: #ebe4da;
	--tb-header-bg: rgba(255, 252, 248, 0.78);

	--tb-text-primary: #12181e;
	--tb-text-secondary: #5c5852;
	--tb-text-inverse: #fffcf8;
	--tb-text-on-teal: #ffffff;
	--tb-text-on-gold: #12181e;
	--tb-text-on-gold-deep: #ffffff;
	--tb-text-on-coral: #12181e;

	/* Re-asserted, not inherited: a guest page rendered inside a Night-themed
	   console would otherwise pick up Night's light inverse surface and show
	   dark-on-dark. */
	--tb-inverse-surface: #12181e;
	--tb-text-on-inverse: #ffffff;
	--tb-sidebar-text-active: #ffffff;
	--tb-field-bg: rgba(255, 252, 248, 0.7);
	--tb-field-bg-solid: #fffcf8;

	--tb-border: rgba(18, 24, 30, 0.08);
	--tb-border-strong: rgba(18, 24, 30, 0.48);
	--tb-border-gold: rgba(196, 165, 116, 0.45);

	/* Guest pages have no sidebar today, but the tokens are reset so a future
	   one cannot inherit a staff theme's chrome. */
	--tb-sidebar: linear-gradient(185deg, #0e1a22 0%, #0b1218 48%, #0a161c 100%);
	--tb-sidebar-solid: #0b1218;
	--tb-sidebar-text: #c8c2ba;
	--tb-sidebar-text-muted: #938d85;

	--tb-success: #1f7a5c;
	--tb-success-wash: #e8f4ef;
	--tb-success-text: #1f7a5c;
	--tb-text-on-success: #ffffff;

	--tb-warning: #b8862e;
	--tb-warning-wash: #f8f1e3;
	--tb-warning-text: #8e6723;
	--tb-text-on-warning: #12181e;

	--tb-danger: #b8433f;
	--tb-danger-wash: #f8eceb;
	--tb-danger-text: #b8433f;
	--tb-text-on-danger: #ffffff;

	--tb-info: #1a6b74;
	--tb-info-wash: #e8f2f3;
	--tb-info-text: #1a6b74;
	--tb-text-on-info: #ffffff;

	--tb-muted: #7a756e;
	--tb-muted-wash: #ebe6df;
	--tb-muted-text: #6b6761;

	--tb-font-display: "Cormorant Garamond", "Times New Roman", Georgia, serif;
	--tb-font: "Outfit", "Avenir Next", "Segoe UI", sans-serif;

	--tb-radius-sm: 4px;
	--tb-radius-md: 8px;
	--tb-radius-lg: 12px;
	--tb-radius-xl: 16px;

	color-scheme: light;
}

/* ===================================================================
   Theme picker
   =================================================================== */

.tb-theme-picker {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	padding: 3px;
	border: 1px solid var(--tb-border);
	border-radius: var(--tb-radius-md);
	background: var(--tb-surface-alt);
}

.tb-theme-picker__btn {
	min-height: var(--tb-touch-min);
	padding: 0 var(--tb-space-3);
	border: none;
	border-radius: var(--tb-radius-sm);
	background: transparent;
	color: var(--tb-text-secondary);
	font: inherit;
	font-size: var(--tb-text-label);
	font-weight: 600;
	cursor: pointer;
}

.tb-theme-picker__btn:hover {
	color: var(--tb-text-primary);
}

.tb-theme-picker__btn[aria-pressed="true"] {
	background: var(--tb-surface-solid);
	color: var(--tb-text-primary);
	box-shadow: var(--tb-shadow-sm);
}

.tb-theme-picker__btn:focus-visible {
	outline: none;
	box-shadow: var(--tb-shadow-focus);
}
