/*
 * account.css — Dashboard-specific styles for /account
 * Inherits ALL design tokens from /uprise.css — do NOT redefine them here.
 * Loaded AFTER uprise.css so it can extend without overriding.
 *
 * Design parameters (spec §4.2):
 *   Variance 7 · Motion 5 · Density 4
 *   Inter-section gaps: 64px · Card padding: 40px
 *
 * Motion (spec §4.5, emil-design-eng compliance):
 *   All transitions ≤300ms, except deliberate hero moments (≤1.1s)
 *   House easing only — never CSS-default ease/linear/ease-in-out
 *   --ease-out maps to house curve (same as --ease in uprise.css)
 */

/* ---- House easing alias (spec §4.5) ---- */
:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* ---- Strict 6-step type scale (spec §4.4) ---- */
  --type-meta:       11px;
  --type-row:        13px;
  --type-body:       15px;
  --type-card-title: 18px;
  --type-section:    28px;
  --type-hero:       clamp(40px, 6vw, 64px);
  --type-display:    clamp(36px, 5vw, 52px);

  /* Dashboard layout */
  --sidebar-w:    240px;
  --header-h:     72px;
  --content-maxw: 860px;
}

/* =====================================================================
   LAYOUT SHELL
   ===================================================================== */

/* Body layout: sidebar + main column */
.d-layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--header-h);
}

/* ---- Dashboard Header (overrides base header) ---- */
.d-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  height: var(--header-h);
  background: rgba(10, 10, 10, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
}

.d-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: calc(var(--sidebar-w) + var(--content-maxw) + 48px);
  margin: 0 auto;
}

.d-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.d-header-wordmark {
  font-size: var(--type-card-title); /* 18px — closest scale step to brand 20px */
}

.d-header-wordmark .media {
  font-size: var(--type-row); /* 13px — script overlay at scale step below */
}

/* Hamburger — visible only on mobile */
.d-hamburger {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--text);
}

.d-hamburger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.d-hamburger svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  fill: none;
  transition: opacity 200ms var(--ease-out);
}

/* User chip — avatar + name in header top-right */
.d-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: default;
}

.d-user-chip-name {
  font-size: var(--type-row);
  font-weight: 500;
  color: var(--text-dim);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Sidebar ---- */
.d-sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 100;
  padding: 24px 0 32px;
  transition: transform 250ms var(--ease-out);
}

.d-sidebar-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}

.d-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: var(--type-row);
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  position: relative;
  transition: color 200ms var(--ease-out), background 200ms var(--ease-out);
}

.d-sidebar-item:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

/* Active: left 3px accent bar + tinted label */
.d-sidebar-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.d-sidebar-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.d-sidebar-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Sidebar icon */
.d-sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.d-sidebar-item.active .d-sidebar-icon {
  opacity: 1;
}

/* Divider above Sign out */
.d-sidebar-divider {
  height: 1px;
  background: var(--hairline);
  margin: 12px 16px;
}

/* Sign out — text button at bottom of sidebar */
.d-sidebar-signout {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 26px;
  font-size: var(--type-row);
  font-weight: 500;
  color: var(--text-dim);
  background: none;
  border: 0;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  transition: color 200ms var(--ease-out);
}

.d-sidebar-signout:hover {
  color: var(--text);
}

.d-sidebar-signout:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Main content area ---- */
.d-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding: 64px 40px 80px;
  max-width: calc(var(--sidebar-w) + var(--content-maxw));
}

#content {
  max-width: var(--content-maxw);
  margin: 0 auto;
}

/* Route skeleton — shown while page module loads */
.route-skeleton {
  height: 360px;
  border-radius: 16px;
  background: linear-gradient(
    90deg,
    var(--surface) 25%,
    var(--surface-2) 50%,
    var(--surface) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-sweep 1.6s var(--ease-out) infinite;
}

@keyframes skeleton-sweep {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =====================================================================
   AVATAR BADGE
   ===================================================================== */

.avatar-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--avatar-size, 48px);
  height: var(--avatar-size, 48px);
  border-radius: 50%;
  flex-shrink: 0;
  user-select: none;
}

.avatar-badge-inner {
  font-weight: 700;
  font-size: calc(var(--avatar-size, 48px) * 0.38);
  letter-spacing: -0.02em;
  color: #fff;
  line-height: 1;
}

.avatar-kind-initials,
.avatar-kind-monogram {
  background: linear-gradient(135deg, var(--avatar-c1, var(--accent)), var(--avatar-c2, #A23000));
}

.avatar-kind-fallback {
  background: var(--surface-2);
}

/* =====================================================================
   DASHBOARD CARDS
   ===================================================================== */

/* Base dashboard card — DOES NOT lift on hover (non-actionable by default) */
.d-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 40px;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}

/* Actionable card — lifts on hover. ONLY use for clickable cards. */
.d-card-action {
  will-change: transform, box-shadow;
  cursor: pointer;
  transition: transform 250ms var(--ease-out), border-color 250ms var(--ease-out), box-shadow 250ms var(--ease-out);
}

.d-card-action:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 79, 24, 0.35);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

/* Compact card variant */
.d-card-sm {
  padding: 24px 28px;
}

/* Card with accent top border */
.d-card-accented {
  border-top: 2px solid var(--accent);
}

/* Error state card */
.d-error {
  border-color: rgba(239, 68, 68, 0.3);
}

/* Empty state within a card */
.d-empty {
  color: var(--text-dim);
  font-size: var(--type-body);
  text-align: center;
  padding: 32px 0;
}

/* =====================================================================
   STATUS PILLS (outlined, per spec §5.2)
   ===================================================================== */

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 980px;
  font-size: var(--type-meta);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  line-height: 1.4;
}

.status-pill.tone-active   { color: #30D158; }
.status-pill.tone-warn     { color: var(--accent); }
.status-pill.tone-amber    { color: #FFB02E; }
.status-pill.tone-blue     { color: #5E9EFF; }
.status-pill.tone-default  { color: var(--text-dim); }

/* =====================================================================
   TYPE HELPERS
   ===================================================================== */

.d-meta        { font-size: var(--type-meta); }
.d-row-text    { font-size: var(--type-row); }
.d-body        { font-size: var(--type-body); line-height: 1.6; }
.d-card-title  { font-size: var(--type-card-title); font-weight: 700; letter-spacing: -0.02em; line-height: 1.4; }
.d-section-h   { font-size: var(--type-section); font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.d-hero-h      { font-size: var(--type-hero); font-weight: 800; letter-spacing: -0.04em; line-height: 1.05; }
.d-display-num { font-size: var(--type-display); font-weight: 800; letter-spacing: -0.05em; line-height: 1.0; }

.d-dim    { color: var(--text-dim); }
.d-accent { color: var(--accent); }

/* Section label — 11px uppercase meta */
.d-section-label {
  font-size: var(--type-meta);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: block;
  margin-bottom: 16px;
}

/* Section gap — 64px between sections per density 4 */
.d-section {
  margin-top: 64px;
}

.d-section:first-child {
  margin-top: 0;
}

/* =====================================================================
   BUTTONS
   ===================================================================== */

.d-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--type-row);
  font-weight: 600;
  font-family: var(--sans);
  padding: 10px 18px;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  transition: filter 200ms var(--ease-out), transform 200ms var(--ease-out);
  will-change: transform;
}

.d-btn-primary {
  background: var(--accent);
  color: #fff;
}

.d-btn-primary:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.d-btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--hairline);
}

.d-btn-ghost:hover {
  border-color: var(--hairline-strong);
  background: rgba(255, 255, 255, 0.04);
}

.d-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.d-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Press state: 100ms per spec §4.5 */
.d-btn:active {
  transform: scale(0.97);
  transition-duration: 100ms;
}

/* Full-width button variant */
.d-btn-full {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
}

/* Active link in footer */
.foot-active-link {
  color: var(--accent) !important;
}

/* Login status: success state */
.d-status-ok {
  color: #30D158;
}

/* Utility: hidden via class (avoids inline style=) */
.d-hidden {
  display: none !important;
}

/* Processing card title spacing */
.d-processing-title {
  margin-bottom: 12px;
}

/* =====================================================================
   INPUTS
   ===================================================================== */

.d-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--hairline);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: var(--type-body);
  width: 100%;
  font-family: var(--sans);
  transition: border-color 200ms var(--ease-out);
}

.d-input:focus {
  outline: none;
  border-color: var(--accent);
}

.d-input:read-only {
  opacity: 0.6;
  cursor: not-allowed;
}

/* =====================================================================
   MONOSPACE KEY
   ===================================================================== */

.d-key {
  font-family: ui-monospace, Menlo, "Cascadia Code", monospace;
  font-size: var(--type-row);
  background: rgba(0, 0, 0, 0.5);
  padding: 10px 16px;
  border-radius: 8px;
  letter-spacing: 0.04em;
  border: 1px solid var(--hairline);
  color: var(--text);
  word-break: break-all;
}

/* =====================================================================
   SEAT RING
   ===================================================================== */

.seat-ring {
  display: block;
  flex-shrink: 0;
}

/* =====================================================================
   FINGERPRINT BARCODE
   ===================================================================== */

.fingerprint-bars {
  display: block;
  flex-shrink: 0;
}

/* =====================================================================
   LOGIN FORM (unauthenticated state)
   ===================================================================== */

.d-login-wrap {
  min-height: calc(100vh - var(--header-h) - 200px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.d-login-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 440px;
}

.d-login-title {
  font-size: var(--type-section);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.d-login-sub {
  font-size: var(--type-body);
  color: var(--text-dim);
  margin-bottom: 28px;
  line-height: 1.6;
}

.d-err {
  color: var(--accent);
  font-size: var(--type-row);
  margin-top: 8px;
}

/* =====================================================================
   TOAST NOTIFICATION
   ===================================================================== */

.d-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: var(--type-row);
  font-weight: 500;
  color: var(--text);
  z-index: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity 200ms var(--ease-out), transform 250ms var(--ease-out);
  white-space: nowrap;
}

.d-toast.d-toast-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =====================================================================
   PAYMENT PROCESSING BANNER
   ===================================================================== */

.d-processing-wrap {
  min-height: calc(100vh - var(--header-h) - 100px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.d-processing-card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 20px;
  padding: 48px 44px;
  width: 100%;
  max-width: 480px;
  text-align: center;
}

.d-processing-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--hairline);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 24px;
  animation: d-spin 0.8s steps(24, end) infinite;
}

@keyframes d-spin {
  to { transform: rotate(360deg); }
}

/* =====================================================================
   MOBILE — collapse sidebar behind hamburger at <900px
   ===================================================================== */

@media (max-width: 900px) {
  .d-hamburger {
    display: flex;
  }

  .d-main {
    margin-left: 0;
    padding: 40px 20px 64px;
  }

  .d-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-w)));
    /* Sidebar overlays content on mobile */
    z-index: 150;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }

  .d-sidebar.open {
    transform: translateX(0);
  }

  /* Overlay scrim behind sidebar */
  .d-sidebar-scrim {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 140;
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms var(--ease-out);
  }

  .d-sidebar-scrim.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .d-card {
    padding: 28px 24px;
  }

  .d-login-card {
    padding: 36px 28px;
  }
}

@media (max-width: 480px) {
  .d-main {
    padding: 32px 16px 56px;
  }

  .d-user-chip-name {
    display: none;
  }
}

/* =====================================================================
   REDUCED MOTION — covers EVERY keyframe defined in this file
   Per spec §4.3 anti-pattern checklist: mandatory.
   ===================================================================== */

@media (prefers-reduced-motion: reduce) {
  .route-skeleton {
    animation: none;
    background: var(--surface-2);
  }

  .d-processing-spinner {
    animation: none;
    border-top-color: var(--accent);
    opacity: 0.6;
  }

  /* Sidebar transitions */
  .d-sidebar {
    transition: none;
  }

  /* Sidebar scrim transitions */
  .d-sidebar-scrim {
    transition: none;
  }

  /* Button transitions */
  .d-btn {
    transition: none;
  }

  /* Input transitions */
  .d-input {
    transition: none;
  }

  /* Toast transitions */
  .d-toast {
    transition: none;
  }

  /* Card transitions */
  .d-card-action {
    transition: none;
  }
}
