/* ===================================================
   FORGE — Base Styles
   Variables · Reset · Typography · Utilities
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ── Custom Properties ── */
:root {
  /* Backgrounds */
  --bg-primary:   #0A0A0A;
  --bg-secondary: #111111;
  --bg-card:      #161616;
  --bg-elevated:  #1C1C1C;
  --bg-input:     #1A1A1A;

  /* Accents */
  --orange:  #FF3D00;
  --orange-dim: rgba(255, 61, 0, 0.15);
  --cyan:    #00E5FF;
  --cyan-dim: rgba(0, 229, 255, 0.12);
  --lime:    #CCFF00;
  --lime-dim: rgba(204, 255, 0, 0.12);
  --green:   #00C853;
  --green-dim: rgba(0, 200, 83, 0.12);

  /* Text */
  --text-primary:   #FFFFFF;
  --text-secondary: #C0C0C0;
  --text-muted:     #7A7A7A;

  /* Borders */
  --border-subtle: rgba(255,255,255,0.06);
  --border-medium: rgba(255,255,255,0.12);
  --border-strong: rgba(255,255,255,0.2);

  /* Typography */
  --font-heading: 'Bebas Neue', 'Impact', sans-serif;
  --font-body:    'DM Sans', system-ui, -apple-system, sans-serif;

  /* Spacing scale (4px base) */
  --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;

  /* Radii */
  --r-sm:   6px;
  --r-md:   10px;
  --r-lg:   14px;
  --r-xl:   18px;
  --r-2xl:  24px;
  --r-full: 9999px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast:   150ms ease;
  --t-base:   250ms ease;
  --t-slow:   400ms var(--ease-out);

  /* Z-index */
  --z-base:     1;
  --z-dropdown: 100;
  --z-sticky:   200;
  --z-modal:    300;
  --z-toast:    400;

  /* Layout */
  --nav-h:    64px;
  --header-h: 56px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

/* ── Light Mode ── */
body.light {
  --bg-primary:   #F2F2F7;
  --bg-secondary: #FFFFFF;
  --bg-card:      #FFFFFF;
  --bg-elevated:  #E8E8ED;
  --bg-input:     #F2F2F7;

  --text-primary:   #0A0A0A;
  --text-secondary: #4A4A4A;
  --text-muted:     #8A8A8E;

  --border-subtle: rgba(0,0,0,0.07);
  --border-medium: rgba(0,0,0,0.12);
  --border-strong: rgba(0,0,0,0.2);
}
body.light .modal-overlay { background: rgba(0,0,0,0.5); }
body.light .modal         { background: #FFFFFF; }
body.light .toast         { background: #FFFFFF; box-shadow: 0 8px 40px rgba(0,0,0,0.15); }
body.light .btn-ghost     { background: #E8E8ED; color: #0A0A0A; }
body.light .btn-ghost:hover { background: #D8D8DC; }
body.light .skeleton { background: linear-gradient(90deg,#E8E8ED 25%,#D8D8DC 50%,#E8E8ED 75%); background-size:200% 100%; }

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  height: -webkit-fill-available;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  min-height: -webkit-fill-available;
}

img, video, svg { display: block; max-width: 100%; }
button { cursor: pointer; font-family: var(--font-body); border: none; background: none; }
input, textarea, select { font-family: var(--font-body); font-size: inherit; }
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--lime); }
ul, ol { list-style: none; }

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.05;
  letter-spacing: 0.03em;
}
h1 { font-size: clamp(3rem, 10vw, 5.5rem); }
h2 { font-size: clamp(2.2rem, 7vw, 3.5rem); }
h3 { font-size: clamp(1.8rem, 5vw, 2.5rem); }
h4 { font-size: clamp(1.4rem, 4vw, 1.8rem); }
h5 { font-size: 1.3rem; }
h6 { font-size: 1.1rem; }

/* ── Scrollbar ── */
::-webkit-scrollbar       { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--orange); }

/* ── Gradient Text Helpers ── */
.grad-orange {
  background: linear-gradient(135deg, var(--orange) 0%, #FF7043 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.grad-cyan {
  background: linear-gradient(135deg, var(--cyan) 0%, #80DEEA 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.grad-lime {
  background: linear-gradient(135deg, var(--lime) 0%, #F0FF80 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--r-lg);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.01em;
  transition: all var(--t-fast);
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 4px 24px rgba(255,61,0,0.35);
}
.btn-primary:hover { box-shadow: 0 6px 32px rgba(255,61,0,0.55); filter: brightness(1.08); }

.btn-cyan {
  background: var(--cyan);
  color: var(--bg-primary);
  box-shadow: 0 4px 24px rgba(0,229,255,0.25);
  font-weight: 700;
}
.btn-cyan:hover { filter: brightness(1.1); }

.btn-lime {
  background: var(--lime);
  color: var(--bg-primary);
  font-weight: 700;
  box-shadow: 0 4px 24px rgba(204,255,0,0.2);
}
.btn-lime:hover { filter: brightness(1.08); }

.btn-ghost {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-medium);
}
.btn-ghost:hover { background: var(--bg-card); border-color: var(--border-strong); }

.btn-outline-orange {
  background: transparent;
  color: var(--orange);
  border: 1px solid var(--orange);
}
.btn-outline-orange:hover { background: var(--orange-dim); }

.btn-outline-cyan {
  background: transparent;
  color: var(--cyan);
  border: 1px solid var(--cyan);
}
.btn-outline-cyan:hover { background: var(--cyan-dim); }

.btn-sm  { padding: var(--sp-2) var(--sp-4); font-size: 0.875rem; border-radius: var(--r-md); }
.btn-lg  { padding: var(--sp-4) var(--sp-8); font-size: 1.0625rem; border-radius: var(--r-xl); }
.btn-xl  { padding: var(--sp-5) var(--sp-10); font-size: 1.125rem; border-radius: var(--r-xl); }
.btn-icon { padding: var(--sp-3); border-radius: var(--r-lg); aspect-ratio: 1; }

/* ── Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  padding: var(--sp-5);
}
.card-elevated {
  background: var(--bg-elevated);
  border-color: var(--border-medium);
  box-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.card-glow-orange { box-shadow: 0 0 0 1px var(--orange-dim), 0 8px 32px rgba(255,61,0,0.12); }
.card-glow-cyan   { box-shadow: 0 0 0 1px var(--cyan-dim),   0 8px 32px rgba(0,229,255,0.10); }

/* ── Form Elements ── */
.form-group { display: flex; flex-direction: column; gap: var(--sp-2); }

.form-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.form-input {
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--r-lg);
  padding: 14px var(--sp-4);
  color: var(--text-primary);
  font-size: 1rem;
  width: 100%;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  -webkit-appearance: none;
  appearance: none;
}
.form-input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0,229,255,0.08);
}
.form-input::placeholder { color: var(--text-muted); }
.form-input.error        { border-color: var(--orange); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px var(--sp-2);
  border-radius: var(--r-sm);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.badge-orange { background: var(--orange-dim); color: var(--orange); }
.badge-cyan   { background: var(--cyan-dim);   color: var(--cyan);   }
.badge-lime   { background: var(--lime-dim);   color: var(--lime);   }
.badge-muted  { background: var(--bg-elevated); color: var(--text-secondary); }

/* ── Dividers ── */
.divider { height: 1px; background: var(--border-subtle); width: 100%; }
.divider-text {
  display: flex; align-items: center; gap: var(--sp-3);
  color: var(--text-muted); font-size: 0.875rem;
}
.divider-text::before, .divider-text::after {
  content: ''; flex: 1; height: 1px; background: var(--border-subtle);
}

/* ── Spinner ── */
.spinner {
  width: 22px; height: 22px;
  border: 2px solid var(--border-medium);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.spinner-lg { width: 36px; height: 36px; border-width: 3px; }

/* ── Progress Bar ── */
.progress-bar {
  height: 5px; background: var(--border-subtle);
  border-radius: var(--r-full); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: var(--r-full);
  transition: width 0.6s var(--ease-out);
}
.progress-fill.orange { background: linear-gradient(90deg, var(--orange), #FF7043); }
.progress-fill.cyan   { background: linear-gradient(90deg, var(--cyan), #80DEEA); }
.progress-fill.lime   { background: linear-gradient(90deg, var(--lime), #F0FF80); }

/* ── Toast ── */
.toast-container {
  position: fixed;
  top: calc(var(--safe-top) + var(--sp-4));
  right: var(--sp-4);
  z-index: var(--z-toast);
  display: flex; flex-direction: column; gap: var(--sp-2);
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border-medium);
  border-radius: var(--r-lg);
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  font-size: 0.875rem; max-width: 320px;
  pointer-events: all;
  animation: toastIn 0.3s var(--ease-out), toastOut 0.3s ease 2.7s forwards;
}
.toast-success { border-left: 3px solid var(--lime); }
.toast-error   { border-left: 3px solid var(--orange); }
.toast-info    { border-left: 3px solid var(--cyan); }
.toast-icon    { font-size: 1.1rem; flex-shrink: 0; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(6px);
  z-index: var(--z-modal);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-base);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--r-2xl) var(--r-2xl) 0 0;
  width: 100%; max-width: 520px;
  max-height: 92vh; overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.35s var(--ease-out);
  padding-bottom: calc(var(--safe-bot) + var(--sp-4));
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-handle {
  width: 40px; height: 4px;
  background: var(--border-medium);
  border-radius: var(--r-full);
  margin: var(--sp-3) auto var(--sp-5);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-5) var(--sp-4);
}
.modal-body { padding: 0 var(--sp-5) var(--sp-5); }

/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, #222 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-md);
}

/* ── Utility Flex ── */
.flex       { display: flex; }
.flex-col   { flex-direction: column; }
.items-c    { align-items: center; }
.justify-c  { justify-content: center; }
.justify-sb { justify-content: space-between; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); }
.w-full { width: 100%; }
.text-center { text-align: center; }
.hidden  { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Animations ── */
@keyframes spin       { to { transform: rotate(360deg); } }
@keyframes shimmer    { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes pulse      { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes fadeInUp   { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn     { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn    { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes toastIn    { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut   { to { transform: translateX(110%); opacity: 0; } }
@keyframes float      { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes gradShift  { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

.anim-fade-up  { animation: fadeInUp 0.4s var(--ease-out) both; }
.anim-scale-in { animation: scaleIn  0.3s var(--ease-out) both; }
.anim-pulse    { animation: pulse 2s ease-in-out infinite; }

/* ── Color text utilities ── */
.text-orange { color: var(--orange); }
.text-cyan   { color: var(--cyan);   }
.text-lime   { color: var(--lime);   }

/* Stagger delays */
.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.10s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.20s; }
.delay-5 { animation-delay: 0.25s; }
