/* ---- CSS reset (Josh Comeau) ---- */
*, *::before, *::after { box-sizing: border-box; }
*:not(dialog) { margin: 0; }
@media (prefers-reduced-motion: no-preference) {
  html { interpolate-size: allow-keywords; }
}
body { line-height: 1.5; -webkit-font-smoothing: antialiased; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
p { text-wrap: pretty; }
h1, h2, h3, h4, h5, h6 { text-wrap: balance; }
#root, #__next { isolation: isolate; }
/* ---- end reset ---- */

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --accent: #06b6d4;
  --page-bg: #f4f6fb;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --muted: #6b7280;
  --green: #16a34a;
  --orange: #f59e0b;
  --red: #dc2626;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.04);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
}

header { margin-bottom: 0; width: 100%; }

main {
  margin-top: 2rem;
  margin-bottom: 3rem;
  width: min(960px, 92%);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ---- Reusable layout utilities ---- */
.stack {
  display: flex;
  flex-direction: column;
}

.stack-md {
  gap: 1rem;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.measure {
  max-width: 42rem;
}

/* ---- Cards ---- */
section {
  background: var(--card-bg);
  padding: 1.75rem 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

/* ---- Typography ---- */
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 0.5rem; color: #0a0a4f; }
h2 {
  font-size: 1.3rem; font-weight: 700; margin-bottom: 0.75rem; color: #0a0a4f;
  display: flex; align-items: center; gap: 0.6rem;
}
h2::before {
  content: ""; display: inline-block; width: 4px; height: 1.1em;
  background: linear-gradient(180deg, var(--primary), var(--accent)); border-radius: 99px;
}
h3 { font-size: 1.05rem; font-weight: 700; margin: 1.25rem 0 0.5rem; color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); font-size: 0.9rem; }

/* ---- Buttons ---- */
button, .btn {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  border: none;
  padding: 0.6rem 1.4rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, opacity 0.15s;
  box-shadow: 0 2px 6px rgba(79,70,229,0.25);
}
button:hover, .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,70,229,0.35);
  text-decoration: none;
}
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---- Forms ---- */
input[type=text], input[type=password], input[type=email],
input[type=file], select, textarea {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}
label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 0.3rem; }
form p { margin-bottom: 1rem; }
fieldset {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
fieldset legend {
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0 0.5rem;
  color: var(--primary);
}
fieldset small { display: block; color: var(--muted); font-size: 0.8rem; margin-top: 0.35rem; }

/* ---- Tables ---- */
table { border-collapse: collapse; width: 100%; margin-top: 0.75rem; font-size: 0.92rem; }
th, td { padding: 0.65rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f9fafb; font-weight: 600; color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: none; }

.dashboard-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dashboard-session-table {
  table-layout: fixed;
  min-width: 720px;
}

.dashboard-session-table th,
.dashboard-session-table td {
  vertical-align: top;
}

.dashboard-session-table th:nth-child(1),
.dashboard-session-table td:nth-child(1) {
  width: 4rem;
}

.dashboard-session-table th:nth-child(3),
.dashboard-session-table td:nth-child(3) {
  width: 7rem;
}

.dashboard-session-table th:nth-child(4),
.dashboard-session-table td:nth-child(4) {
  width: 6rem;
}

.dashboard-session-table th:nth-child(5),
.dashboard-session-table td:nth-child(5) {
  width: 14rem;
}

.dashboard-session-table th:nth-child(6),
.dashboard-session-table td:nth-child(6) {
  width: 6rem;
}

.dashboard-session-table td:nth-child(2),
.dashboard-session-table td:nth-child(5) {
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  .dashboard-session-table {
    min-width: 0;
  }

  .dashboard-session-table th:nth-child(3),
  .dashboard-session-table td:nth-child(3),
  .dashboard-session-table th:nth-child(5),
  .dashboard-session-table td:nth-child(5) {
    display: none;
  }
}

/* ---- Progress bars ---- */
progress {
  appearance: none;
  -webkit-appearance: none;
  height: 8px;
  border-radius: 99px;
  overflow: hidden;
  border: none;
  background: #eef0f5;
  vertical-align: middle;
}
progress::-webkit-progress-bar { background: #eef0f5; border-radius: 99px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--primary); border-radius: 99px; }

/* ---- Expanders (details/summary) ---- */
details {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0.6rem 0;
  background: #fff;
  overflow: hidden;
}
details summary {
  cursor: pointer;
  padding: 0.7rem 1rem;
  font-weight: 600;
  font-size: 0.92rem;
  background: #f9fafb;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s;
}
details summary:hover { background: #f1f3f9; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: "▸"; color: var(--muted); transition: transform 0.15s; }
details[open] summary::before { transform: rotate(90deg); }
details > div, details > table { padding: 0.5rem 1rem 1rem; }

/* ---- Messages / alerts ---- */
.messages { list-style: none; padding: 0; }
.messages li, .alert {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.6rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}
.alert-warning { background: #fffbeb; border-color: #fcd34d; }
.alert-danger { background: #fef2f2; border-color: #fca5a5; }
.alert-info { background: #ecfeff; border-color: #a5f3fc; }
.errorlist, .error { color: var(--red); font-size: 0.85rem; list-style: none; padding: 0; }

code {
  background: #f1f3f9;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* ---- Badges ---- */
.badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 700;
}
.badge-green { background: #dcfce7; color: var(--green); }
.badge-orange { background: #fef3c7; color: #b45309; }
.badge-red { background: #fee2e2; color: var(--red); }
.badge-gray { background: #f1f3f9; color: var(--muted); }

/* ---- Score number ---- */
.score-num { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.5px; color: var(--primary); }

/* ---- Candidate result card ---- */
.candidate-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.75rem;
  overflow: hidden;
  background: #fff;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.candidate-card > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  background: #fff;
}
.candidate-card > summary::before { display: none; }  /* no triangle on top-level card */
/* Open card stands out clearly from collapsed ones */
.candidate-card[open] {
  border-color: var(--primary);
  box-shadow: 0 6px 24px rgba(79,70,229,0.15);
}
.candidate-card[open] > summary {
  background: linear-gradient(135deg, rgba(79,70,229,0.08), rgba(6,182,212,0.08));
  border-bottom: 1px solid var(--border);
}

/* ---- Feedback ---- */
.feedback-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 24px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(79,70,229,0.3);
  transition: background 0.15s, transform 0.1s;
}

.feedback-fab:hover {
  background: #4338ca;
  transform: translateY(-2px);
}

.feedback-modal {
  border: none;
  border-radius: 12px;
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,0.18);
}

.feedback-modal::backdrop {
  background: rgba(0,0,0,0.4);
}

.feedback-modal h3 {
  margin: 0 0 1.25rem;
  font-size: 1.15rem;
  color: #0a0a4f;
}

.feedback-widget-title {
  margin: 0 0 0.75rem;
  font-weight: 600;
  color: #0a0a4f;
}

.feedback-inline-panel {
  margin-top: 2rem;
  padding: 1.25rem 1.5rem;
  background: #f8f9ff;
  border-radius: 10px;
  border: 1px solid #e0e2ff;
}

.star-rating {
  display: flex;
  gap: 4px;
  margin-bottom: 1rem;
}

.star-rating button {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: #d1d5db;
  transition: color 0.1s;
  padding: 0;
  line-height: 1;
  box-shadow: none;
}

.star-rating button:hover {
  transform: none;
  box-shadow: none;
}

.star-rating button.active {
  color: #f59e0b;
}

.feedback-widget textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  color: #1f2937;
}

.feedback-textarea-inline {
  min-height: 64px;
  font-size: 0.88rem;
  padding: 8px;
}

.feedback-widget textarea:focus {
  outline: 2px solid #4f46e5;
  border-color: transparent;
}

.feedback-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 1rem;
}

.feedback-actions-inline {
  margin-top: 0.5rem;
}

.feedback-actions-centered {
  justify-content: center;
}

.feedback-actions .btn-submit {
  background: #4f46e5;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

.feedback-actions .btn-submit:hover {
  background: #4338ca;
}

.feedback-actions .btn-cancel {
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  cursor: pointer;
  font-size: 0.9rem;
}

.feedback-error {
  color: #ef4444;
  font-size: 0.85rem;
  margin: 0 0 0.5rem;
}

.feedback-thanks {
  color: #2aa98c;
  font-weight: 600;
  text-align: center;
  padding: 1.5rem 0 0.5rem;
  font-size: 1.05rem;
}
.candidate-card .rank-name { display: flex; align-items: center; gap: 0.75rem; }
.candidate-card .rank {
  color: white; font-weight: 700; font-size: 0.85rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.detail-block { padding: 1.25rem; }
.detail-block .label { font-weight: 700; font-size: 0.8rem; color: var(--muted); margin-top: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
.chip-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.chip { background: #f1f3f9; padding: 0.3rem 0.75rem; border-radius: 99px; font-size: 0.82rem; font-weight: 500; }
.chip-green { background: #dcfce7; color: #15803d; }
.chip-red { background: #fee2e2; color: #b91c1c; }

/* ---- Signup page ---- */
.signup-section {
  max-width: 420px;
  margin: 0 auto;
  width: 100%;
}

.signup-privacy-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 1rem 0;
}

.signup-privacy-consent input[type="checkbox"] {
  width: auto;
  margin-top: 0.2rem;
}

.signup-privacy-label {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
  font-weight: 400;
  margin-bottom: 0;
}

.signup-footer {
  margin-top: 1rem;
}

/* ---- Error pages ---- */


.error-status-code {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
}


/* ---- Score bar (filled, colored, with number inside) ---- */
.score-bar {
  position: relative;
  height: 22px;
  background: #eef0f5;
  border-radius: 99px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  color: white;
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 28px;
  transition: width 0.4s ease;
}
.score-bar-fill.fill-green { background: linear-gradient(90deg, #16a34a, #4ade80); }
.score-bar-fill.fill-orange { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.score-bar-fill.fill-red { background: linear-gradient(90deg, #dc2626, #f87171); }

/* ---- Skill score row ---- */
.skill-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  border-bottom: 1px solid #f1f3f9;
}
.skill-row:last-child { border-bottom: none; }
.skill-row .skill-name { font-weight: 500; }
.skill-evidence {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  color: var(--muted);
  background: #f9fafb;
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0.75rem;
  margin: 0.2rem 0 0.5rem;
  border-radius: 0 6px 6px 0;
}
.ref-card {
  background: #f9fafb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
}

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 2rem; color: var(--muted); }
