/* ============================================================
   TF Tech Forge ATS Dashboard — Exact Figma Match
   ============================================================ */

:root {
  --bg-app: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-page: #fafafa;
  
  --panel: #ffffff;
  --panel-border: #e5e7eb;
  
  --text-main: #111827;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  
  --primary: #000000;
  --primary-hover: #1f2937;
  --primary-text: #ffffff;
  
  --nav-hover: #f3f4f6;
  --nav-active: #f3f4f6;
  
  --good: #16a34a;
  --good-bg: #f0fdf4;
  --bad: #ef4444;
  --bad-bg: #fef2f2;
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body, html {
  margin: 0; padding: 0;
  height: 100vh;
  font-family: var(--font);
  color: var(--text-main);
  background: var(--bg-app);
  overflow: hidden;
}

.app-layout {
  display: flex;
  height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
  width: 260px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.sidebar-header {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--panel-border);
}
.logo {
  background: var(--primary);
  color: #fff;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  border-radius: 4px;
  margin-right: 12px;
}
.brand-name { font-weight: 600; font-size: 15px; }

.sidebar-nav { padding: 24px 16px; overflow-y: auto; }
.nav-section-title { font-size: 12px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 8px 12px; }
.nav-item {
  display: block;
  padding: 10px 12px;
  color: var(--text-main);
  text-decoration: none;
  font-size: 14px;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-item:hover { background: var(--nav-hover); }
.nav-item.active { background: var(--nav-active); font-weight: 600; }
.nav-item[data-tab].active { background: var(--primary); color: #fff; }

/* ---- Main Area ---- */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: 64px;
  border-bottom: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--bg-app);
  flex-shrink: 0;
}
.search-bar { display: flex; align-items: center; gap: 8px; color: var(--text-light); background: #f9fafb; padding: 8px 16px; border-radius: 6px; width: 320px; border: 1px solid var(--panel-border); }
.search-bar input { border: none; background: transparent; outline: none; width: 100%; font-size: 14px; color: var(--text-main); font-family: inherit; }
.topbar-actions { display: flex; align-items: center; gap: 16px; color: var(--text-main); }
.icon-btn { background: none; border: none; cursor: pointer; color: inherit; display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; transition: background 0.15s; }
.icon-btn:hover { background: var(--nav-hover); }
.user-avatar { background: var(--nav-hover); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }

/* ---- Page Content ---- */
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 48px;
  background: var(--bg-app);
}

.page-header { display: flex; align-items: center; margin-bottom: 32px; }
.page-header h2 { margin: 0 0 4px; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.muted { color: var(--text-muted); font-size: 14px; margin: 0; }
.muted-small { color: var(--text-muted); font-size: 13px; margin: 0; }

.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---- Buttons ---- */
.btn-dark { background: var(--primary); color: var(--primary-text); border: none; padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.btn-dark:hover:not(:disabled) { background: var(--primary-hover); }
.btn-dark:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text-main); border: 1px solid var(--panel-border); padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.btn-ghost:hover { background: var(--nav-hover); }
.btn-ghost.small, .btn-dark.small { padding: 6px 14px; font-size: 13px; }

/* ---- Cards ---- */
.card { border: 1px solid var(--panel-border); border-radius: var(--radius-md); padding: 24px; background: var(--panel); }
.card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.info-card { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--radius-md); padding: 20px; color: #1e3a8a; margin-top: 24px; }
.info-card h4 { margin: 0 0 12px; font-size: 14px; }
.info-card ul { margin: 0; padding-left: 20px; font-size: 13px; line-height: 1.6; }

/* ---- Layouts ---- */
.two-col-layout { display: flex; gap: 32px; align-items: flex-start; }
.col-main { flex: 2; min-width: 0; }
.col-side { flex: 1; min-width: 0; }
@media (max-width: 1000px) { .two-col-layout { flex-direction: column; } }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: span 2; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-main); }
.field input, .field select, .field textarea { 
  width: 100%; padding: 12px 16px; 
  background: #f9fafb; border: 1px solid transparent; 
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; color: var(--text-main); outline: none; transition: border 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--panel-border); background: #fff; }
textarea { resize: vertical; }

.bottom-actions { display: flex; gap: 16px; margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--panel-border); }

.preview-title { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.preview-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--panel-border); }
.preview-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }

/* ---- Upload Dropzone ---- */
.dropzone { border: 1px dashed var(--text-light); border-radius: var(--radius-md); background: #fff; padding: 64px 24px; text-align: center; cursor: pointer; transition: all 0.2s; }
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: #f9fafb; }
.dz-title { font-weight: 500; font-size: 15px; margin: 16px 0 8px; }
.dz-subtitle { font-size: 13px; color: var(--text-muted); margin: 0; }
.file-list { list-style: none; padding: 0; margin: 16px 0 0; display: flex; flex-direction: column; gap: 8px; }
.file-list li { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border: 1px solid var(--panel-border); border-radius: var(--radius-sm); font-size: 13px; background: var(--panel); }
.remove { background: none; border: none; color: var(--bad); cursor: pointer; }

/* ---- Candidates List ---- */
.candidates-list { display: flex; flex-direction: column; gap: 16px; }
.cand-card { 
  display: flex; gap: 24px; 
  padding: 24px; 
  border: 1px solid var(--panel-border); 
  border-radius: var(--radius-md); 
  background: var(--panel); 
  position: relative;
}
.cand-avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; flex-shrink: 0; }
.cand-info { flex: 1; }
.cand-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.cand-name { font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.cand-role { font-size: 14px; color: var(--text-muted); margin: 0; }

.match-box { text-align: right; width: 100px; }
.match-pct { font-size: 14px; font-weight: 700; margin-bottom: 6px; display: block; }
.match-bar-bg { height: 6px; background: #f3f4f6; border-radius: 4px; overflow: hidden; }
.match-bar-fill { height: 100%; background: var(--good); border-radius: 4px; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tag { font-size: 11px; padding: 4px 10px; border-radius: 4px; border: 1px solid; font-weight: 500; }
.tag.match { color: var(--good); background: var(--good-bg); border-color: #bbf7d0; }
.tag.miss { color: var(--bad); background: var(--bad-bg); border-color: #fecaca; }
.tag.neutral { color: var(--text-muted); background: #f9fafb; border-color: var(--panel-border); }

.cand-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; display: flex; gap: 16px; }

.cand-actions { display: flex; gap: 16px; }
.action-btn { background: none; border: none; cursor: pointer; color: var(--text-main); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; padding: 0; }
.action-btn:hover { color: var(--primary-hover); text-decoration: underline; }

/* ---- Loading / Errors ---- */
.error-box { padding: 16px; background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: var(--radius-sm); margin-bottom: 24px; font-size: 14px; }
.loading-state { text-align: center; padding: 64px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--panel-border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.modal-card { background: var(--panel); border-radius: var(--radius-md); width: 100%; max-width: 640px; max-height: 85vh; overflow-y: auto; padding: 32px; position: relative; }
.modal-close { position: absolute; top: 16px; right: 16px; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-light); }
.modal-close:hover { color: var(--text-main); }

/* ---- Toast Notifications ---- */
.toast {
  position: fixed; bottom: 32px; right: 32px;
  background: var(--primary); color: #fff;
  padding: 14px 20px; border-radius: var(--radius-sm);
  font-size: 14px; z-index: 9999;
  opacity: 0; transform: translateY(8px);
  transition: all 0.25s ease;
  max-width: 360px; box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-success { background: var(--good); }
.toast.toast-error { background: var(--bad); }
.toast.toast-info { background: #1f2937; }

/* ---- Filter Bar ---- */
.filter-bar { display: flex; border: 1px solid var(--panel-border); border-radius: var(--radius-sm); overflow: hidden; }
.filter-btn { background: none; border: none; border-right: 1px solid var(--panel-border); padding: 8px 16px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text-muted); transition: all 0.15s; }
.filter-btn:last-child { border-right: none; }
.filter-btn:hover { background: var(--nav-hover); color: var(--text-main); }
.filter-btn.active { background: var(--primary); color: #fff; }

/* ---- Status Badges ---- */
.status-badge { font-size: 11px; padding: 2px 8px; border-radius: 4px; font-weight: 600; margin-left: 8px; vertical-align: middle; }
.status-badge.shortlisted { background: var(--good-bg); color: var(--good); border: 1px solid #bbf7d0; }
.status-badge.shortlisted-highlight { background: var(--good-bg); color: var(--good); }
.status-badge.rejected { background: var(--bad-bg); color: var(--bad); border: 1px solid #fecaca; }

/* Candidate card state highlights */
.cand-card.shortlisted { border-color: #bbf7d0; background: #f0fdf4; }
.cand-card.rejected { border-color: #fecaca; background: #fef2f2; opacity: 0.7; }

/* Action button active states */
.action-btn.active { color: var(--good); font-weight: 600; }
.action-btn.active-bad { color: var(--bad); font-weight: 600; }

/* ---- Cand Stats Row ---- */
.cand-stats-row { display: flex; gap: 16px; font-size: 13px; margin-top: 4px; font-weight: 500; }

/* ---- Dashboard Stat Grid ---- */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 768px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card { background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius-md); padding: 20px; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; }

/* ---- Simple Table ---- */
.simple-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.simple-table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--panel-border); text-align: left; }
.simple-table td { padding: 12px 16px; border-bottom: 1px solid var(--panel-border); }
.simple-table tr:last-child td { border-bottom: none; }

/* ---- Sidebar Footer ---- */
.sidebar-footer { margin-top: auto; padding: 24px 16px 16px; border-top: 1px solid var(--panel-border); display: flex; flex-direction: column; gap: 8px; }
.nav-link-sm { font-size: 12px; color: var(--text-light); text-decoration: none; }
.nav-link-sm:hover { color: var(--text-muted); text-decoration: underline; }

/* ---- Tag additions ---- */
.tag.neutral { color: var(--text-muted); background: #f9fafb; border-color: var(--panel-border); }

/* ---- Candidate card small fix ---- */
.cand-actions .action-btn { color: var(--text-muted); }
.cand-actions .action-btn:hover { color: var(--text-main); }

