/* ─── shadcn-style design tokens (light theme) ─────────────────────────── */
:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;
  --popover: 0 0% 100%;
  --popover-foreground: 240 10% 3.9%;
  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;
  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;
  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;
  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;
  --radius: 0.5rem;

  /* Brand identity (kept for headline gradient + figma logo only) */
  --figma-red:    #F24E1E;
  --figma-orange: #FF7262;
  --figma-purple: #A259FF;
  --figma-blue:   #1ABCFE;
  --figma-green:  #0ACF83;
}

* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html, body {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

/* ─── Brand identity (preserved) ──────────────────────────────────────── */
.brand-gradient {
  background: linear-gradient(135deg,#A259FF 0%,#F24E1E 50%,#FF7262 100%);
}
.brand-gradient-text {
  background: linear-gradient(135deg,#A259FF 0%,#F24E1E 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.fig-logo {
  display: inline-grid;
  grid-template-columns: 14px 14px;
  grid-template-rows: 14px 14px;
  gap: 2px;
}
.fig-logo span { border-radius: 4px; }
.fig-logo span:nth-child(1) { background: var(--figma-red); }
.fig-logo span:nth-child(2) { background: var(--figma-purple); }
.fig-logo span:nth-child(3) { background: var(--figma-orange); }
.fig-logo span:nth-child(4) { background: var(--figma-blue); border-radius: 50%; }

/* ─── Card (shadcn Card) ──────────────────────────────────────────────── */
.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  transition: border-color 150ms, box-shadow 150ms;
  animation: card-fade-in 320ms ease-out backwards;
}
.card:hover {
  border-color: hsl(var(--foreground) / 0.2);
  box-shadow: 0 4px 12px -2px rgb(0 0 0 / 0.06), 0 1px 2px 0 rgb(0 0 0 / 0.04);
}
@keyframes card-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Subtle cascade so a refreshed grid doesn't pop all at once */
#job-grid .card:nth-child(1)  { animation-delay: 0ms;  }
#job-grid .card:nth-child(2)  { animation-delay: 30ms; }
#job-grid .card:nth-child(3)  { animation-delay: 60ms; }
#job-grid .card:nth-child(4)  { animation-delay: 90ms; }
#job-grid .card:nth-child(5)  { animation-delay: 120ms; }
#job-grid .card:nth-child(6)  { animation-delay: 150ms; }
#job-grid .card:nth-child(n+7){ animation-delay: 180ms; }

/* ─── Button (shadcn Button) ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  white-space: nowrap;
  font-weight: 500; font-size: 14px; line-height: 1;
  height: 40px;
  padding: 0 16px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid hsl(var(--input));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  cursor: pointer;
  box-sizing: border-box;
  transition: background-color 150ms, color 150ms, border-color 150ms, box-shadow 150ms;
}
.btn:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}
.btn:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}
.btn:disabled,
.btn[disabled] {
  opacity: 0.5; pointer-events: none;
}

.btn-primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}
.btn-primary:hover {
  background: hsl(var(--primary) / 0.9);
  color: hsl(var(--primary-foreground));
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.btn-destructive {
  background: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  border-color: hsl(var(--destructive));
}
.btn-destructive:hover { background: hsl(var(--destructive) / 0.9); }

.btn-brand {
  color:#fff; border-color: transparent;
  background: linear-gradient(135deg,#A259FF 0%,#F24E1E 100%);
  background-size: 150% 150%;
  background-position: 0% 50%;
  transition: background-position 300ms ease, transform 120ms ease, box-shadow 150ms;
}
.btn-brand:hover { background-position: 100% 50%; color:#fff; }

/* ─── Input + Select (shadcn Input / Select) ──────────────────────────── */
.input, .select {
  height: 40px;
  padding: 0 12px;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  background: hsl(var(--background));
  font-size: 14px; line-height: 38px;
  color: hsl(var(--foreground));
  outline: none;
  box-sizing: border-box;
  transition: border-color 150ms, box-shadow 150ms;
  vertical-align: middle;
}
.input { line-height: 1; }
.input::placeholder { color: hsl(var(--muted-foreground)); }
.input:focus-visible, .select:focus-visible,
.input:focus, .select:focus {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
  border-color: hsl(var(--ring));
}

.select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path fill='none' stroke='%23737373' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5l3 3 3-3'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 11px;
  padding-right: 36px;
  cursor: pointer;
}

/* ─── Custom popover menus (non-native dropdown) ────────────────────────── */
button.select {
  text-align: left;
  font-family: inherit;
  white-space: nowrap;
}
button.select[aria-expanded="true"] {
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.18);
}
.menu-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  background: hsl(var(--popover));
  color: hsl(var(--popover-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 10px 28px -8px rgb(0 0 0 / 0.16), 0 2px 6px -2px rgb(0 0 0 / 0.04);
  padding: 4px;
  z-index: 50;
  max-height: 320px;
  overflow-y: auto;
  animation: menu-in 120ms ease-out;
}
.menu-panel[hidden] { display: none; }
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.menu-panel.menu-right { left: auto; right: 0; }

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.menu-item:hover { background: hsl(var(--accent)); }
.menu-item input { position: absolute; opacity: 0; pointer-events: none; }

.menu-check {
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  border: 1.5px solid hsl(var(--border));
  background: hsl(var(--background));
  border-radius: 4px;
  transition: background-color 120ms, border-color 120ms;
}
.menu-item input[type="radio"] + .menu-check { border-radius: 999px; }
.menu-item input:checked + .menu-check {
  background: hsl(var(--primary));
  border-color: hsl(var(--primary));
}
.menu-item input[type="checkbox"]:checked + .menu-check::after {
  content: "";
  width: 9px; height: 5px;
  border: 2px solid hsl(var(--primary-foreground));
  border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}
.menu-item input[type="radio"]:checked + .menu-check::after {
  content: "";
  width: 6px; height: 6px; border-radius: 999px;
  background: hsl(var(--primary-foreground));
}
.menu-divider {
  height: 1px;
  background: hsl(var(--border));
  margin: 4px 0;
}
.menu-action {
  display: block; width: 100%;
  text-align: left;
  padding: 7px 10px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}
.menu-action:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }

/* ─── Badge / Chip (shadcn Badge) ─────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 9999px;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  box-sizing: border-box;
  transition: background-color 150ms, color 150ms, border-color 150ms;
}
.chip:hover {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}
.chip-active {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border-color: hsl(var(--primary));
}
.chip-active:hover {
  background: hsl(var(--primary) / 0.9);
  color: hsl(var(--primary-foreground));
}

/* ─── Score badge (kept domain-specific) ──────────────────────────────── */
.score-badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-variant-numeric: tabular-nums;
  border-radius: 9999px; padding: 4px 10px;
  font-size: 13px; line-height: 1; letter-spacing: -0.01em;
}
.score-green   { background:#DCFCE7; color:#166534; }
.score-blue    { background:#DBEAFE; color:#1E40AF; }
.score-amber   { background:#FEF3C7; color:#92400E; }
.score-neutral { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }

/* ─── Status pill ─────────────────────────────────────────────────────── */
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
  border-radius: 9999px; padding: 2px 10px;
  border: 1px solid;
}
.status-new        { background: hsl(var(--background)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }
.status-interested { background:#FFF7ED; color:#C2410C; border-color:#FFEDD5; }
.status-applied    { background:#ECFDF5; color:#047857; border-color:#D1FAE5; }
.status-rejected   { background:#FEF2F2; color:#B91C1C; border-color:#FEE2E2; }
.status-ignored    { background: hsl(var(--secondary)); color: hsl(var(--muted-foreground)); border-color: hsl(var(--border)); }

/* ─── Spinner / loading ───────────────────────────────────────────────── */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}
.htmx-indicator,
.htmx-indicator.spinner { display: none; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { display: inline-flex; }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton-line {
  height: 12px;
  background: linear-gradient(90deg, hsl(var(--muted)) 0%, hsl(var(--border)) 50%, hsl(var(--muted)) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── Prose (job description rendering) ───────────────────────────────── */
.prose-jb {
  font-size: 14.5px; line-height: 1.65; color: hsl(var(--foreground));
  overflow-wrap: anywhere;
  word-break: break-word;
}
.prose-jb pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 100%;
  background: hsl(var(--muted));
  padding: 12px 14px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-family:'Geist Mono', ui-monospace, SFMono-Regular, monospace;
  margin: 0.6em 0;
}
.prose-jb a { word-break: break-all; color: var(--figma-purple); text-decoration: underline; text-underline-offset: 2px; }
.prose-jb h1,.prose-jb h2,.prose-jb h3 { font-weight:700; letter-spacing:-0.015em; margin: 1.2em 0 .4em; }
.prose-jb h1 { font-size: 22px; }
.prose-jb h2 { font-size: 18px; }
.prose-jb h3 { font-size: 16px; }
.prose-jb p  { margin: .6em 0; }
.prose-jb ul,.prose-jb ol { margin: .4em 0 .8em 1.4em; }
.prose-jb li { margin: .2em 0; }
.prose-jb strong { color: hsl(var(--foreground)); font-weight:600; }
.prose-jb code {
  background: hsl(var(--muted)); padding: 1px 6px; border-radius:4px;
  font-size: 13px; font-family:'Geist Mono', ui-monospace, SFMono-Regular, monospace;
}

.dotted-bg {
  background-image: radial-gradient(circle, hsl(var(--border)) 1px, transparent 1px);
  background-size: 24px 24px;
}

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: hsl(var(--primary)); color: hsl(var(--primary-foreground));
  padding: 14px 20px; border-radius: var(--radius);
  box-shadow: 0 12px 32px -8px rgba(0,0,0,.25);
  font-size: 14px; z-index: 100;
  animation: toast-in 220ms ease-out;
}
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
