/* ============================================
   JOB PROCESSOR - DARK MODE DESIGN SYSTEM
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg-body: #0f1117;
  --bg-surface: #1a1d27;
  --bg-surface-hover: #22253a;
  --bg-surface-raised: #242838;
  --bg-sidebar: #141620;
  --bg-input: #1e2133;

  --border-color: #2a2e3f;
  --border-color-light: #353a50;

  --text-primary: #e8eaf0;
  --text-secondary: #8b90a5;
  --text-muted: #5c6078;

  --accent: #6c5ce7;
  --accent-hover: #7e70f0;
  --accent-glow: rgba(108, 92, 231, 0.25);

  --green: #10b981;
  --green-soft: rgba(16, 185, 129, 0.12);
  --yellow: #f59e0b;
  --yellow-soft: rgba(245, 158, 11, 0.12);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.12);

  --source-linkedin: #0077b5;
  --source-indeed: #2164f3;
  --source-techtree: #8b5cf6;
  --source-yc_startup: #f26625;

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

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
  --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.5);

  --transition: 0.2s ease;
  --sidebar-width: 260px;
  --topbar-height: 60px;
}


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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--accent-hover);
}


/* ============================================
   TOP NAVIGATION BAR
   ============================================ */
.top-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: linear-gradient(135deg, #12141f 0%, #1a1d2e 50%, #1e1638 100%);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  display: flex;
  align-items: center;
}

.top-navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0 24px;
}

.top-navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.top-navbar-brand i {
  font-size: 1.35rem;
  color: var(--accent);
}

.top-navbar-brand:hover {
  color: var(--text-primary);
}

.top-navbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}

.top-nav-link:hover,
.top-nav-link.active {
  color: var(--text-primary);
  background: rgba(108, 92, 231, 0.1);
}

.top-nav-link.active {
  color: var(--accent);
}

.btn-filter-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-filter-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}


/* ============================================
   APP LAYOUT
   ============================================ */
.app-layout {
  display: flex;
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
}


/* ============================================
   FILTER SIDEBAR
   ============================================ */
.filter-sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  padding: 24px 20px;
  overflow-y: auto;
  z-index: 900;
  transition: transform 0.3s ease;
}

.filter-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.filter-sidebar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin: 0;
}

.btn-close-drawer {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
}

.filter-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filter-input {
  background: var(--bg-input) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-primary) !important;
  font-size: 0.8125rem !important;
  padding: 8px 10px !important;
  transition: border-color var(--transition);
}

.filter-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-glow) !important;
  outline: none !important;
}

.filter-divider {
  height: 1px;
  background: var(--border-color);
  margin: 4px 0;
}

.filter-switch {
  padding-left: 2.75em;
}

.filter-switch .form-check-label {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-switch .form-check-input {
  background-color: var(--bg-input);
  border-color: var(--border-color-light);
  cursor: pointer;
}

.filter-switch .form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.filter-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}


/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 28px 32px;
  min-width: 0;
}


/* ============================================
   SEARCH BAR
   ============================================ */
.search-bar-wrapper {
  margin-bottom: 24px;
}

.search-input-group {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 4px 4px 4px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

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

.search-icon {
  color: var(--text-muted);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.search-input {
  background: transparent !important;
  border: none !important;
  color: var(--text-primary) !important;
  font-size: 0.9375rem !important;
  padding: 10px 12px !important;
  box-shadow: none !important;
  flex: 1;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-btn {
  flex-shrink: 0;
  border-radius: var(--radius-md) !important;
  padding: 8px 20px;
  font-weight: 600;
  font-size: 0.875rem;
}


/* ============================================
   STATS BAR
   ============================================ */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--border-color-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.stat-icon-total {
  background: rgba(108, 92, 231, 0.12);
  color: var(--accent);
}

.stat-icon-applied {
  background: var(--green-soft);
  color: var(--green);
}

.stat-icon-today {
  background: var(--yellow-soft);
  color: var(--yellow);
}

.stat-icon-score {
  background: rgba(59, 130, 246, 0.12);
  color: #3b82f6;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}


/* ============================================
   BUTTONS
   ============================================ */
.btn-accent {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 600;
  transition: all var(--transition);
}

.btn-accent:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-outline-light {
  border: 1px solid var(--border-color-light);
  color: var(--text-secondary);
  background: transparent;
}

.btn-outline-light:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}


/* ============================================
   JOB CARDS GRID
   ============================================ */
.jobs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.job-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.job-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background var(--transition);
}

.job-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--border-color-light);
}

.job-card:hover::before {
  background: var(--accent);
}

/* Applied state */
.job-card-applied {
  border-left: 3px solid var(--green);
}

.job-card-applied::before {
  background: var(--green);
}

.job-card-top {
  flex: 1;
}

.job-card-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.job-title {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.job-title-link {
  color: var(--text-primary);
  text-decoration: none;
}

.job-title-link:hover {
  color: var(--accent);
}

.job-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Source badges */
.source-badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #fff;
  white-space: nowrap;
}

.source-linkedin {
  background: var(--source-linkedin);
}

.source-indeed {
  background: var(--source-indeed);
}

.source-techtree {
  background: var(--source-techtree);
}

.source-yc_startup {
  background: var(--source-yc_startup);
}

.source-default,
.source-unknown {
  background: var(--text-muted);
}

/* Easy apply badge */
.easy-apply-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--yellow-soft);
  color: var(--yellow);
  white-space: nowrap;
}

/* Applied chip */
.applied-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--green-soft);
  color: var(--green);
  white-space: nowrap;
}

/* Company */
.job-company {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.job-company i {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Meta info */
.job-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.job-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.job-meta-item i {
  font-size: 0.75rem;
}


/* ============================================
   JOB CARD BOTTOM SECTION
   ============================================ */
.job-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

/* Match Score Bar */
.match-score-section {
  flex: 1;
  min-width: 0;
}

.score-bar-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.score-bar-label {
  display: flex;
  align-items: center;
}

.score-text {
  font-size: 0.75rem;
  font-weight: 600;
}

.score-text.score-high {
  color: var(--green);
}

.score-text.score-medium {
  color: var(--yellow);
}

.score-text.score-low {
  color: var(--red);
}

.score-text.score-none {
  color: var(--text-muted);
  font-weight: 400;
}

.score-bar-track {
  width: 100%;
  height: 5px;
  background: var(--bg-input);
  border-radius: 10px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 10px;
  transition: width 0.6s ease;
}

.score-bar-fill.score-high {
  background: linear-gradient(90deg, var(--green), #34d399);
}

.score-bar-fill.score-medium {
  background: linear-gradient(90deg, var(--yellow), #fbbf24);
}

.score-bar-fill.score-low {
  background: linear-gradient(90deg, var(--red), #f87171);
}

/* Actions */
.job-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-apply {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 0.8125rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-apply:hover {
  background: #0ea572;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-delete {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 0.8125rem;
  transition: all var(--transition);
}

.btn-delete:hover {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(239, 68, 68, 0.2);
}


/* ============================================
   PAGINATION
   ============================================ */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  padding: 16px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.pagination-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.pagination-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pagination-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-surface-raised);
  border: 1px solid var(--border-color);
  text-decoration: none;
  transition: all var(--transition);
}

.pagination-pill:hover:not(.disabled):not(.pagination-current) {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(108, 92, 231, 0.08);
}

.pagination-pill.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination-pill.pagination-current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
  cursor: default;
}


/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
  text-align: center;
  padding: 80px 20px;
}

.empty-state-icon {
  font-size: 4rem;
  color: var(--text-muted);
  opacity: 0.3;
  margin-bottom: 20px;
}

.empty-state-icon i {
  display: inline-block;
}

.empty-state-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.empty-state-text {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  max-width: 420px;
  margin: 0 auto 24px;
  line-height: 1.6;
}


/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color-light);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}


/* ============================================
   RESPONSIVE: TABLET (<= 1024px)
   ============================================ */
@media (max-width: 1024px) {
  .jobs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .main-content {
    padding: 24px 20px;
  }
}


/* ============================================
   RESPONSIVE: MOBILE (<= 768px)
   ============================================ */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 0px;
  }

  /* Sidebar becomes a slide-down drawer */
  .filter-sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    right: 0;
    bottom: auto;
    width: 100%;
    max-height: 70vh;
    transform: translateY(-110%);
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: 950;
    padding: 20px;
  }

  .filter-sidebar.open {
    transform: translateY(0);
  }

  .main-content {
    margin-left: 0;
    padding: 20px 16px;
  }

  .jobs-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .stats-bar {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 14px 16px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .search-input-group {
    border-radius: var(--radius-md);
  }

  .pagination-bar {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .pagination-pills {
    width: 100%;
    justify-content: center;
  }

  .job-card-bottom {
    flex-direction: column;
    align-items: stretch;
  }

  .job-actions {
    justify-content: flex-end;
  }

  .top-navbar-inner {
    padding: 0 16px;
  }
}


/* ============================================
   RESPONSIVE: LARGE DESKTOP (>= 1400px)
   ============================================ */
@media (min-width: 1400px) {
  .jobs-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }
}

@media (min-width: 1800px) {
  .jobs-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
  }
}


/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.job-card {
  animation: fadeInUp 0.35s ease forwards;
  opacity: 0;
}

.job-card:nth-child(1)  { animation-delay: 0.02s; }
.job-card:nth-child(2)  { animation-delay: 0.04s; }
.job-card:nth-child(3)  { animation-delay: 0.06s; }
.job-card:nth-child(4)  { animation-delay: 0.08s; }
.job-card:nth-child(5)  { animation-delay: 0.10s; }
.job-card:nth-child(6)  { animation-delay: 0.12s; }
.job-card:nth-child(7)  { animation-delay: 0.14s; }
.job-card:nth-child(8)  { animation-delay: 0.16s; }
.job-card:nth-child(9)  { animation-delay: 0.18s; }
.job-card:nth-child(10) { animation-delay: 0.20s; }
.job-card:nth-child(11) { animation-delay: 0.22s; }
.job-card:nth-child(12) { animation-delay: 0.24s; }
.job-card:nth-child(n+13) { animation-delay: 0.26s; }

.stat-card {
  animation: fadeInUp 0.4s ease forwards;
  opacity: 0;
}

.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.2s; }

/* --- View Toggle Button --- */
.btn-view-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-view-toggle:hover {
  background: var(--bg-surface-hover);
  color: var(--accent);
  border-color: var(--accent);
}

/* --- Classic Table View --- */
#tableView .table {
  font-size: 0.85rem;
  border-radius: 12px;
  overflow: hidden;
}
#tableView .table thead th {
  background: var(--bg-surface);
  border-bottom: 2px solid var(--accent);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px;
}
#tableView .table tbody td {
  padding: 10px 12px;
  border-color: var(--border-color);
  vertical-align: middle;
}
#tableView .table-success td {
  background: rgba(16, 185, 129, 0.08) !important;
}
