/* ============================================================
   Hirelens — app.css
   ============================================================ */

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

:root {
  --font-display: 'Fraunces', serif;
  --font-body:    'DM Sans', sans-serif;

  --navy:        #0f1e35;
  --navy-2:      #1a2f4a;
  --accent:      #1D9E75;
  --accent-mid:  #5DCAA5;
  --accent-light:#E1F5EE;
  --amber:       #BA7517;
  --amber-light: #FAEEDA;
  --red:         #A32D2D;
  --red-light:   #FCEBEB;
  --blue:        #185FA5;
  --blue-light:  #E6F1FB;
  --border:      rgba(255,255,255,0.08);
  --sidebar-w:   224px;
  --text-main:   #e8edf2;
  --text-muted:  rgba(255,255,255,0.45);
  --text-hint:   rgba(255,255,255,0.25);
}

html, body { height: 100%; font-family: var(--font-body); background: var(--navy); color: var(--text-main); }

/* ── Layout ─────────────────────────────────────────────── */
.app    { display: flex; min-height: 100vh; }
.main   { flex: 1; overflow-y: auto; min-width: 0; }
.content { padding: 28px; max-width: 1100px; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-2);
  border-right: 0.5px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; flex-shrink: 0;
}

.logo {
  padding: 20px 20px 16px;
  border-bottom: 0.5px solid var(--border);
}
.logo-mark {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 500; color: #fff; letter-spacing: -0.3px;
}
.logo-mark span { color: var(--accent-mid); }
.logo-sub {
  font-size: 10px; color: var(--text-hint);
  letter-spacing: 1.5px; text-transform: uppercase; margin-top: 2px;
}

.nav { padding: 12px 10px; flex: 1; }
.nav-section {
  font-size: 9px; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-hint); padding: 8px 10px 4px; margin-top: 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  font-size: 13px; color: var(--text-muted);
  transition: all 0.15s; margin-bottom: 1px;
}
.nav-item:hover:not(.disabled) { background: rgba(255,255,255,0.06); color: #fff; }
.nav-item.active { background: rgba(29,158,117,0.2); color: var(--accent-mid); }
.nav-item.disabled { opacity: 0.3; cursor: not-allowed; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; }

.sidebar-footer { padding: 16px; border-top: 0.5px solid var(--border); font-size: 12px; color: var(--text-hint); }
.agency-badge {
  background: rgba(29,158,117,0.15); color: var(--accent-mid);
  font-size: 10px; padding: 3px 8px; border-radius: 20px;
  border: 0.5px solid rgba(29,158,117,0.3);
  display: inline-block; margin-bottom: 4px; letter-spacing: 0.5px;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 0.5px solid var(--border);
  background: var(--navy);
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-family: var(--font-display); font-size: 17px; font-weight: 300; color: #fff; }
.topbar-title em { font-style: italic; color: var(--accent-mid); }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  padding: 7px 14px; border-radius: 8px;
  font-size: 12px; font-family: var(--font-body); cursor: pointer;
  border: 0.5px solid rgba(255,255,255,0.15);
  background: transparent; color: rgba(255,255,255,0.7);
  transition: all 0.15s;
}
.btn:hover:not(:disabled) { background: rgba(255,255,255,0.07); color: #fff; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn-primary:hover:not(:disabled) { background: #1ab884; }
.btn-full { width: 100%; padding: 10px; }
.btn-sm  { padding: 4px 10px; font-size: 11px; }

/* ── AI Badge ────────────────────────────────────────────── */
.ai-badge {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; color: var(--accent-mid);
  background: rgba(29,158,117,0.12);
  border: 0.5px solid rgba(29,158,117,0.25);
  padding: 3px 8px; border-radius: 20px; letter-spacing: 0.5px;
}
.ai-dot { width: 5px; height: 5px; background: var(--accent-mid); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ── Pages ───────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ── Section header ──────────────────────────────────────── */
.section-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-title { font-family: var(--font-display); font-size: 24px; font-weight: 300; color: #fff; letter-spacing: -0.3px; }
.section-title em { font-style: italic; color: var(--accent-mid); }
.section-sub { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── Stat cards ──────────────────────────────────────────── */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: rgba(255,255,255,0.04); border: 0.5px solid var(--border); border-radius: 12px; padding: 16px; }
.stat-label { font-size: 11px; color: var(--text-hint); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-family: var(--font-display); font-weight: 300; color: #fff; }
.stat-value span { font-size: 13px; color: var(--accent-mid); margin-left: 6px; }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 0; background: rgba(255,255,255,0.05);
  border-radius: 10px; padding: 3px; margin-bottom: 20px; width: fit-content;
}
.tab {
  padding: 7px 16px; border-radius: 8px; font-size: 12px; cursor: pointer;
  color: var(--text-muted); transition: all 0.15s;
  border: none; background: transparent; font-family: var(--font-body);
}
.tab.active { background: rgba(255,255,255,0.1); color: #fff; }
.tab:hover:not(.active) { color: rgba(255,255,255,0.7); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: rgba(255,255,255,0.04);
  border: 0.5px solid var(--border);
  border-radius: 14px; padding: 20px; margin-bottom: 16px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title  { font-size: 13px; font-weight: 500; color: rgba(255,255,255,0.8); }

.output-card { min-height: 300px; }
.output-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 260px; color: var(--text-hint); font-size: 13px; text-align: center; gap: 8px; }
.placeholder-icon { font-size: 32px; opacity: 0.3; }

/* ── Two-col layout ──────────────────────────────────────── */
.two-col { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group   { margin-bottom: 12px; }
.input-row    { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-label  { font-size: 11px; color: var(--text-muted); margin-bottom: 5px; letter-spacing: 0.3px; display: block; }
.field-input  {
  width: 100%; background: rgba(255,255,255,0.05);
  border: 0.5px solid rgba(255,255,255,0.12);
  border-radius: 8px; color: var(--text-main);
  font-family: var(--font-body); font-size: 13px;
  padding: 9px 12px; outline: none; transition: border-color 0.15s;
}
.field-input:focus { border-color: rgba(29,158,117,0.4); }
.field-input::placeholder { color: var(--text-hint); }
.field-input option { background: var(--navy-2); }
textarea.field-input { resize: vertical; line-height: 1.6; }

.checkbox-group  { display: flex; flex-direction: column; gap: 10px; }
.checkbox-label  { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.checkbox-label input { accent-color: var(--accent); width: 14px; height: 14px; }

/* ── Loading bar ─────────────────────────────────────────── */
.loading-bar { height: 2px; background: rgba(29,158,117,0.15); border-radius: 1px; margin: 12px 0; overflow: hidden; display: none; }
.loading-bar.active { display: block; }
.loading-bar::after {
  content:''; display:block; height:100%; width:30%;
  background: var(--accent-mid); border-radius: 1px;
  animation: slide 1.2s ease infinite;
}
@keyframes slide { from{transform:translateX(-100%)} to{transform:translateX(400%)} }

/* ── JD Output ───────────────────────────────────────────── */
.jd-output {
  background: rgba(255,255,255,0.03); border: 0.5px solid rgba(29,158,117,0.2);
  border-radius: 10px; padding: 16px; font-size: 13px; color: rgba(255,255,255,0.78);
  line-height: 1.85; display: none; white-space: pre-wrap; word-break: break-word;
}
.jd-output.open { display: block; animation: fadeIn 0.3s ease; }

/* ── Candidate list ──────────────────────────────────────── */
.candidate-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 0.5px solid var(--border);
  cursor: pointer; transition: all 0.15s;
}
.candidate-row:last-child { border-bottom: none; }
.candidate-row:hover { background: rgba(255,255,255,0.03); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 8px; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 500; flex-shrink: 0;
}
.av-teal   { background: rgba(29,158,117,0.2); color: var(--accent-mid); }
.av-blue   { background: rgba(24,95,165,0.2);  color: #85B7EB; }
.av-amber  { background: rgba(186,117,23,0.2); color: #EF9F27; }
.av-coral  { background: rgba(216,90,48,0.2);  color: #F0997B; }
.av-purple { background: rgba(83,74,183,0.2);  color: #AFA9EC; }

.avatar-colors { --avs: av-teal,av-blue,av-amber,av-coral,av-purple; }

.candidate-info { flex: 1; min-width: 0; }
.candidate-name { font-size: 13px; font-weight: 500; color: #fff; }
.candidate-role { font-size: 11px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.skills-row { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.skill-tag { font-size: 10px; padding: 2px 7px; border-radius: 20px; border: 0.5px solid rgba(255,255,255,0.12); color: var(--text-muted); }
.skill-tag.match { background: rgba(29,158,117,0.12); border-color: rgba(29,158,117,0.3); color: var(--accent-mid); }
.skill-tag.gap   { background: rgba(163,45,45,0.1); border-color: rgba(163,45,45,0.25); color: #F09595; }

.score-ring { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.score-num  { font-family: var(--font-display); font-size: 20px; font-weight: 300; }
.score-label { font-size: 9px; color: var(--text-hint); letter-spacing: 0.5px; }
.score-high { color: var(--accent-mid); }
.score-mid  { color: #EF9F27; }
.score-low  { color: #F09595; }

/* ── Explain panel ───────────────────────────────────────── */
.explain-panel {
  background: rgba(29,158,117,0.06); border: 0.5px solid rgba(29,158,117,0.18);
  border-radius: 10px; padding: 16px; margin-top: 8px; display: none;
  font-size: 12px; color: rgba(255,255,255,0.65); line-height: 1.7;
}
.explain-panel.open { display: block; animation: fadeIn 0.2s ease; }
.explain-title { font-size: 10px; color: var(--accent-mid); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 10px; }

.breakdown-row   { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.breakdown-label { width: 110px; font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.bar-track       { flex: 1; height: 4px; background: rgba(255,255,255,0.07); border-radius: 2px; }
.bar-fill        { height: 100%; border-radius: 2px; transition: width 0.7s ease; }
.bar-teal  { background: var(--accent-mid); }
.bar-amber { background: #EF9F27; }
.bar-red   { background: #F09595; }
.breakdown-pct { font-size: 11px; color: var(--text-muted); width: 32px; text-align: right; }

.flag-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.flag { display: flex; align-items: center; gap: 5px; font-size: 11px; padding: 4px 10px; border-radius: 6px; }
.flag-ok   { background: rgba(29,158,117,0.1); color: var(--accent-mid); border: 0.5px solid rgba(29,158,117,0.22); }
.flag-warn { background: rgba(186,117,23,0.12); color: #EF9F27; border: 0.5px solid rgba(186,117,23,0.25); }
.flag-err  { background: rgba(163,45,45,0.1); color: #F09595; border: 0.5px solid rgba(163,45,45,0.22); }

/* ── Upload ──────────────────────────────────────────────── */
.upload-area {
  border: 1px dashed rgba(255,255,255,0.15); border-radius: 12px;
  padding: 32px; text-align: center; cursor: pointer; transition: all 0.2s; margin-bottom: 12px;
}
.upload-area:hover, .upload-area.dragover { border-color: rgba(29,158,117,0.5); background: rgba(29,158,117,0.04); }
.upload-icon { font-size: 28px; margin-bottom: 8px; }
.upload-text { font-size: 13px; color: var(--text-muted); }
.upload-text strong { color: var(--accent-mid); }
.upload-hint { font-size: 11px; color: var(--text-hint); margin-top: 4px; }
.file-info { font-size: 12px; color: var(--text-muted); padding: 8px 12px; background: rgba(255,255,255,0.04); border-radius: 6px; }

.raw-text { font-size: 11px; color: var(--text-hint); line-height: 1.8; font-family: monospace; max-height: 200px; overflow-y: auto; white-space: pre-wrap; }

/* ── Parsed profile ──────────────────────────────────────── */
.parsed-field { display: flex; justify-content: space-between; align-items: flex-start; padding: 8px 0; border-bottom: 0.5px solid var(--border); font-size: 12px; gap: 8px; }
.parsed-field:last-child { border-bottom: none; }
.parsed-key { color: var(--text-muted); flex-shrink: 0; min-width: 120px; }
.parsed-val { color: rgba(255,255,255,0.82); font-weight: 500; text-align: right; }

.match-reason { margin-top: 10px; font-size: 12px; color: rgba(255,255,255,0.55); line-height: 1.6; padding: 10px; background: rgba(255,255,255,0.03); border-radius: 6px; }

/* ── Empty / loading states ──────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-hint); font-size: 13px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.1); border-top-color: var(--accent-mid); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--navy-2); border: 0.5px solid var(--border);
  color: var(--text-main); font-size: 13px;
  padding: 10px 18px; border-radius: 10px;
  opacity: 0; transform: translateY(8px);
  transition: all 0.25s; pointer-events: none; z-index: 999;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { border-color: rgba(29,158,117,0.4); color: var(--accent-mid); }
.toast.error   { border-color: rgba(163,45,45,0.4); color: #F09595; }

/* ── Animations ──────────────────────────────────────────── */
@keyframes fadeIn { from{opacity:0;transform:translateY(-4px)} to{opacity:1;transform:translateY(0)} }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .two-col  { grid-template-columns: 1fr; }
  .grid-3   { grid-template-columns: 1fr 1fr; }
  .sidebar  { width: 64px; }
  .logo-mark, .logo-sub, .nav-section, .nav-item span:not(.nav-icon), .sidebar-footer { display: none; }
}
@media (max-width: 600px) {
  .grid-3 { grid-template-columns: 1fr; }
  .input-row { grid-template-columns: 1fr; }
}
