/* =============================================================
   AI Career Architect — Shared Design Tokens & Components
   Include this file in every page via:
     <link rel="stylesheet" href="/styles/design-tokens.css">
   ============================================================= */

/* ── COLOR TOKENS ── */
:root {
  /* Backgrounds */
  --color-bg:            #0f0f1a;
  --color-bg-2:          #1a1a2e;
  --color-bg-3:          #252540;

  /* Accent */
  --color-accent:        #f59e0b;
  --color-accent-hover:  #d97706;
  --color-accent-navy:   #0f0f1a; /* text on amber backgrounds */

  /* Text */
  --color-text:          #e8e8f0;
  --color-text-bright:   #f0f0f8;
  --color-text-muted:    rgba(255,255,255,0.45);
  --color-text-faint:    rgba(255,255,255,0.25);

  /* Borders */
  --color-border:        rgba(255,255,255,0.08);
  --color-border-strong: rgba(255,255,255,0.15);

  /* Risk */
  --color-risk-high:     #f87171;
  --color-risk-high-bg:  rgba(248,113,113,0.12);
  --color-risk-med:      #f59e0b;
  --color-risk-med-bg:   rgba(245,158,11,0.12);
  --color-risk-low:      #4ade80;
  --color-risk-low-bg:   rgba(74,222,128,0.12);

  /* Light-mode (modals, banners) */
  --color-light-bg:      #ffffff;
  --color-light-text:    #0f0f1a;
  --color-light-muted:   #6b6b80;
  --color-light-border:  #e0e0ea;

  /* Semantic */
  --color-blue:          #2563eb;
  --color-blue-hover:    #1d4ed8;
  --color-green:         #16a34a;
  --color-green-light:   #dcfce7;
  --color-red:           #dc2626;

  /* ── SPACING TOKENS ── */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 72px;

  /* ── TYPOGRAPHY ── */
  --font-serif: 'EB Garamond', serif;
  --font-mono:  'IBM Plex Mono', monospace;

  --text-xs:   9px;
  --text-sm:   11px;
  --text-base: 15px;
  --text-md:   16px;
  --text-lg:   18px;
  --text-xl:   24px;
  --text-2xl:  32px;
  --text-3xl:  40px;
  --text-4xl:  54px;

  /* ── BORDER RADIUS ── */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-pill: 20px;
  --radius-circle: 50%;

  /* ── SHADOWS ── */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.15);
  --shadow-md: 0 8px 40px rgba(0,0,0,0.4);
  --shadow-lg: 0 24px 48px rgba(0,0,0,0.18);

  /* ── TRANSITIONS ── */
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* =============================================================
   RISK COMPONENTS
   ============================================================= */

/* Risk text colors */
.risk-high { color: var(--color-risk-high); }
.risk-med  { color: var(--color-risk-med);  }
.risk-low  { color: var(--color-risk-low);  }

/* Risk fill colors (for bar fills and backgrounds) */
.stdiff-task-fill.risk-high,
.rm-task-fill.risk-high,
.pv-bar-fill.risk-high { background: var(--color-risk-high); }

.stdiff-task-fill.risk-med,
.rm-task-fill.risk-med,
.pv-bar-fill.risk-med  { background: var(--color-risk-med); }

.stdiff-task-fill.risk-low,
.rm-task-fill.risk-low,
.pv-bar-fill.risk-low  { background: var(--color-risk-low); }

/* Risk badge pill — includes label text for accessibility */
.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}
.risk-badge.risk-high {
  background: var(--color-risk-high-bg);
  color: var(--color-risk-high);
}
.risk-badge.risk-med {
  background: var(--color-risk-med-bg);
  color: var(--color-risk-med);
}
.risk-badge.risk-low {
  background: var(--color-risk-low-bg);
  color: var(--color-risk-low);
}

/* Risk bar — task exposure progress bar */
.risk-bar {
  width: 72px;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.risk-bar-fill {
  height: 100%;
  border-radius: 2px;
}
.risk-bar-fill.risk-high { background: var(--color-risk-high); }
.risk-bar-fill.risk-med  { background: var(--color-risk-med);  }
.risk-bar-fill.risk-low  { background: var(--color-risk-low);  }

/* =============================================================
   BUTTON SYSTEM
   ============================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity var(--transition-base), background var(--transition-base), transform var(--transition-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Primary — amber */
.btn-primary {
  background: var(--color-accent);
  color: var(--color-accent-navy);
  width: 100%;
}
.btn-primary:hover:not(:disabled) {
  opacity: 0.88;
}

/* Secondary — ghost */
.btn-secondary {
  background: rgba(255,255,255,0.06);
  color: var(--color-text);
  border: 1px solid rgba(255,255,255,0.15);
  width: 100%;
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.3);
}

/* Stripe / pay */
.btn-stripe {
  background: var(--color-blue);
  color: #fff;
  width: 100%;
}
.btn-stripe:hover:not(:disabled) {
  background: var(--color-blue-hover);
}

/* =============================================================
   MODAL SYSTEM
   ============================================================= */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(24,24,27,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  /* Fallback for browsers without backdrop-filter support */
  background: rgba(15,15,26,0.85);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}
.modal-overlay.show {
  display: flex;
}

.modal-card {
  background: var(--color-light-bg);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  animation: fadeUp var(--transition-slow);
}

.modal-header {
  background: var(--color-bg);
  padding: 22px 26px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.modal-header-label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 5px;
}
.modal-header-title {
  font-size: 20px;
  font-weight: 500;
  color: #fff;
}
.modal-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 20px;
  cursor: pointer;
  transition: color var(--transition-base);
  line-height: 1;
  padding: 0;
}
.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 26px;
}
.modal-price-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--color-light-border);
  margin-bottom: 18px;
}
.modal-price-label {
  font-size: 16px;
  color: var(--color-light-muted);
}
.modal-price-val {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 500;
  color: var(--color-light-text);
}
.modal-checklist {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 20px;
}
.modal-check-item {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--color-light-muted);
}
.modal-check-icon {
  width: 17px;
  height: 17px;
  border-radius: var(--radius-circle);
  background: var(--color-green-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--color-green);
  flex-shrink: 0;
  font-weight: 700;
}
.modal-secure-note {
  text-align: center;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-light-muted);
  letter-spacing: 0.04em;
}

/* =============================================================
   FORM VALIDATION
   ============================================================= */

.field-error {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-risk-high);
  margin-top: 7px;
  min-height: 14px;
}

/* Invalid field state — add via JS on validation failure */
.field input.is-invalid,
.field textarea.is-invalid {
  border-color: var(--color-risk-high) !important;
  background: rgba(248,113,113,0.06) !important;
}

/* ── FOCUS VISIBLE — accessibility ── */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* =============================================================
   NEWS BAR — smooth crossfade
   ============================================================= */

.urgency-item {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 48px;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.urgency-item.active {
  opacity: 1;
  pointer-events: auto;
}
