/* ─── Reset & Base ────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #f0f2f7;
  color: #1e2a3b;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Progress Bar ────────────────────────────────────────────────────── */
#progress-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255,255,255,0.15);
  z-index: 1000;
}

#progress-bar {
  height: 100%;
  background: #60a5fa;
  transition: width 0.4s ease;
  width: 0%;
}

/* ─── Header ──────────────────────────────────────────────────────────── */
header {
  background-color: #0f172a;
  color: #ffffff;
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid #1e3a5f;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-logo {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #60a5fa;
  padding: 0.2rem 0.5rem;
  border: 1px solid #1e3a5f;
  border-radius: 3px;
}

header h1 {
  font-size: 1rem;
  font-weight: 600;
  color: #cbd5e1;
  letter-spacing: 0.02em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.icon-btn {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}

.icon-btn:hover {
  border-color: #60a5fa;
  color: #60a5fa;
  background: rgba(96, 165, 250, 0.08);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

#progress-label {
  font-size: 0.8rem;
  color: #64748b;
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: right;
}

#btn-restart {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 0.4rem 1rem;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all 0.15s;
}

#btn-restart:hover {
  border-color: #60a5fa;
  color: #60a5fa;
}

/* ─── Main Layout ─────────────────────────────────────────────────────── */
main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1.5rem 4rem;
}

/* ─── Question Card ───────────────────────────────────────────────────── */
.card {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07), 0 4px 24px rgba(0,0,0,0.06);
  padding: 2.5rem 2.5rem 2rem;
  max-width: 760px;
  width: 100%;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.section-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2563eb;
  background: #eff6ff;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  border: 1px solid #bfdbfe;
}

.competency-label {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}

.question-number {
  margin-left: auto;
  font-size: 0.75rem;
  color: #cbd5e1;
  font-variant-numeric: tabular-nums;
}

.question-text {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e2a3b;
  line-height: 1.55;
  margin-bottom: 0.4rem;
}

.question-hint {
  font-size: 0.78rem;
  color: #94a3b8;
  font-style: italic;
  margin-bottom: 1.5rem;
}

/* ─── Answer Options ──────────────────────────────────────────────────── */
.answers {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.answer-option {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 0.875rem 1.125rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
  user-select: none;
}

/* ─── Optional Note Section ───────────────────────────────────────────── */
.optional-note {
  margin-bottom: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
}

.note-label {
  display: block;
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 0.5rem;
}

.note-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
  color: #334155;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.15s;
}

.note-textarea:focus {
  outline: none;
  border-color: #93c5fd;
  background-color: #f8faff;
}

.note-textarea::placeholder {
  color: #cbd5e1;
}

.answer-option:hover {
  border-color: #93c5fd;
  background-color: #f8faff;
}

.answer-option.selected {
  border-color: #2563eb;
  background-color: #eff6ff;
}

.answer-option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 3px;
  margin-top: 2px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background-color 0.15s;
}

.answer-option.selected input[type="checkbox"] {
  border-color: #2563eb;
  background-color: #2563eb;
}

.answer-option.selected input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 5px;
  height: 9px;
  border: 2px solid #ffffff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* N/A option — subtler styling */
.answer-option--na {
  border-style: dashed;
  border-color: #e2e8f0;
}

.answer-option--na .answer-text {
  color: #94a3b8;
  font-style: italic;
}

.answer-option--na.selected {
  border-color: #94a3b8;
  background-color: #f8fafc;
}

.answer-option--na.selected input[type="checkbox"] {
  border-color: #94a3b8;
  background-color: #94a3b8;
}

.answer-text {
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.5;
}

/* ─── Navigation ──────────────────────────────────────────────────────── */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  border-top: 1px solid #f1f5f9;
}

.btn-primary {
  background-color: #2563eb;
  color: #ffffff;
  border: none;
  padding: 0.65rem 1.75rem;
  border-radius: 5px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn-primary:hover {
  background-color: #1d4ed8;
}

.btn-primary:disabled {
  background-color: #cbd5e1;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  border: 1.5px solid #e2e8f0;
  color: #334155;
  padding: 0.65rem 1.75rem;
  border-radius: 5px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  border-color: #2563eb;
  color: #2563eb;
  background-color: #eff6ff;
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Review Screen ───────────────────────────────────────────────────── */
#review-screen {
  max-width: 860px;
  width: 100%;
}

.review-wrapper {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07), 0 4px 24px rgba(0,0,0,0.06);
}

.review-header {
  background: #0f172a;
  color: #fff;
  border-radius: 8px 8px 0 0;
  padding: 2rem 2.5rem;
  border-bottom: 3px solid #2563eb;
}

.review-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
}

.review-header p {
  font-size: 0.85rem;
  color: #94a3b8;
}

.review-list {
  padding: 2rem 2.5rem;
  max-height: 600px;
  overflow-y: auto;
}

.review-item {
  padding: 1.25rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.15s;
  background: #fff;
}

.review-item:hover {
  border-color: #93c5fd;
  background-color: #f8faff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.review-item-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.review-item-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: #64748b;
  min-width: 60px;
}

.review-item-question {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e2a3b;
  line-height: 1.4;
  margin-bottom: 0.5rem;
}

.review-item-answer {
  font-size: 0.85rem;
  color: #64748b;
  line-height: 1.5;
}

.review-item-answer strong {
  color: #2563eb;
  font-weight: 600;
}

.review-item-note {
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: #fef3c7;
  border-left: 2px solid #facc15;
  border-radius: 3px;
  font-size: 0.8rem;
  color: #713f12;
}

.review-footer {
  padding: 1.5rem 2.5rem;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ─── Results Screen ──────────────────────────────────────────────────── */
#results-screen {
  max-width: 760px;
  width: 100%;
}

.results-header {
  background: #0f172a;
  color: #fff;
  border-radius: 8px 8px 0 0;
  padding: 2rem 2.5rem;
  border-bottom: 3px solid #2563eb;
}

.results-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.35rem;
}

.results-header p {
  font-size: 0.85rem;
  color: #94a3b8;
}

.results-body {
  background: #fff;
  border-radius: 0 0 8px 8px;
  padding: 2.5rem 2.5rem 2rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
}

.results-disclaimer {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #2563eb;
  border-radius: 4px;
  padding: 0.85rem 1.1rem;
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.results-export {
  margin-bottom: 2rem;
}

.results-export h3 {
  font-size: 1rem;
  font-weight: 600;
  color: #1e2a3b;
  margin-bottom: 0.5rem;
}

.results-export p {
  font-size: 0.85rem;
  color: #64748b;
  margin-bottom: 0.75rem;
}

.export-textarea {
  width: 100%;
  height: 200px;
  padding: 0.875rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 6px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  color: #334155;
  line-height: 1.5;
  resize: vertical;
  background-color: #f8fafc;
  margin-bottom: 0.75rem;
}

#btn-copy-json {
  background: transparent;
  border: 1.5px solid #e2e8f0;
  color: #334155;
  padding: 0.5rem 1.25rem;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

#btn-copy-json:hover {
  border-color: #2563eb;
  color: #2563eb;
  background-color: #eff6ff;
}

.results-actions {
  display: flex;
  justify-content: flex-end;
}

/* ─── Landing Page ────────────────────────────────────────────────────── */
.landing-container {
  max-width: 680px;
  width: 100%;
  padding-top: 1rem;
}

.landing-intro {
  margin-bottom: 2.5rem;
}

.landing-intro h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1e2a3b;
  margin-bottom: 0.6rem;
}

.landing-intro p {
  font-size: 0.92rem;
  color: #64748b;
  line-height: 1.6;
}

.role-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.role-card {
  background: #fff;
  border: 1.5px solid #e2e8f0;
  border-radius: 8px;
  padding: 1.75rem 1.75rem 1.5rem;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.role-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.1);
}

.role-card-icon {
  width: 40px;
  height: 40px;
  background: #eff6ff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.role-card-icon svg {
  width: 22px;
  height: 22px;
  stroke: #2563eb;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.role-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: #1e2a3b;
}

.role-card p {
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.5;
}

.role-card .card-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #2563eb;
  letter-spacing: 0.02em;
}

.landing-notice {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.8rem;
  color: #64748b;
  line-height: 1.55;
}

/* ─── Confirmation Modal ──────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  background: #fff;
  border-radius: 8px;
  padding: 2rem 2.5rem;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.modal h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.65rem;
  color: #1e2a3b;
}

.modal p {
  font-size: 0.87rem;
  color: #64748b;
  margin-bottom: 1.5rem;
  line-height: 1.55;
}

.modal-fields {
  display: grid;
  gap: 0.95rem;
  margin-bottom: 1.2rem;
}

.modal-field {
  display: grid;
  gap: 0.35rem;
}

.modal-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #334155;
}

.modal-field input {
  width: 100%;
  border: 1.5px solid #dbe3ee;
  border-radius: 6px;
  padding: 0.55rem 0.65rem;
  font-size: 0.9rem;
  color: #1e293b;
  background: #fff;
}

.modal-field input:focus {
  outline: none;
  border-color: #60a5fa;
  box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.16);
}

.lang-toggle {
  display: flex;
  gap: 1.25rem;
  margin-top: 0.25rem;
}

.lang-toggle label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 400;
  cursor: pointer;
  color: #334155;
}

.lang-toggle input[type="radio"] {
  accent-color: #2563eb;
  width: 1rem;
  height: 1rem;
}

.modal-error {
  display: none;
  font-size: 0.8rem;
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  margin-bottom: 1rem;
}

.modal-error.show {
  display: block;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.btn-secondary {
  background: transparent;
  border: 1.5px solid #e2e8f0;
  color: #64748b;
  padding: 0.55rem 1.25rem;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover {
  border-color: #94a3b8;
  color: #334155;
}

.btn-danger {
  background-color: #dc2626;
  color: #fff;
  border: none;
  padding: 0.55rem 1.25rem;
  border-radius: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
}

.btn-danger:hover {
  background-color: #b91c1c;
}

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 540px) {
  .card, .results-body, .results-header {
    padding: 1.5rem;
  }

  .role-cards {
    grid-template-columns: 1fr;
  }

  header {
    padding: 0 1rem;
  }

  header h1 {
    display: none;
  }
}
