/* ============================================================
   Career Sentinel — App Shell Design System
   ============================================================
   §6 blueprint: white/#f5f7fb ground, royal blue #2563eb primary,
   gold #f5b829 ONLY highlights, ink #0f172a.
   8px spacing scale. 4 type sizes. Cards: hairline border + soft shadow.
   ============================================================ */

/* ── Shell layout ────────────────────────────────────────────────────────── */

/* Pages that use the app shell get body.app-page */
body.app-page {
  background: #f5f7fb;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* App content wrapper — sits between top bar and bottom tabs */
.app-content {
  flex: 1;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 16px 88px; /* 88px = bottom tab clearance */
}

/* Desktop: wider max, no bottom-tab clearance needed at 900px+ */
@media (min-width: 900px) {
  .app-content {
    max-width: 860px;
    padding: 24px 24px 40px;
  }
}

/* ── Top app bar ─────────────────────────────────────────────────────────── */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.96);
  border-bottom: 1px solid #e6ebf3;
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  gap: 12px;
  /* iOS standalone: keep the bar's tap targets below the notch/status bar */
  padding: env(safe-area-inset-top, 0px) 16px 0 16px;
  height: calc(56px + env(safe-area-inset-top, 0px));
  flex-shrink: 0;
}

.app-bar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #0f172a;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.app-bar-brand img {
  border-radius: 7px;
}
.app-bar-brand-accent {
  color: #2563eb;
}

.app-bar-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Desktop top-nav tabs (≥900px) — replaces bottom bar */
.app-bar-nav {
  display: none; /* shown in media query below */
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.app-bar-nav-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 9px;
  text-decoration: none;
  color: #475569;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.14s, color 0.14s;
  white-space: nowrap;
}
.app-bar-nav-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.app-bar-nav-tab:hover {
  background: #f0f4ff;
  color: #2563eb;
}
.app-bar-nav-tab.is-active {
  background: #eff6ff;
  color: #2563eb;
  font-weight: 600;
}

.app-bar-nav-btn {
  margin-left: 8px;
  background: #2563eb;
  color: #fff;
  border: 0;
  border-radius: 9px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: filter 0.12s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.app-bar-nav-btn:hover {
  filter: brightness(1.08);
}

@media (min-width: 900px) {
  .app-bar-nav {
    display: flex;
  }
  .app-bar-title {
    display: none; /* brand name shown at desktop, title redundant */
  }
}

/* ── Bottom tab bar ──────────────────────────────────────────────────────── */
.app-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(255,255,255,0.97);
  border-top: 1px solid #e6ebf3;
  backdrop-filter: blur(12px);
  display: flex;
  align-items: stretch;
  height: 64px;
  padding-bottom: env(safe-area-inset-bottom, 0);
  /* hidden on desktop — app-nav.js handles this */
}

.app-nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 500;
  transition: color 0.14s;
  padding: 6px 4px;
  min-height: 44px;
}
.app-nav-tab svg {
  width: 22px;
  height: 22px;
}
.app-nav-label {
  font-size: 0.68rem;
  line-height: 1.1;
}
.app-nav-tab:hover {
  color: #2563eb;
}
.app-nav-tab.is-active {
  color: #2563eb;
}
.app-nav-tab.is-active svg {
  stroke-width: 2.5;
}

body.has-app-nav .app-content {
  padding-bottom: 88px;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid #e6ebf3;
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(15,23,42,.07), 0 1px 2px rgba(15,23,42,.04);
  padding: 16px;
}

.card-lg {
  padding: 20px;
}

.card-pressable {
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.card-pressable:hover {
  border-color: #bfdbfe;
  box-shadow: 0 4px 16px rgba(37,99,235,0.10);
}
.card-pressable:active {
  transform: scale(0.97);
}

/* Primary card variant */
.card-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}
.card-primary:hover {
  border-color: #2563eb;
  filter: brightness(1.06);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 0.97rem;
  font-weight: 700;
  font-family: inherit;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: filter 0.12s, transform 0.1s, box-shadow 0.12s;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 4px 14px rgba(37,99,235,0.25);
}
.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
  background: transparent;
  color: #2563eb;
  border: 1.5px solid #bfdbfe;
  height: 46px; /* compensate border */
}
.btn-ghost:hover {
  background: #eff6ff;
}

.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 0.87rem;
  border-radius: 9px;
}

/* ── Typography helpers ──────────────────────────────────────────────────── */
.t-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.t-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}
.t-body {
  font-size: 0.95rem;
  color: #475569;
  line-height: 1.6;
}
.t-caption {
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.4;
}
.t-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
}

/* ── Skeleton loaders ────────────────────────────────────────────────────── */
@keyframes skel-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.skel-bar {
  border-radius: 6px;
  background: linear-gradient(90deg, #e2e8f0 0%, #f1f5f9 50%, #e2e8f0 100%);
  background-size: 600px 100%;
  animation: skel-shimmer 1.4s infinite linear;
  display: block;
}

/* ── Chips ───────────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-size: 0.84rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.14s, background 0.14s, color 0.14s;
}
.chip:hover {
  border-color: #93c5fd;
  color: #0f172a;
}
.chip.is-active {
  border-color: #2563eb;
  background: #eff6ff;
  color: #2563eb;
}
.chip-count {
  background: #2563eb;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 0 5px;
  min-width: 18px;
  text-align: center;
  line-height: 18px;
}

/* ── Bottom sheet ────────────────────────────────────────────────────────── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-backdrop[hidden] { display: none; }

.sheet {
  background: #fff;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 40px rgba(15,23,42,0.14);
  overflow: hidden;
}

@media (min-width: 640px) {
  .sheet-backdrop {
    align-items: center;
  }
  .sheet {
    border-radius: 20px;
    max-height: 80vh;
    margin: 24px;
  }
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: #cbd5e1;
  margin: 12px auto 0;
  flex-shrink: 0;
}

.sheet-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid #e6ebf3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sheet-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
}

.sheet-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  transition: color 0.14s;
}
.sheet-close:hover { color: #0f172a; }

.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  -webkit-overflow-scrolling: touch;
}

.sheet-footer {
  padding: 12px 20px;
  border-top: 1px solid #e6ebf3;
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}
.sheet-footer .btn { flex: 1; }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: #0f172a;
  color: #fff;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.toast.toast-success { background: #059669; }
.toast.toast-error { background: #dc2626; }

/* ── Section headers ─────────────────────────────────────────────────────── */
.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #94a3b8;
  margin: 0 0 10px;
}

/* ── Dividers ────────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: #e6ebf3;
  margin: 16px 0;
}

/* ── Progress bar ────────────────────────────────────────────────────────── */
.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: #2563eb;
  transition: width 0.5s ease;
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}
.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.empty-state-title {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 8px;
}
.empty-state-body {
  font-size: 0.9rem;
  color: #475569;
  max-width: 32ch;
  margin: 0 auto 16px;
}

/* ── Salary green ────────────────────────────────────────────────────────── */
.salary-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(5,150,105,0.08);
  border: 1px solid rgba(5,150,105,0.22);
  color: #047857;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Resilience score colors — RESERVED only for AI-resilience badge */
.res-high {
  background: rgba(5,150,105,0.10);
  border: 1px solid rgba(5,150,105,0.25);
  color: #047857;
}
.res-mid {
  background: rgba(245,158,11,0.10);
  border: 1px solid rgba(245,158,11,0.25);
  color: #b45309;
}
.res-low {
  background: rgba(220,38,38,0.08);
  border: 1px solid rgba(220,38,38,0.20);
  color: #b91c1c;
}

/* ── Resilience hex badge ────────────────────────────────────────────────── */
.res-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

/* ── Pill row ────────────────────────────────────────────────────────────── */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ── Heart save button ───────────────────────────────────────────────────── */
.heart-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #cbd5e1;
  font-size: 1.2rem;
  line-height: 1;
  padding: 4px;
  border-radius: 50%;
  transition: color 0.15s, transform 0.15s;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.heart-btn:hover { color: #f43f5e; }
.heart-btn.is-saved {
  color: #f43f5e;
  animation: heart-bounce 0.2s ease;
}

@keyframes heart-bounce {
  0%  { transform: scale(1); }
  50% { transform: scale(1.3); }
  100%{ transform: scale(1); }
}

/* ── Wizard progress bar ─────────────────────────────────────────────────── */
.wizard-progress {
  height: 3px;
  background: #e2e8f0;
  position: sticky;
  top: 56px; /* below app bar */
  z-index: 40;
}
.wizard-progress-fill {
  height: 100%;
  background: #2563eb;
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* ── Wizard screen ───────────────────────────────────────────────────────── */
.wizard-screen {
  display: none;
  flex-direction: column;
  gap: 16px;
  padding: 24px 0 16px;
}
.wizard-screen.is-active {
  display: flex;
}

.wizard-question {
  font-size: 1.4rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.wizard-skip {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 8px 0;
  text-align: left;
  transition: color 0.14s;
}
.wizard-skip:hover { color: #475569; }

/* ── Snackbar ─────────────────────────────────────────────────────────────── */
.snackbar {
  position: fixed;
  bottom: 80px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  margin: 0 auto;
  background: #0f172a;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 500;
  z-index: 301;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.snackbar.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
