/* ============================================
   GIGERA BACK-OFFICE DASHBOARD
   Design System: Teal (Synced with Candidate/Business)
   Brand Color: #2ac3a2
   ============================================ */

/* --- CSS Variables (Design Tokens) --- */
:root {
  --bg-parchment: #f0faf6;
  --bg-ivory: #f8fdfb;
  --bg-white: #ffffff;
  --bg-warm-sand: #e0f2ec;
  --bg-dark: #1a2e2a;
  --bg-deep-dark: #0f1f1b;

  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  --text-dark-warm: #1f2937;
  --text-charcoal: #374151;
  --text-light: #9ca3af;
  --text-ivory: #f8fdfb;

  --brand-terracotta: #2ac3a2;
  --brand-coral: #22a78a;
  --color-error: #dc2626;
  --color-focus: #2ac3a2;
  --color-success: #16a34a;
  --color-warning: #d97706;
  --color-orange: #ea580c;

  --border-cream: #d1e8df;
  --border-warm: #bdd9cd;
  --border-dark: #1a2e2a;
  --ring-warm: #bdd9cd;
  --ring-deep: #94bfad;

  --font-serif: 'Inter', system-ui, -apple-system, sans-serif;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'Courier New', monospace;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-ring: 0px 0px 0px 1px var(--ring-warm);
  --shadow-whisper: 0px 4px 24px rgba(0,0,0,0.05);

  --sidebar-width: 260px;
  --topbar-height: 60px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-parchment);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; }

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text-primary);
}
h1 { font-size: 2rem; line-height: 1.1; }
h2 { font-size: 1.6rem; line-height: 1.2; }
h3 { font-size: 1.3rem; line-height: 1.2; }
h4 { font-size: 1.06rem; line-height: 1.3; }

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-parchment);
}

.login-card {
  background: var(--bg-white);
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-whisper);
}

.login-card .logo {
  font-family: var(--font-sans);
  font-size: 2.3rem;
  font-weight: 700;
  color: var(--brand-terracotta);
  margin-bottom: 8px;
}

.login-card .subtitle {
  color: var(--text-secondary);
  font-size: 0.94rem;
  margin-bottom: 32px;
}

.login-card .divider {
  border: none;
  border-top: 1px solid var(--border-warm);
  margin: 24px 0;
}

.login-card label {
  display: block;
  text-align: left;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.login-card input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-warm);
  border-radius: var(--radius-lg);
  font-size: 0.94rem;
  background: var(--bg-white);
  color: var(--text-primary);
  margin-bottom: 16px;
  transition: border-color 0.2s;
}
.login-card input:focus {
  border-color: var(--brand-terracotta);
  box-shadow: 0 0 0 2px rgba(42,195,162,0.15);
}

.login-btns {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-lg);
  font-size: 0.94rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--brand-terracotta);
  color: #ffffff;
  box-shadow: 0px 0px 0px 1px var(--brand-terracotta);
}
.btn-primary:hover { background: var(--brand-coral); }

.btn-secondary {
  background: var(--bg-warm-sand);
  color: var(--text-charcoal);
  box-shadow: var(--shadow-ring);
}
.btn-secondary:hover { background: var(--ring-warm); }

.btn-dark {
  background: var(--bg-dark);
  color: var(--text-ivory);
  box-shadow: 0px 0px 0px 1px var(--border-dark);
}
.btn-dark:hover { background: var(--bg-deep-dark); }

.btn-success {
  background: var(--color-success);
  color: #ffffff;
  box-shadow: 0px 0px 0px 1px var(--color-success);
}
.btn-success:hover { opacity: 0.9; }

.btn-danger {
  background: var(--color-error);
  color: #ffffff;
  box-shadow: 0px 0px 0px 1px var(--color-error);
}
.btn-danger:hover { opacity: 0.9; }

.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard { display: none; min-height: 100vh; }
.dashboard.active { display: flex; }

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-white);
  border-right: 1px solid var(--border-cream);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-cream);
}
.sidebar-header .brand {
  font-family: var(--font-sans);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--brand-terracotta);
}
.sidebar-header .role-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  margin-top: 4px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.role-badge.mod { background: #d1fae5; color: #059669; }
.role-badge.admin { background: #d1fae5; color: #059669; }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.94rem;
  color: var(--text-secondary);
  transition: all 0.15s;
  cursor: pointer;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--bg-parchment); color: var(--text-primary); }
.nav-item.active {
  background: #d1fae5;
  color: #059669;
  font-weight: 600;
  box-shadow: none;
}
.nav-item .icon { font-size: 1.1rem; width: 20px; text-align: center; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border-cream);
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border-cream);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-parchment);
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-lg);
  padding: 7px 14px;
  min-width: 280px;
}
.search-box input {
  border: none;
  background: transparent;
  font-size: 0.88rem;
  color: var(--text-primary);
  width: 100%;
}
.search-box .icon { color: var(--text-tertiary); font-size: 0.88rem; }

.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-right .notif-btn {
  background: var(--bg-parchment);
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-md);
  padding: 8px;
  font-size: 1rem;
  color: var(--text-secondary);
  position: relative;
}
.notif-btn .badge-dot {
  position: absolute; top: 4px; right: 4px;
  width: 8px; height: 8px;
  background: var(--color-error);
  border-radius: 50%;
}

.avatar-circle {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #d1fae5;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 600;
  color: #059669;
}

/* --- Page Container --- */
.page-content { padding: 28px 32px; }
.page-content .page-title {
  font-family: var(--font-sans);
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.page-content .page-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin-bottom: 28px;
}

/* --- Page Sections (Screen switching) --- */
.page-section { display: none; }
.page-section.active { display: block; }

/* ============================================
   KPI CARDS
   ============================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-white);
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}
.kpi-card .kpi-label {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-bottom: 8px;
  font-weight: 500;
}
.kpi-card .kpi-value {
  font-family: var(--font-sans);
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.1;
}
.kpi-card .kpi-change {
  font-size: 0.75rem;
  margin-top: 6px;
  font-weight: 500;
}

.kpi-card.orange { border-left: 3px solid var(--color-orange); }
.kpi-card.orange .kpi-value { color: var(--color-orange); }
.kpi-card.red { border-left: 3px solid var(--color-error); }
.kpi-card.red .kpi-value { color: var(--color-error); }
.kpi-card.green { border-left: 3px solid var(--color-success); }
.kpi-card.green .kpi-value { color: var(--color-success); }
.kpi-card.blue { border-left: 3px solid #2563eb; }
.kpi-card.blue .kpi-value { color: #2563eb; }
.kpi-card.brand { border-left: 3px solid var(--brand-terracotta); }
.kpi-card.brand .kpi-value { color: var(--brand-terracotta); }

/* ============================================
   DATA TABLES
   ============================================ */
.table-card {
  background: var(--bg-white);
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-cream);
}
.table-header h3 { font-size: 1.06rem; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  padding: 10px 20px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-parchment);
  border-bottom: 1px solid var(--border-cream);
}
.data-table td {
  padding: 12px 20px;
  font-size: 0.88rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-cream);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(209,250,229,0.2); }

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}
.badge-pending { background: #fef3c7; color: #d97706; }
.badge-active { background: #d1fae5; color: #059669; }
.badge-flagged { background: #fee2e2; color: #dc2626; }
.badge-closed { background: #f1f5f9; color: #64748b; }

/* --- Pagination --- */
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border-cream);
  font-size: 0.82rem;
  color: var(--text-tertiary);
}
.pagination {
  display: flex;
  gap: 4px;
}
.pagination button, .pagination a {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-cream);
  text-decoration: none;
}
.pagination button.active, .pagination a.active {
  background: var(--brand-terracotta);
  color: #ffffff;
  border-color: var(--brand-terracotta);
}

/* ============================================
   SPLIT SCREEN (Verification)
   ============================================ */
.split-screen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.split-panel {
  background: var(--bg-white);
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.split-panel h3 { margin-bottom: 20px; }

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-cream);
  font-size: 0.88rem;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-tertiary); font-weight: 500; }
.info-value { color: var(--text-primary); text-align: right; }

.doc-viewer {
  background: var(--bg-parchment);
  border: 2px dashed var(--border-warm);
  border-radius: var(--radius-md);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--text-tertiary);
  font-size: 0.88rem;
}
.doc-viewer .doc-icon { font-size: 2.5rem; }

.sticky-actions {
  position: sticky;
  bottom: 0;
  background: var(--bg-white);
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.05);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-white);
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 480px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal h3 { margin-bottom: 20px; }
.modal label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}
.modal select, .modal textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-warm);
  border-radius: var(--radius-lg);
  font-size: 0.88rem;
  background: var(--bg-white);
  color: var(--text-primary);
  margin-bottom: 16px;
}
.modal textarea { min-height: 100px; resize: vertical; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

/* ============================================
   CHARTS (Simple CSS Charts)
   ============================================ */
.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.chart-card {
  background: var(--bg-white);
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.chart-card h3 { margin-bottom: 20px; }

.line-chart {
  height: 200px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 0 8px;
}
.line-chart .bar {
  flex: 1;
  border-radius: 4px 4px 0 0;
  min-width: 8px;
  transition: height 0.3s;
}
.line-chart .bar.primary { background: var(--brand-terracotta); }
.line-chart .bar.secondary { background: var(--bg-warm-sand); }

.donut-chart {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  margin: 0 auto;
  position: relative;
}
.donut-center {
  position: absolute;
  inset: 30px;
  background: var(--bg-white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.donut-center .num {
  font-family: var(--font-sans);
  font-size: 1.3rem;
  font-weight: 700;
}
.donut-center .lbl {
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

.chart-legend {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ============================================
   SETTINGS FORM
   ============================================ */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.settings-card {
  background: var(--bg-white);
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.settings-card h3 { margin-bottom: 20px; }

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-warm);
  border-radius: var(--radius-lg);
  font-size: 0.88rem;
  background: var(--bg-white);
  color: var(--text-primary);
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--brand-terracotta);
  box-shadow: 0 0 0 2px rgba(42,195,162,0.15);
}

.slider-group { margin-bottom: 18px; }
.slider-group label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
}
.slider-group input[type="range"] {
  width: 100%;
  accent-color: var(--brand-terracotta);
  height: 6px;
}

.save-bar {
  background: var(--bg-white);
  border: 1px solid var(--border-cream);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  box-shadow: var(--shadow-whisper);
}

/* ============================================
   UTILITIES
   ============================================ */
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-20 { margin-top: 20px; }
.text-sm { font-size: 0.82rem; }
.text-muted { color: var(--text-tertiary); }
.text-center { text-align: center; }

/* ============================================
   FORM CONTROLS (Universal)
   ============================================ */
input[type="text"], input[type="email"], input[type="password"], 
input[type="number"], input[type="date"], select, textarea, .form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-warm);
  border-radius: var(--radius-lg);
  background-color: var(--bg-white);
  font-family: var(--font-sans);
  font-size: 0.94rem;
  color: var(--text-primary);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

input:focus, select:focus, textarea:focus, .form-control:focus {
  outline: none;
  border-color: var(--brand-terracotta);
  box-shadow: 0 0 0 2px rgba(42,195,162,0.15);
  background-color: #ffffff;
}

input::placeholder, textarea::placeholder {
  color: var(--text-light);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%236b7280%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
  background-repeat: no-repeat;
  background-position: right 14px top 50%;
  background-size: 10px auto;
  padding-right: 36px;
}
