/* ─────────────────────────────────────────
   SWE Skills Assessment — style.css
   Fonts: Libre Baskerville (questions) + DM Sans (UI)
   Theme:  warm cream · forest teal accent · clean editorial
   ───────────────────────────────────────── */

:root {
  --bg:           #F7F5FC;
  --surface:      #FFFFFF;
  --border:       #E2DAF3;
  --border-focus: #6422C9;

  --text-primary:   #1C1530;
  --text-secondary: #6B6385;
  --text-muted:     #A99FC4;

  --accent:       #6422C9;
  --accent-hover: #4E1AA0;
  --accent-light: #F3EFFF;
  --accent-mid:   #C9BCEC;

  --kendra-azure: #2E7DF6;
  --kendra-teal:  #10B5A4;
  --kendra-amber: #F7A93B;
  --kendra-rose:  #F2547D;

  --danger:       #F2547D;
  --danger-light: #FDECF1;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.07), 0 6px 20px rgba(0,0,0,0.05);

  --radius:    12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --font-display: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
  --font-body:    'DM Sans', system-ui, -apple-system, sans-serif;

  --transition: 0.15s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ── */
#app {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem 1rem 4rem;
}

/* #screen-container is the flex item of #app; without an explicit width it
   shrink-wraps its content, so the card width followed the statement length. */
#screen-container {
  flex: 0 0 min(600px, 100%);
  width: min(600px, 100%);
  min-width: 0;
}

.screen {
  box-sizing: border-box;
  width: min(600px, 100%);   /* fixed width for every screen, whatever the text length */
  min-width: 0;
  max-width: 600px;
  animation: slideUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* ── Shared typography ── */
.display-heading {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background var(--transition), border-color var(--transition),
              color var(--transition), opacity var(--transition),
              transform 0.08s ease;
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-primary:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  padding: 8px 12px;
}
.btn-ghost:hover {
  background: var(--bg);
  color: var(--text-primary);
}

.btn-full { width: 100%; }

.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ── Form inputs ── */
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

input[type="text"],
input[type="email"] {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}
input[type="text"]::placeholder,
input[type="email"]::placeholder { color: var(--text-muted); }
input[type="text"]:focus,
input[type="email"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1.5rem 0;
}

/* ═══════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════ */
.login-card { padding: 2.5rem; }

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2rem;
}
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.brand-mark svg { display: block; }
.brand-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-heading {
  font-size: 26px;
  margin-bottom: 0.75rem;
}
.login-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 2rem;
}

/* ═══════════════════════════════════════
   RESUME SCREEN
   ═══════════════════════════════════════ */
.resume-card { padding: 2.5rem; }
.resume-heading { font-size: 22px; margin-bottom: 0.5rem; }
.resume-sub {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.55;
}

.resume-stats {
  background: var(--bg);
  border-radius: var(--radius-sm);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.resume-stat {
  padding: 1rem;
  text-align: center;
  border-right: 1px solid var(--border);
}
.resume-stat:last-child { border-right: none; }
.resume-stat-val {
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
  display: block;
  margin-bottom: 3px;
}
.resume-stat-lbl {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ═══════════════════════════════════════
   QUESTION SCREEN
   ═══════════════════════════════════════ */
.q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.q-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.q-brand-mark svg { display: block; width: 20px; height: 20px; }
.q-brand-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}
.q-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Progress */
.progress-section {
  padding: 1rem 1.25rem 0.875rem;
  border-bottom: 1px solid var(--border);
}
.progress-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 7px;
}
.progress-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.progress-pct {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.progress-track {
  height: 3px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  min-width: 3px;
}

/* Question body */
.q-body { padding: 1.5rem 1.25rem 1.25rem; }

.q-statement {
  font-family: var(--font-display);
  font-size: 19px;
  line-height: 1.55;
  color: var(--text-primary);
  margin-bottom: 1.75rem;
  min-height: 4.65em;        /* room for 3 lines, so the card is the same height for every question */
}

/* Likert options */
.likert-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 1.25rem;
}

.likert-option {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 11px 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.likert-option:hover {
  border-color: var(--accent-mid);
  background: #FAFFFD;
}
.likert-option.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}

.radio-ring {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: border-color var(--transition);
}
.likert-option:hover .radio-ring { border-color: var(--accent-mid); }
.likert-option.selected .radio-ring { border-color: var(--accent); }

.radio-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transform: scale(0.3);
  transition: opacity 0.15s, transform 0.15s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.likert-option.selected .radio-dot {
  opacity: 1;
  transform: scale(1);
}

.likert-label {
  font-size: 14px;
  color: var(--text-primary);
  transition: color var(--transition);
}
.likert-option.selected .likert-label {
  color: var(--accent);
  font-weight: 500;
}

.likert-key {
  margin-left: auto;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.likert-option.selected .likert-key {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
}

/* Scale hints */
.scale-hints {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
  margin-top: -4px;
  margin-bottom: 1rem;
}
.scale-hint {
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

/* Validation */
.validation-msg {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--danger);
  padding: 8px 12px;
  background: var(--danger-light);
  border-radius: var(--radius-xs);
  margin-bottom: 1rem;
  animation: fadeIn 0.2s ease both;
}
.validation-msg svg { flex-shrink: 0; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Footer */
.q-footer {
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg);
}

/* ═══════════════════════════════════════
   COMPLETE SCREEN
   ═══════════════════════════════════════ */
.complete-card {
  padding: 2.5rem;
  text-align: center;
}
.complete-icon-wrap {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--accent-light);
  border: 1.5px solid var(--accent-mid);
  display: grid;
  place-items: center;
  margin: 0 auto 1.5rem;
}
.complete-heading { font-size: 24px; margin-bottom: 0.75rem; }
.complete-sub {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 2rem;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.saved-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--kendra-teal);
  background: #E8F9F6;
  padding: 8px 14px;
  border-radius: 99px;
  margin: 0 auto 1.75rem;
}
.saved-indicator-pending {
  color: var(--text-secondary);
  background: var(--bg);
}
.saved-indicator-error {
  color: var(--danger);
  background: var(--danger-light);
  flex-wrap: wrap;
  justify-content: center;
}
.saved-spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--text-secondary);
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.saved-retry-btn {
  border: none;
  background: none;
  color: var(--danger);
  font-weight: 600;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin-left: 4px;
}

.complete-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 2rem;
}
.stat-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.1rem 0.75rem;
}
.stat-tile-val {
  font-size: 26px;
  font-weight: 600;
  color: var(--accent);
  display: block;
  line-height: 1;
  margin-bottom: 5px;
}
.stat-tile-lbl {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ═══════════════════════════════════════
   TOAST
   ═══════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text-primary);
  color: #F5F0E8;
  padding: 11px 22px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.35s ease;
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */
@media (max-width: 520px) {
  #app { padding: 1rem 0.75rem 3rem; }

  .login-card,
  .resume-card,
  .complete-card { padding: 1.5rem; }

  .login-heading { font-size: 22px; }
  .q-statement   { font-size: 17px; min-height: 7.75em; } /* 5 lines on a narrow phone */

  .complete-stats { grid-template-columns: 1fr; }

  .resume-stats {
    grid-template-columns: 1fr;
  }
  .resume-stat {
    border-right: none;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
  }
  .resume-stat:last-child { border-bottom: none; }

  .q-footer { flex-wrap: wrap; }
  .q-footer .btn-primary { flex: 1; }
}

/* ═══════════════════════════════════════
   PASSCODE GATE / LOADING
   ═══════════════════════════════════════ */

input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}
input[type="password"]::placeholder { color: var(--text-muted); }
input[type="password"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.login-card #name-input {
  margin-bottom: 14px;
}
.login-card #email-input {
  margin-bottom: 14px;
}
.login-card #passcode-input {
  margin-bottom: 18px;
}
.login-card .validation-msg {
  margin-bottom: 14px;
}
.login-card .field-label {
  margin-top: 2px;
}

/* ── NDA checkbox ── */
.nda-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0 4px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}
.nda-label input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.nda-label a { color: var(--accent); font-weight: 600; }
.nda-label a:hover { color: var(--accent-hover); }
