/* =====================================================
   BARISTABUDDIE — DESIGN SYSTEM
   CSS custom properties (primitive → semantic → component)
   All pages import this file. Never use raw hex in components.
===================================================== */

/* ── PRIMITIVES ─────────────────────────────────── */
:root {
  /* Amber palette */
  --amber-200: #fde5b8;
  --amber-400: #f5c06a;
  --amber-500: #efb26f;
  --amber-600: #e8955a;
  --amber-700: #d4753e;

  /* Neutral */
  --white: #ffffff;
  --gray-50:  #f0f0f0;
  --gray-100: rgba(255,255,255,0.88);
  --gray-200: rgba(255,255,255,0.72);
  --gray-300: rgba(255,255,255,0.52);
  --gray-400: rgba(255,255,255,0.35);
  --gray-500: rgba(255,255,255,0.18);
  --gray-600: rgba(255,255,255,0.08);
  --gray-700: rgba(255,255,255,0.055);
  --gray-800: rgba(255,255,255,0.04);
  --bg-900:   #0a0a0d;
  --bg-800:   #0c0c0f;
  --bg-700:   #131318;
  --bg-600:   #1a1b24;

  /* Status */
  --red-bg:     rgba(196,87,69,0.14);
  --red-border: rgba(196,87,69,0.30);
  --red-text:   #ffd7d1;
  --green-bg:   rgba(45,124,85,0.20);
  --green-border: rgba(45,124,85,0.40);
  --green-text:   #a8f0c6;
  --amber-bg:   rgba(239,178,111,0.12);
  --amber-border: rgba(239,178,111,0.28);
  --amber-text:   #fff3e6;
}

/* ── SEMANTIC TOKENS ─────────────────────────────── */
:root {
  /* Colours */
  --clr-primary:       var(--amber-500);
  --clr-primary-dark:  var(--amber-600);
  --clr-primary-bg:    rgba(239,178,111,0.10);
  --clr-primary-border:rgba(239,178,111,0.28);

  --clr-bg:            var(--bg-900);
  --clr-surface:       var(--gray-700);
  --clr-surface-raised:var(--gray-600);
  --clr-border:        rgba(255,255,255,0.09);
  --clr-border-subtle: rgba(255,255,255,0.07);

  --clr-text:          var(--gray-50);
  --clr-text-muted:    var(--gray-300);
  --clr-text-subtle:   var(--gray-400);
  --clr-text-disabled: var(--gray-500);

  --clr-error-bg:      var(--red-bg);
  --clr-error-border:  var(--red-border);
  --clr-error-text:    var(--red-text);
  --clr-success-bg:    var(--green-bg);
  --clr-success-border:var(--green-border);
  --clr-success-text:  var(--green-text);
  --clr-info-bg:       var(--amber-bg);
  --clr-info-border:   var(--amber-border);
  --clr-info-text:     var(--amber-text);

  /* Typography */
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   16px;
  --text-lg:   18px;
  --text-xl:   20px;
  --text-2xl:  24px;
  --text-3xl:  32px;
  --leading-tight:  1.1;
  --leading-snug:   1.35;
  --leading-normal: 1.55;
  --leading-relaxed:1.65;

  /* Spacing (4pt grid) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;

  /* Radius */
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-xl:   26px;
  --radius-2xl:  32px;
  --radius-full: 999px;

  /* Shadows */
  --shadow-sm:     0 2px 8px rgba(0,0,0,0.20);
  --shadow-md:     0 8px 24px rgba(0,0,0,0.30);
  --shadow-lg:     0 22px 70px rgba(0,0,0,0.45);
  --shadow-amber:  0 8px 24px rgba(239,178,111,0.35);
  --shadow-amber-lg: 0 18px 40px rgba(239,178,111,0.50);
  --shadow-inset-top: inset 0 1px 0 rgba(255,255,255,0.20);

  /* Motion */
  --dur-fast:   150ms;
  --dur-normal: 200ms;
  --dur-slow:   300ms;
  --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:    cubic-bezier(0.4, 0, 1, 1);
}

/* ── BASE RESET ──────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background: var(--clr-bg);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--clr-text);
  line-height: var(--leading-normal);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

/* ── REDUCED MOTION ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration:           0.01ms !important;
    animation-iteration-count:    1      !important;
    transition-duration:          0.01ms !important;
    scroll-behavior:              auto   !important;
  }
}

/* ── FOCUS RING (global) ─────────────────────────── */
:focus-visible {
  outline: 2px solid var(--clr-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── SKIP LINK ───────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  background: var(--clr-primary);
  color: #1a0800;
  font-weight: 700;
  font-size: var(--text-base);
  border-radius: var(--radius-md);
  z-index: 9999;
  transition: top var(--dur-fast);
}
.skip-link:focus {
  top: var(--sp-4);
}

/* ── SHARED CARD ─────────────────────────────────── */
.bb-card {
  width: 100%;
  max-width: 460px;
  padding: 44px 40px;
  border-radius: var(--radius-2xl);
  background: linear-gradient(160deg, rgba(255,255,255,0.13), rgba(255,255,255,0.03));
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(255,255,255,0.15);
  box-shadow: var(--shadow-lg), var(--shadow-inset-top);
}

/* ── SHARED INPUT ────────────────────────────────── */
.bb-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--clr-text-muted);
  margin-bottom: var(--sp-2);
}

.bb-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.07);
  font-size: var(--text-md);
  box-sizing: border-box;
  color: var(--clr-text);
  font-family: var(--font-sans);
  outline: none;
  transition: border-color var(--dur-fast);
  min-height: 48px;
}

.bb-input::placeholder { color: var(--clr-text-subtle); }
.bb-input:focus        { border-color: rgba(239,178,111,0.6); }
.bb-input:focus-visible { outline: 2px solid var(--clr-primary); outline-offset: 2px; }

/* ── SHARED BUTTON ───────────────────────────────── */
.bb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 15px var(--sp-6);
  border: none;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: var(--text-md);
  font-family: var(--font-sans);
  cursor: pointer;
  transition: transform var(--dur-normal) var(--ease-out),
              box-shadow var(--dur-normal) var(--ease-out),
              opacity var(--dur-fast);
  min-height: 48px;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.bb-btn:focus-visible {
  outline: 2px solid var(--clr-primary);
  outline-offset: 3px;
}

.bb-btn-primary {
  background: linear-gradient(135deg, var(--amber-500), var(--amber-600));
  color: #1a0800;
  box-shadow: var(--shadow-amber);
}
.bb-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-amber-lg);
}

.bb-btn-ghost {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  color: var(--clr-text);
}
.bb-btn-ghost:hover:not(:disabled) {
  background: rgba(255,255,255,0.11);
  transform: translateY(-2px);
}

.bb-btn:disabled,
.bb-btn[aria-busy="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.bb-btn-full { width: 100%; }

/* Loading spinner inside button */
.bb-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0,0,0,0.25);
  border-top-color: #1a0800;
  border-radius: 50%;
  animation: bb-spin 0.6s linear infinite;
  flex-shrink: 0;
}
.bb-btn[aria-busy="true"] .bb-spinner { display: block; }
.bb-btn[aria-busy="true"] .bb-btn-label { opacity: 0.7; }

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

/* ── STATUS BANNERS ──────────────────────────────── */
.bb-alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: var(--sp-4);
}

.bb-alert-error {
  background: var(--clr-error-bg);
  border: 1px solid var(--clr-error-border);
  color: var(--clr-error-text);
}

.bb-alert-success {
  background: var(--clr-success-bg);
  border: 1px solid var(--clr-success-border);
  color: var(--clr-success-text);
}

.bb-alert-info {
  background: var(--clr-info-bg);
  border: 1px solid var(--clr-info-border);
  color: var(--clr-info-text);
}

/* ── SHARED AUTH PAGE ────────────────────────────── */
.bb-auth-bg {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: var(--sp-6);
  background:
    radial-gradient(circle at 12% 16%, rgba(255,183,77,0.22), transparent 45%),
    radial-gradient(circle at 88% 10%, rgba(255,112,67,0.22), transparent 42%),
    linear-gradient(145deg, #0b0b0d, #1a1a22 45%, #111216);
}

/* ── DIVIDER ─────────────────────────────────────── */
.bb-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: var(--sp-5) 0 0;
}

/* ── SVG ICON HELPER ─────────────────────────────── */
.bb-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
}

/* ── CONTAINER ───────────────────────────────────── */
.bb-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
}
