/* ═══════════════════════════════════════════════════════════════
   JobFlow Design System — Premium Dark UI
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* Colors */
  --bg-base: #08080d;
  --bg-surface: #0f0f17;
  --bg-elevated: #16162a;
  --bg-card: rgba(22, 22, 42, 0.6);
  --bg-hover: rgba(139, 92, 246, 0.08);
  --border: rgba(139, 92, 246, 0.12);
  --border-hover: rgba(139, 92, 246, 0.3);

  --text-primary: #e8e6f0;
  --text-secondary: #8b8a9e;
  --text-muted: #555468;
  --text-accent: #a78bfa;

  --accent: #8b5cf6;
  --accent-light: #a78bfa;
  --accent-dark: #6d28d9;
  --accent-glow: rgba(139, 92, 246, 0.25);

  --cyan: #22d3ee;
  --cyan-dim: rgba(34, 211, 238, 0.15);
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.15);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.15);
  --yellow: #fbbf24;
  --yellow-dim: rgba(251, 191, 36, 0.15);
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.15);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-lg: 1rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;

  /* Spacing */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Sidebar */
  --sidebar-width: 240px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

.hidden { display: none !important; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Auth Screen ───────────────────────────────────────────── */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 30%, rgba(139,92,246,0.08), transparent 60%),
              var(--bg-base);
}

.auth-card {
  text-align: center;
  padding: var(--sp-12);
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 380px;
  animation: fadeInUp 0.6s var(--ease);
}

.auth-logo .logo-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: var(--sp-3);
  filter: drop-shadow(0 0 20px var(--accent-glow));
}

.auth-logo h1 {
  font-size: var(--text-3xl);
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-light), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.auth-logo p {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-top: var(--sp-1);
}

.pin-input-group {
  margin-top: var(--sp-8);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.pin-input {
  width: 100%;
  padding: var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--text-lg);
  text-align: center;
  letter-spacing: 8px;
  outline: none;
  transition: border-color 0.2s var(--ease);
}

.pin-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.pin-error {
  color: var(--red);
  font-size: var(--text-sm);
  margin-top: var(--sp-2);
  min-height: 20px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s var(--ease);
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-color: var(--accent);
  color: white;
  font-weight: 600;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-lg { padding: var(--sp-3) var(--sp-6); font-size: var(--text-base); }
.btn-sm { padding: var(--sp-1) var(--sp-3); font-size: var(--text-xs); }

.btn-green { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.btn-red { background: var(--red-dim); border-color: var(--red); color: var(--red); }
.btn-cyan { background: var(--cyan-dim); border-color: var(--cyan); color: var(--cyan); }

/* ── App Layout ────────────────────────────────────────────── */
.app {
  display: flex;
  min-height: 100vh;
}

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

.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-6) var(--sp-5);
  border-bottom: 1px solid var(--border);
}

.logo-icon-sm {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 10px var(--accent-glow));
}

.sidebar-title {
  font-size: var(--text-xl);
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-light), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  list-style: none;
  padding: var(--sp-4) var(--sp-3);
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all 0.2s var(--ease);
  margin-bottom: var(--sp-1);
}

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(139,92,246,0.15), rgba(34,211,238,0.05));
  color: var(--accent-light);
  border: 1px solid var(--border-hover);
}

.sidebar-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
}

.enrichment-badge {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

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

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  transition: all 0.3s var(--ease);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

/* ── Stats Grid ────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
  margin-bottom: var(--sp-8);
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
  opacity: 0;
  transition: opacity 0.3s var(--ease);
}

.stat-card:hover::before { opacity: 1; }

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-top: var(--sp-1);
  background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-sub {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

/* ── Section Header ────────────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
}

.section-title {
  font-size: var(--text-xl);
  font-weight: 700;
}

/* ── Job Feed ──────────────────────────────────────────────── */
.feed-controls {
  display: flex;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  min-width: 250px;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color 0.2s var(--ease);
}

.search-box:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-select {
  padding: var(--sp-2) var(--sp-4);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--text-sm);
  cursor: pointer;
  outline: none;
}

.filter-select:focus { border-color: var(--accent); }

.job-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.job-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-5);
  cursor: pointer;
  transition: all 0.25s var(--ease);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-4);
}

.job-card:hover {
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: -4px 0 0 var(--accent), 0 4px 20px rgba(0,0,0,0.2);
}

.job-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
}

.job-company {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--sp-2);
}

.job-tags {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-2);
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 500;
}

.tag-seniority { background: var(--blue-dim); color: var(--blue); }
.tag-remote { background: var(--green-dim); color: var(--green); }
.tag-onsite { background: var(--yellow-dim); color: var(--yellow); }
.tag-salary { background: var(--cyan-dim); color: var(--cyan); }
.tag-tech { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }
.tag-ghost { background: var(--red-dim); color: var(--red); }

.job-actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  align-items: flex-end;
  justify-content: center;
}

.job-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── Pipeline / Kanban ─────────────────────────────────────── */
.pipeline-board {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  padding-bottom: var(--sp-4);
}

.pipeline-column {
  min-width: 280px;
  flex-shrink: 0;
}

.pipeline-column-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: var(--text-sm);
  font-weight: 600;
}

.pipeline-column-header .count {
  background: var(--bg-surface);
  padding: 1px var(--sp-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.pipeline-cards {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: var(--sp-3);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.pipeline-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.pipeline-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.pipeline-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: 2px;
}

.pipeline-card-company {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* ── Boards Table ──────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.data-table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  border-bottom: 1px solid rgba(139,92,246,0.06);
}

.data-table tr:hover td {
  background: var(--bg-hover);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: var(--sp-2);
}

.status-dot.green { background: var(--green); }
.status-dot.yellow { background: var(--yellow); }
.status-dot.red { background: var(--red); }

/* ── Modal ─────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-8);
  animation: fadeInUp 0.3s var(--ease);
}

.modal-close {
  position: absolute;
  top: var(--sp-4);
  right: var(--sp-4);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--sp-2);
  line-height: 1;
  transition: color 0.2s var(--ease);
}

.modal-close:hover { color: var(--text-primary); }

.detail-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--sp-2);
}

.detail-company {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: var(--sp-5);
}

.detail-meta {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-5);
  border-bottom: 1px solid var(--border);
}

.detail-description {
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--text-secondary);
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.detail-actions {
  display: flex;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
  padding-top: var(--sp-5);
  border-top: 1px solid var(--border);
}

/* ── Settings ──────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: var(--sp-5);
}

.form-group {
  margin-bottom: var(--sp-4);
}

.form-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: var(--sp-2);
}

.form-input,
.form-textarea {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: var(--text-sm);
  outline: none;
  transition: border-color 0.2s var(--ease);
}

.form-textarea { resize: vertical; min-height: 100px; }
.form-input:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  margin-top: var(--sp-6);
}

.page-info {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ── Loading ───────────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12);
  color: var(--text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: var(--sp-3);
}

/* ── Toast Notifications ───────────────────────────────────── */
.toast-container {
  position: fixed;
  top: var(--sp-5);
  right: var(--sp-5);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.toast {
  padding: var(--sp-3) var(--sp-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  animation: slideIn 0.3s var(--ease);
  max-width: 360px;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--cyan); }

/* ── Empty State ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-12);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--sp-4);
  opacity: 0.3;
}

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

@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
    --sidebar-width: 60px;
  }
  .sidebar .nav-link span,
  .sidebar-title,
  .sidebar-footer,
  .sidebar-header { display: none; }
  .sidebar-header { padding: var(--sp-4); justify-content: center; display: flex; }
  .nav-link { justify-content: center; padding: var(--sp-3); }
  .main-content { margin-left: 60px; padding: var(--sp-4); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .pipeline-board { flex-direction: column; }
  .pipeline-column { min-width: 100%; }
}
