/* Croot v2 — Candidate Finder. Styled to match the Canva "Candidate Finder"
 * prototype: DM Sans, indigo primary, light gray-lavender background, white
 * cards with soft borders and rounded corners. */

:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --border: #e8e8f1;
  --border-strong: #d9d9e6;
  --ink: #20232b;
  --muted: #6b7280;
  --primary: #5b5bf2;
  --primary-hover: #4a4ae0;
  --primary-ink: #ffffff;
  --chip-bg: #eef0fd;
  --chip-ink: #4a4ae0;
  --pill: #eceef3;
  --field-bg: #fafafe;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 50, 0.04), 0 8px 24px rgba(20, 20, 50, 0.05);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[data-app-shell][hidden] { display: none !important; }

/* ---------- access gate ---------- */
.access-gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px 20px; background: radial-gradient(circle at 50% 0%, #ffffff 0, var(--bg) 48%);
}
.access-gate[hidden] { display: none; }
.access-card {
  width: min(440px, 100%); background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 18px 55px rgba(20, 20, 50, 0.12);
  padding: 28px;
}
.access-brand { margin-bottom: 24px; }
.access-form h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -0.02em; }
.access-form p { margin: 0 0 18px; }
.access-form .btn-primary { width: 100%; justify-content: center; margin-top: 18px; }
.access-status { min-height: 20px; margin: 12px 0 0; color: #b4453a; font-size: 13px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: #fbfbfe; border-bottom: 1px solid var(--border);
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 24px; height: 24px; color: var(--primary); }
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }

/* ---------- buttons ---------- */
.btn-primary, .btn-ghost, .btn-file {
  font: inherit; font-weight: 500; cursor: pointer; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; gap: 8px; border: 1px solid transparent;
}
.btn-primary {
  background: var(--primary); color: var(--primary-ink); border: none;
  padding: 11px 18px; font-weight: 700;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary.sm { padding: 8px 14px; font-weight: 500; }
.btn-ghost {
  background: #eef0f4; color: var(--ink); padding: 8px 14px; border: 1px solid var(--border);
}
.btn-ghost:hover { background: #e6e8ee; }
.btn-ghost.sm { padding: 6px 12px; font-size: 13px; }
.ico { width: 16px; height: 16px; }

/* ---------- page + card ---------- */
.page { max-width: 960px; margin: 0 auto; padding: 28px 24px 80px; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px;
}
.field-label { display: block; color: #3b3f4a; font-size: 13px; margin: 14px 0 6px; }
.field-label:first-child { margin-top: 0; }

.input {
  width: 100%; background: var(--field-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; font: inherit; color: var(--ink);
}
.input::placeholder { color: #9aa0ab; }
.input:focus { outline: none; border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 3px rgba(91, 91, 242, 0.12); }
.area { resize: vertical; min-height: 52px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.file-row { display: flex; align-items: center; gap: 10px;
  background: var(--field-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 8px; }
.btn-file { background: var(--chip-bg); color: var(--chip-ink); padding: 6px 12px; font-size: 13px; }
.file-name { font-size: 13px; }

#search-candidates { margin-top: 20px; }

.criteria-summary { margin-top: 10px; }
.criteria-summary-box {
  min-height: 78px; resize: vertical; color: #3b3f4a; background: #fff;
}

/* ---------- status ---------- */
.status { text-align: center; margin: 26px 0; }
.muted { color: var(--muted); }
/* Loading state: centered spinner + message while a search/extraction runs. */
.status.loading { display: flex; align-items: center; justify-content: center; gap: 9px;
  color: var(--ink); font-weight: 500; }
.spinner { width: 15px; height: 15px; flex-shrink: 0; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--primary);
  animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- results ---------- */
.results { margin-top: 24px; }
.results-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.results-head h2 { margin: 0; font-size: 18px; }
.results-actions { display: flex; align-items: center; gap: 12px; }
.relaxed-note { font-size: 12px; color: #8a6d3b; background: #fdf6e3; border: 1px solid #f0e2bd;
  padding: 4px 10px; border-radius: 999px; }

.cards { display: flex; flex-direction: column; gap: 12px; }
.cand {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow); display: grid;
  grid-template-columns: 1fr auto; gap: 6px 16px;
}
.cand-main { min-width: 0; }
.cand-name { font-weight: 700; font-size: 15px; }
.cand-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.cand-rationale { font-size: 13px; margin-top: 8px; color: #3b3f4a; }
.cand-skills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { background: var(--chip-bg); color: var(--chip-ink); border-radius: 999px;
  padding: 3px 10px; font-size: 12px; }
.chip.flag { background: #fdeaea; color: #b4453a; }
.cand-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.score { font-weight: 700; font-size: 20px; }
.score.strong { color: #1e8a5a; } .score.good { color: #4a4ae0; } .score.partial { color: #b4843a; }
.score-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cand-links { display: flex; gap: 8px; margin-top: 4px; }
.link { color: var(--primary); text-decoration: none; font-size: 13px; font-weight: 500; }
.link:hover { text-decoration: underline; }
.contact-out { font-size: 12px; color: var(--muted); text-align: right; }

/* ---------- advanced modal ---------- */
/* Right-docked drawer: dims the page and slides a full-height panel in on the
   right third, rather than a centered overlay. */
.modal-backdrop { position: fixed; inset: 0; background: rgba(24, 24, 48, 0.42);
  display: flex; align-items: stretch; justify-content: flex-end; z-index: 50; }
/* `display: flex` above overrides the UA [hidden] rule, so re-assert it: the
   drawer must stay hidden until "Advanced Search" is clicked. */
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--card); width: clamp(360px, 34vw, 600px); height: 100%;
  display: flex; flex-direction: column; border-left: 1px solid var(--border);
  box-shadow: -16px 0 50px rgba(20, 20, 50, 0.22); animation: drawer-in .22s ease; }
@keyframes drawer-in { from { transform: translateX(28px); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  padding: 18px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 17px; }
.icon-btn { background: none; border: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-body { padding: 20px 22px; display: grid; grid-template-columns: 1fr; gap: 16px 20px;
  flex: 1; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  padding: 16px 22px; border-top: 1px solid var(--border); }
.estimate { font-size: 13px; color: var(--muted); }
.estimate strong { color: var(--ink); }

.adv-field { display: flex; flex-direction: column; gap: 5px; }
.adv-field.full { grid-column: 1 / -1; }
.adv-field label { font-size: 12px; color: #3b3f4a; }
.adv-field .input { padding: 9px 11px; }
.adv-field.soon label::after { content: " · not yet applied"; color: #b0b4be; font-style: italic; }
.adv-range { display: flex; align-items: center; gap: 8px; }
.adv-range .input { width: 100%; }
.adv-section { grid-column: 1 / -1; font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-top: 6px; }

@media (max-width: 720px) {
  .two-col { grid-template-columns: 1fr; }
  .modal { width: 100%; }            /* drawer goes full-width on small screens */
  .cand { grid-template-columns: 1fr; }
  .cand-side { align-items: flex-start; }
}
