/* ───────────────────────────────────────────────────────────── *
 *  Design system — modern, clean, recruiter-friendly             *
 * ───────────────────────────────────────────────────────────── */

:root {
  /* Neutrals */
  --bg:          #f5f7fb;
  --surface:     #ffffff;
  --surface-2:  #fafbfd;
  --border:     #e5e9f2;
  --border-strong: #cbd5e1;

  /* Text */
  --text:        #0f172a;
  --text-muted: #475569;
  --text-soft:   #94a3b8;

  /* Brand */
  --brand:       #4f46e5;       /* indigo-600 */
  --brand-700:   #4338ca;
  --brand-50:    #eef2ff;
  --accent:      #10b981;       /* emerald-500 */
  --accent-700:  #059669;
  --danger:      #dc2626;
  --warning:     #d97706;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow:    0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.06);

  --radius:    8px;
  --radius-lg: 12px;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Monaco, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ───────── Header ───────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}
header h1::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 24px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--accent) 100%);
  border-radius: 4px;
}

/* ───────── Stats pills ───────── */
.stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}
.stats span {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 500;
  transition: background 0.15s;
}
.stats span:hover {
  background: var(--brand-50);
  border-color: var(--brand);
}
.stats b {
  color: var(--text);
  font-weight: 600;
  margin-left: 4px;
}

/* ───────── Filters ───────── */
.filters {
  background: var(--surface);
  padding: 20px 32px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.filters input,
.filters select {
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 140px;
}
.filters input:focus,
.filters select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-50);
}
.filters input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-width: auto;
  cursor: pointer;
  accent-color: var(--brand);
}
.filters label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background 0.15s;
}
.filters label:hover {
  background: var(--surface-2);
}
.filters button {
  padding: 8px 16px;
  border: 0;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  transition: background 0.15s, transform 0.05s;
  font-family: inherit;
}
.filters button:hover { background: var(--brand-700); }
.filters button:active { transform: translateY(1px); }
.filters button.btn-export {
  background: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.filters button.btn-export:hover { background: var(--accent-700); }
.filters .export-opt {
  font-size: 12px;
  color: var(--text-muted);
}

/* ───────── Meta / pagination strip ───────── */
#meta {
  padding: 20px 32px 12px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
#meta b { color: var(--text); }

/* ───────── Job cards ───────── */
#jobs {
  padding: 0 32px 32px;
}
.job-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
}
.job-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-md);
}
.job-card:active { transform: translateY(1px); }
.job-card .top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.job-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px 0;
  letter-spacing: -0.01em;
}
.job-company {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 6px 0;
}
.job-meta {
  font-size: 12px;
  color: var(--text-soft);
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.summary {
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0 4px;
  font-style: italic;
  border-left: 3px solid var(--border);
  padding-left: 10px;
  line-height: 1.6;
}

/* ───────── Tags ───────── */
.tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.tag {
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  white-space: nowrap;
  line-height: 1.6;
}
/* Source tags - distinct color per source */
.tag.source-indeed         { background: #fff7e6; color: #92400e; border-color: #fcd34d; }
.tag.source-linkedin       { background: #e0f2fe; color: #075985; border-color: #7dd3fc; }
.tag.source-dice           { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.tag.source-greenhouse     { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.tag.source-lever          { background: #e9d5ff; color: #6b21a8; border-color: #c4b5fd; }
.tag.source-ashby          { background: #ccfbf1; color: #115e59; border-color: #5eead4; }
.tag.source-techfetch      { background: #fed7aa; color: #9a3412; border-color: #fdba74; }
.tag.source-recruiter-feed { background: #ffe4e6; color: #9f1239; border-color: #fda4af; }
.tag.source-glassdoor      { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.tag.source-google         { background: #dbeafe; color: #1e40af; border-color: #93c5fd; }

/* Status tags */
.tag.status-submitted  { background: #dcfce7; color: #14532d; border-color: #86efac; font-weight: 600; }
.tag.status-rejected   { background: #fee2e2; color: #7f1d1d; border-color: #fca5a5; font-weight: 600; }
.tag.status-reviewing  { background: #fef3c7; color: #78350f; border-color: #fcd34d; font-weight: 600; }

/* Semantic tags */
.tag.rate {
  background: #fef9c3;
  color: #713f12;
  border-color: #fde047;
  font-weight: 600;
}
.tag.visa {
  background: #f0f9ff;
  color: #075985;
  border-color: #bae6fd;
}
.tag.engagement {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #c4b5fd;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* Clickable contact tags */
a.tag.email,
a.tag.phone {
  text-decoration: none;
  transition: transform 0.05s, box-shadow 0.15s;
  cursor: pointer;
}
a.tag.email {
  background: #eff6ff;
  color: #1e40af;
  border-color: #93c5fd;
  font-weight: 600;
}
a.tag.email:hover {
  background: #dbeafe;
  box-shadow: var(--shadow-sm);
}
a.tag.phone {
  background: #ecfdf5;
  color: #065f46;
  border-color: #6ee7b7;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 12px;
}
a.tag.phone:hover {
  background: #d1fae5;
  box-shadow: var(--shadow-sm);
}

/* ───────── Pager ───────── */
#pager {
  padding: 24px 32px 48px;
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
}
#pager button {
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
#pager button:hover:not(:disabled) {
  background: var(--brand-50);
  border-color: var(--brand);
  color: var(--brand);
}
#pager button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
#pager span {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ───────── Empty state ───────── */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
  font-size: 14px;
}
.empty::before {
  content: "🗂";
  display: block;
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* ───────── Modal ───────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
  animation: fade-in 0.15s ease-out;
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--surface);
  max-width: 880px;
  width: 92%;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  position: relative;
  box-shadow: var(--shadow-lg);
  animation: slide-up 0.2s ease-out;
}
@keyframes slide-up {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.close {
  position: absolute;
  top: 16px;
  right: 20px;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-soft);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}
.close:hover {
  background: var(--surface-2);
  color: var(--text);
}
.modal-content h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding-right: 40px;
}
.modal-content h3 {
  font-size: 14px;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  color: var(--text-soft);
}
.modal-content > p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 12px;
}
.modal-content em {
  font-style: italic;
  color: var(--text-muted);
  font-size: 13px;
}
.modal-content .desc {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 18px 22px;
  border-radius: var(--radius);
  font-size: 13.5px;
  line-height: 1.65;
  max-height: 480px;
  overflow-y: auto;
  color: var(--text);
}
.modal-content .desc p,
.modal-content .desc ul,
.modal-content .desc ol,
.modal-content .desc div {
  margin: 0 0 12px 0;
}
.modal-content .desc h1,
.modal-content .desc h2,
.modal-content .desc h3,
.modal-content .desc h4,
.modal-content .desc h5,
.modal-content .desc h6,
.modal-content .desc strong,
.modal-content .desc b {
  font-weight: 600;
  color: var(--text);
}
.modal-content .desc h1 { font-size: 18px; margin: 18px 0 8px; }
.modal-content .desc h2 { font-size: 16px; margin: 16px 0 8px; }
.modal-content .desc h3,
.modal-content .desc h4 { font-size: 14px; margin: 14px 0 6px; text-transform: none; letter-spacing: 0; color: var(--text); }
.modal-content .desc h5,
.modal-content .desc h6 { font-size: 13px; margin: 12px 0 6px; }
.modal-content .desc ul,
.modal-content .desc ol { padding-left: 22px; }
.modal-content .desc li { margin-bottom: 4px; }
.modal-content .desc a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.modal-content .desc a:hover { color: var(--brand-700); }
.modal-content .desc em { color: var(--text-muted); }
.modal-content .desc hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}
.modal-content .desc img { max-width: 100%; height: auto; }
.modal-content .desc code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.modal-content .desc pre {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-x: auto;
}

/* ───────── Actions bar in modal ───────── */
.actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.actions button {
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
}
.actions button:hover { box-shadow: var(--shadow-sm); }
.actions button:active { transform: translateY(1px); }
.btn-review { background: #fef3c7; color: #78350f; border-color: #fcd34d; }
.btn-review:hover { background: #fde68a; }
.btn-submit { background: #dcfce7; color: #14532d; border-color: #86efac; }
.btn-submit:hover { background: #bbf7d0; }
.btn-reject { background: #fee2e2; color: #7f1d1d; border-color: #fca5a5; }
.btn-reject:hover { background: #fecaca; }
.btn-apply  {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-apply:hover { background: var(--brand-700); }

/* ───────── Loading state ───────── */
.loading {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ───────── Responsive ───────── */
@media (max-width: 768px) {
  header { padding: 14px 20px; }
  .filters { padding: 16px 20px; }
  #meta, #jobs, #pager { padding-left: 20px; padding-right: 20px; }
  .modal-content { padding: 20px; }
  .job-card { padding: 14px 16px; }
  .filters input, .filters select { min-width: 0; flex: 1; }
}
