/* Job Hunter 2.0 — Component styles */

* { box-sizing: border-box; }
html { font-size: var(--fs-root); }
body {
  margin: 0;
  font-family: var(--font-sans);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
}

/* Focus ring — 2px primary, 2px offset */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ── Artboard host (fills DCArtboard frame) ────────────────────── */
.jh-app {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.jh-shell { display: flex; flex: 1; min-height: 0; }
.jh-side {
  width: 248px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 180ms ease;
}
.jh-side.collapsed { width: 72px; }
.jh-side.collapsed .jh-side-label,
.jh-side.collapsed .jh-side-foot,
.jh-side.collapsed .jh-side-section {
  display: none;
}
.jh-side.collapsed .jh-side-link { justify-content: center; padding: 12px; }
.jh-side.collapsed .jh-logo-text { display: none; }

.jh-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px 18px;
  font-weight: 700;
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  color: var(--text);
}
.jh-logo-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--primary);
  color: var(--on-primary);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.jh-side-section {
  padding: 14px 20px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.jh-side-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.jh-side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  min-height: 44px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.jh-side-link:hover { background: var(--surface-2); color: var(--text); }
.jh-side-link.active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}
.theme-dark .jh-side-link.active { color: var(--primary); }
.jh-side-link svg { flex-shrink: 0; }

/* Step-number badge on sidebar workflow items: a small circular number
   that makes "do this in order" obvious without extra copy. White circle
   with the sidebar's own dark-green colour as the number, so the badge
   reads as a punch-out from the dark sidebar background. */
.jh-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  color: #104525;  /* matches the sidebar's primary dark-green */
  font-size: 0.72rem;
  font-weight: 800;
  margin-right: 4px;
  flex-shrink: 0;
}
/* Active item keeps the same colour scheme — the row's own active styling
   already signals which step you're on, no need to invert the badge. */
.jh-side-link.active .jh-step-num {
  background: #fff;
  color: #104525;
}
.jh-side.collapsed .jh-step-num { display: none; }

/* Compact icon-stacked action button: emoji/icon on top, tiny label below.
   Pattern used in Applications row to fit Resume / Cover / Mock interview /
   Job into a single horizontal lane without label wrap. Mirrors the
   Android bottom-nav and most modern toolbar conventions. */
.jh-iconbtn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-width: 58px;
  padding: 6px 4px 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  transition: background 0.12s, border-color 0.12s;
  line-height: 1.1;
}
.jh-iconbtn:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.jh-iconbtn .ic {
  font-size: 1.05rem;
  line-height: 1;
}
.jh-iconbtn .lab {
  font-size: 0.66rem;
  letter-spacing: 0.01em;
  color: var(--text-2);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}
.jh-iconbtn:hover .lab { color: var(--text); }
/* Primary tone — for the "I've applied ✓" affirmative action */
.jh-iconbtn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.jh-iconbtn.primary .lab { color: rgba(255,255,255,0.92); }
.jh-iconbtn.primary:hover { background: var(--primary); filter: brightness(1.06); }

/* The pdf-dropdown <summary> swaps to icon-stack when it carries this class */
.jh-iconbtn.jh-dropdown-summary { position: relative; }
.jh-iconbtn .caret {
  position: absolute;
  top: 3px; right: 5px;
  font-size: 0.65rem;
  color: var(--text-3);
}

/* ───────── Interview avatar component (Mock Interview) ─────────
   16:9 landscape player (matches the 1920×1080 HeyGen renders). Two stacked
   layers:
     - <video>  visible while TTS audio is playing (the talking-head MP4)
     - <img>    visible while idle (neutral first frame from the same MP4)
   A 280 ms opacity cross-fade hides the moment the video pauses, so the
   user never sees a freeze-on-open-mouth glitch.
   NOTE: this is `.jh-iv-avatar`, NOT `.jh-avatar` — the latter is the
   tiny user-initials circle in the sidebar footer (defined further down).
   Same-name classes used to clobber each other via cascade order. */
.jh-iv-avatar {
  position: relative;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  background: var(--surface-2);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.jh-iv-avatar > img,
.jh-iv-avatar > video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: opacity 0.28s ease;
}
.jh-iv-avatar > video        { opacity: 0; }      /* hidden until .speaking */
.jh-iv-avatar.speaking > video { opacity: 1; }
.jh-iv-avatar.speaking > img   { opacity: 0; }

/* Avatar picker on the Mock Interview landing — three selectable cards */
.jh-avatar-picker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 10px 0 16px;
}
@media (max-width: 640px) {
  .jh-avatar-picker { grid-template-columns: 1fr; }
}
.jh-avatar-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  text-align: center;
}
.jh-avatar-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.jh-avatar-card.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.jh-avatar-card img {
  width: 96px; height: 96px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
}
.jh-avatar-card .name {
  font-weight: 700; font-size: 0.95rem;
}
.jh-avatar-card .meta {
  font-size: 0.78rem; color: var(--text-2); line-height: 1.35;
}

/* Mock Interview — mode picker (General/Behavioural vs Technical/Job-Specific) */
.jh-mode-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 10px 0 4px;
}
@media (max-width: 720px) {
  .jh-mode-picker { grid-template-columns: 1fr; }
}
.jh-mode-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px 16px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.jh-mode-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.jh-mode-card.selected { border-color: var(--primary); background: var(--primary-soft); }
.jh-mode-card-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:4px; }
.jh-mode-card-title { font-weight: 800; font-size: 1.05rem; }
.jh-mode-card-blurb { color: var(--text-2); font-size: 0.88rem; line-height: 1.45; margin: 0 0 12px; }
.jh-mode-card-avatars { display: flex; gap: 10px; flex-wrap: wrap; }
.jh-mini-avatar { display:flex; flex-direction:column; align-items:center; text-align:center; min-width: 80px; flex:0 1 110px; }
.jh-mini-avatar img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--surface-2); margin-bottom:4px; }
.jh-mini-avatar .mini-label { font-weight: 700; font-size: 0.8rem; }
.jh-mini-avatar .mini-meta  { font-size: 0.7rem;  color: var(--text-3); line-height: 1.3; }

/* Sub-picker that appears when the user chooses Technical and there are
   multiple technical avatars (Jordan + Sevek). Uses jh-avatar-card styling. */
.jh-tech-subpicker { animation: fadeIn 0.2s ease; }
.jh-tech-avatars   {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 0 0 10px;
}
@media (max-width: 640px) {
  .jh-tech-avatars { grid-template-columns: 1fr; }
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.jh-side-foot {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.jh-avatar {
  width: 36px; height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: var(--on-primary);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}
.jh-side-user { line-height: 1.25; min-width: 0; flex: 1; }
.jh-side-user .name { font-weight: 600; font-size: 0.9rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jh-side-user .email { font-size: 0.78rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Main area ─────────────────────────────────────────────────── */
.jh-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.jh-topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.jh-search {
  flex: 1; max-width: 480px;
  display: flex; align-items: center; gap: 10px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-tinted);
  color: var(--text-3);
  font-size: 0.9rem;
}
.jh-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
}
.jh-pill.ok { color: var(--success); background: var(--success-soft); border-color: transparent; }
.jh-pill.warn { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.jh-pill.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.jh-pill .dot { width: 7px; height: 7px; border-radius: 999px; background: currentColor; }

.jh-content {
  flex: 1;
  overflow: auto;
  padding: 32px 36px;
  background: var(--bg);
}

/* ── Page header ───────────────────────────────────────────────── */
.jh-pagehead { margin-bottom: 28px; }
.jh-pagehead h1 {
  margin: 0 0 6px; font-size: var(--fs-2xl);
  font-weight: 700; letter-spacing: -0.02em;
  line-height: var(--lh-tight);
}
.jh-pagehead p { margin: 0; color: var(--text-2); font-size: 1.02rem; }

/* ── Buttons ───────────────────────────────────────────────────── */
.jh-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 20px;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms, transform 80ms;
  text-decoration: none;
  white-space: nowrap;
}
.jh-btn:active { transform: translateY(1px); }
.jh-btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  height: 56px;
  padding: 0 24px;
  font-size: 1rem;
}
.jh-btn-primary:hover { background: var(--primary-hover); }
.jh-btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.jh-btn-secondary:hover { background: var(--surface-2); border-color: var(--text-3); }
.jh-btn-ghost {
  background: transparent;
  color: var(--text-2);
}
.jh-btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.jh-btn-sm { height: 36px; padding: 0 14px; font-size: 0.85rem; }

/* ── Cards ─────────────────────────────────────────────────────── */
.jh-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: var(--pad-card, 24px);
  box-shadow: var(--shadow-sm);
}
.jh-card-h {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.jh-card-h h3 { margin: 0; font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; }
.jh-card-h .sub { color: var(--text-3); font-size: 0.85rem; }

/* ── KPI tile ──────────────────────────────────────────────────── */
.jh-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
}
.jh-kpi .lab {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; color: var(--text-2); font-weight: 500;
  margin-bottom: 10px;
}
.jh-kpi .val {
  font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  /* Long text values (role names like SoftwareEngineerAI, dates) must fit
     inside the tile. Truncation is fine. */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Auto-shrink when the value is long. Applied by JS via dataset.long="1". */
.jh-kpi .val[data-long="1"] { font-size: 1.1rem; }
.jh-kpi .val[data-long="2"] { font-size: 0.92rem; }
.jh-kpi { min-width: 0; }  /* allows the ellipsis to actually engage inside grid cells */
.jh-kpi .delta {
  margin-top: 6px;
  font-size: 0.82rem; color: var(--success); font-weight: 600;
}
.jh-kpi .delta.dn { color: var(--danger); }

/* ── Form controls ─────────────────────────────────────────────── */
.jh-field { display: flex; flex-direction: column; gap: 6px; }
.jh-field label {
  font-weight: 600; font-size: 0.9rem; color: var(--text);
}
.jh-input, .jh-select, .jh-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 11px 14px;
  min-height: 44px;
  transition: border-color 120ms, box-shadow 120ms;
}
.jh-input:focus, .jh-select:focus, .jh-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
}
.jh-textarea { min-height: 320px; resize: vertical; line-height: 1.5; padding: 14px; }
.jh-helper { font-size: 0.82rem; color: var(--text-3); }

/* ── Chips / badges ────────────────────────────────────────────── */
.jh-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.jh-chip.ok { color: var(--success); background: var(--success-soft); border-color: transparent; }
.jh-chip.warn { color: var(--warning); background: var(--warning-soft); border-color: transparent; }
.jh-chip.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.jh-chip.solid {
  background: var(--primary); color: var(--on-primary); border-color: transparent;
}
.jh-chip svg { flex-shrink: 0; }

/* Keyword chips */
.jh-kw {
  display: inline-flex; align-items: center;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--bg-tinted);
  color: var(--text-2);
  border: 1px solid var(--border);
  margin: 0 6px 6px 0;
}
.jh-kw.matched { background: var(--success-soft); color: var(--success); border-color: transparent; }
.jh-kw.gap { background: var(--warning-soft); color: var(--warning); border-color: transparent; }

/* ── Tables ────────────────────────────────────────────────────── */
.jh-table {
  width: 100%; border-collapse: collapse;
  font-size: 0.95rem;
}
.jh-table thead th {
  text-align: left;
  padding: 12px 16px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.jh-table tbody tr { cursor: pointer; transition: background 100ms; }
.jh-table tbody tr:nth-child(even) { background: var(--surface-2); }
.jh-table tbody tr:hover { background: var(--primary-soft); }
.jh-table tbody tr.active { background: var(--primary-soft-2); }
.jh-table td {
  padding: var(--pad-row, 14px 16px);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

/* ── Misc ──────────────────────────────────────────────────────── */
.jh-row { display: flex; gap: 12px; align-items: center; }
.jh-stack { display: flex; flex-direction: column; }
.jh-grow { flex: 1; min-width: 0; }
.jh-divider { height: 1px; background: var(--border); margin: 16px 0; }
.jh-mute { color: var(--text-2); }
.jh-mute-2 { color: var(--text-3); }
.jh-mono { font-family: 'JetBrains Mono', ui-monospace, Menlo, monospace; font-size: 0.85em; }

/* Score gauge */
.jh-gauge {
  position: relative;
  width: 220px; height: 220px;
}
.jh-gauge svg { width: 100%; height: 100%; }
.jh-gauge-inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.jh-gauge-num {
  font-size: 3.5rem; font-weight: 700; letter-spacing: -0.04em; line-height: 1;
  color: var(--text);
}
.jh-gauge-num .pct { font-size: 1.5rem; color: var(--text-3); font-weight: 600; }
.jh-gauge-lab { margin-top: 4px; font-size: 0.85rem; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

/* Score bar */
.jh-scorebar {
  width: 100%; height: 14px;
  background: var(--bg-tinted);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border);
}
.jh-scorebar .fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 400ms ease; }

/* Dot meter */
.jh-dots { display: flex; gap: 6px; }
.jh-dots .d {
  width: 18px; height: 18px; border-radius: 6px;
  background: var(--bg-tinted);
  border: 1px solid var(--border);
}
.jh-dots .d.on { background: var(--primary); border-color: var(--primary); }

/* Side panel within applications artboard */
.jh-sidepanel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 480px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(15,23,42,0.06);
  display: flex; flex-direction: column;
  z-index: 5;
}
.jh-sidepanel-h {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.jh-tabs { display: flex; gap: 4px; padding: 0 24px; border-bottom: 1px solid var(--border); }
.jh-tab {
  padding: 12px 14px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: none; border-top: none; border-left: none; border-right: none;
  font-family: inherit;
}
.jh-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.jh-tab:hover { color: var(--text); }

/* Landing-specific */
.jh-landing-hero {
  padding: 72px 80px 56px;
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 56px;
  align-items: center;
  background:
    radial-gradient(circle at 85% 10%, color-mix(in srgb, var(--primary) 8%, transparent) 0%, transparent 50%),
    var(--bg);
}
.jh-landing h1 {
  font-size: var(--fs-4xl);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 20px;
  font-weight: 700;
}
.jh-landing h1 em {
  font-style: normal;
  color: var(--primary);
  font-family: var(--font-serif);
  font-weight: 600;
}
.jh-landing-lede { font-size: 1.2rem; color: var(--text-2); max-width: 540px; margin: 0 0 28px; line-height: 1.5; }

/* Responsive (token-driven) */
.jh-media-mobile .jh-side { display: none; }

/* a11y helpers */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); border: 0;
}

/* ── Design canvas chrome overrides for warm aesthetic ─────────── */
:root {
  --dc-bg: #ECEAE3;
}

/* DCArtboard override: softer corners + warm paper feel for cards */
.dc-artboard-frame {
  background: var(--bg) !important;
}
