/* ===================================================
   ASSESSMENT — Production CSS
   Design System: Primary #2563EB, Secondary #7C3AED,
   Accent #F59E0B, BG #EFF6FF, FG #0F172A
   Font: Heebo | RTL
   =================================================== */

/* ---- Reset & Base ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary:      #2563EB;
  --primary-dark: #1D4ED8;
  --primary-light:#DBEAFE;
  --secondary:    #7C3AED;
  --secondary-light:#EDE9FE;
  --accent:       #F59E0B;
  --accent-light: #FEF3C7;
  --bg:           #EFF6FF;
  --fg:           #0F172A;
  --fg-muted:     #475569;
  --fg-faint:     #94A3B8;
  --border:       #CBD5E1;
  --border-focus: #2563EB;
  --white:        #FFFFFF;
  --success:      #059669;
  --danger:       #DC2626;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md:    0 4px 16px rgba(0,0,0,0.10), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-lg:    0 8px 32px rgba(37,99,235,0.12), 0 4px 12px rgba(0,0,0,0.08);
  --radius-sm:    8px;
  --radius-md:    12px;
  --radius-lg:    16px;
  --radius-xl:    20px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Heebo', sans-serif;
  background: linear-gradient(145deg, #EFF6FF 0%, #E0EAFF 40%, #EDE9FE 100%);
  min-height: 100vh;
  color: var(--fg);
  direction: rtl;
  line-height: 1.6;
}

/* ---- App Shell ---- */
#app {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  min-height: 100vh;
}

/* ---- Screens ---- */
.screen { display: none; }
.screen.active {
  display: block;
  animation: fadeUp 0.35s ease both;
}

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

/* ======================================================
   CARDS
   ====================================================== */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,0.8);
}

.center-card {
  text-align: center;
  margin-top: 8vh;
}

.question-card {
  margin-bottom: 16px;
}

/* ======================================================
   WELCOME SCREEN
   ====================================================== */
.brand {
  margin-bottom: 24px;
}

.brand h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
  line-height: 1.3;
}

.brand-sub {
  color: var(--fg-muted);
  font-size: 0.95rem;
  font-weight: 400;
}

.welcome-greeting {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--fg);
  margin-bottom: 12px;
}

.welcome-body {
  font-size: 1rem;
  color: var(--fg-muted);
  line-height: 1.75;
  margin-bottom: 20px;
}

/* Info chips row */
.info-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 20px 0 24px;
}

.info-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  border: 1px solid #BFDBFE;
  border-radius: 100px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-dark);
  white-space: nowrap;
}

.info-chip svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

/* Note / hint text */
.note {
  font-size: 0.875rem;
  color: var(--fg-faint);
  font-style: italic;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ======================================================
   PROGRESS AREA
   ====================================================== */
.progress-area {
  margin-bottom: 20px;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.progress-section-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--white);
  opacity: 0.9;
  letter-spacing: 0.01em;
}

.progress-counter {
  font-size: 0.8rem;
  color: var(--white);
  opacity: 0.75;
}

/* Overall bar */
.progress-bar {
  background: rgba(255,255,255,0.22);
  border-radius: 100px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 4px;
}

.progress-fill {
  background: linear-gradient(90deg, #34D399 0%, #10B981 100%);
  height: 100%;
  border-radius: 100px;
  transition: width 0.45s cubic-bezier(.4,0,.2,1);
  width: 0%;
}

/* Section sub-bar */
.section-progress-bar {
  background: rgba(255,255,255,0.14);
  border-radius: 100px;
  height: 4px;
  overflow: hidden;
}

.section-progress-fill {
  background: rgba(255,255,255,0.55);
  height: 100%;
  border-radius: 100px;
  transition: width 0.45s cubic-bezier(.4,0,.2,1);
  width: 0%;
}

/* ======================================================
   SECTION HEADER
   ====================================================== */
.section-header {
  margin-bottom: 14px;
  padding: 14px 18px;
  background: rgba(255,255,255,0.18);
  border-radius: var(--radius-md);
  border: 1px solid rgba(255,255,255,0.3);
  backdrop-filter: blur(4px);
}

.section-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 3px;
}

.section-header p {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.8);
  line-height: 1.5;
}

/* ======================================================
   QUESTION CARD
   ====================================================== */
.question-text {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.65;
  color: var(--fg);
  margin-bottom: 6px;
}

.question-note {
  font-size: 0.825rem;
  color: var(--fg-faint);
  margin-bottom: 16px;
  line-height: 1.5;
}

/* ======================================================
   OPTION CARDS — radio style
   ====================================================== */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
  font-size: 0.975rem;
  line-height: 1.55;
  color: var(--fg);
  min-height: 52px;   /* touch target */
  background: var(--white);
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.option:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

/* Focus for keyboard navigation */
.option:focus-visible,
.option:focus {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

/* Custom radio dot */
.option-radio {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  transition: border-color 0.18s, background 0.18s;
  background: var(--white);
}

.option.selected .option-radio {
  border-color: var(--primary);
  background: var(--primary);
}

.option.selected .option-radio::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--white);
  display: block;
}

/* ======================================================
   FORCED CHOICE (A vs B)
   ====================================================== */
.forced-choice {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.forced-choice .option {
  flex: 1;
  flex-direction: column;
  text-align: center;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  padding: 18px 14px;
  gap: 0;
}

.forced-choice .option-radio {
  display: none; /* no radio dot in forced choice */
}

/* ======================================================
   LIKERT SCALE
   ====================================================== */
.likert-wrapper {
  margin-top: 16px;
}

.likert {
  display: flex;
  gap: 7px;
}

.likert-option {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 11px 4px 9px;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, box-shadow 0.18s;
  min-height: 56px;       /* touch target */
  min-width: 44px;
  background: var(--white);
  -webkit-tap-highlight-color: transparent;
}

.likert-option:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.likert-option.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.likert-option:focus-visible,
.likert-option:focus {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}

.likert-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg-muted);
  line-height: 1;
}

.likert-option.selected .likert-num {
  color: var(--primary-dark);
}

.likert-word {
  font-size: 0.65rem;
  color: var(--fg-faint);
  text-align: center;
  line-height: 1.2;
}

.likert-option.selected .likert-word {
  color: var(--primary);
}

/* Endpoint labels below likert */
.likert-endpoints {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  padding: 0 2px;
}

.likert-endpoints span {
  font-size: 0.75rem;
  color: var(--fg-faint);
}

/* ======================================================
   TEXT INPUTS, TEXTAREA, SELECT
   ====================================================== */
.field-wrapper {
  margin-top: 16px;
}

.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 6px;
}

.answer-textarea,
.answer-input,
.answer-select {
  width: 100%;
  font-family: 'Heebo', sans-serif;
  font-size: 1rem;
  color: var(--fg);
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px 16px;
  direction: rtl;
  transition: border-color 0.18s, box-shadow 0.18s;
  appearance: none;
  -webkit-appearance: none;
}

.answer-textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.65;
}

.answer-textarea::placeholder,
.answer-input::placeholder {
  color: var(--fg-faint);
}

.answer-textarea:focus,
.answer-input:focus,
.answer-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.answer-textarea.error,
.answer-input.error,
.answer-select.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(220,38,38,0.12);
}

/* Char hint */
.field-hint {
  margin-top: 5px;
  font-size: 0.775rem;
  color: var(--fg-faint);
  text-align: left;
  direction: ltr;
}

/* Select arrow (RTL: left side) */
.select-wrapper {
  position: relative;
  margin-top: 16px;
}

.select-wrapper::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--fg-muted);
  pointer-events: none;
}

.select-wrapper .answer-select {
  padding-left: 36px;
  margin-top: 0;
  cursor: pointer;
}

.select-wrapper .answer-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

/* ======================================================
   BUTTONS
   ====================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 28px;
  font-size: 1rem;
  font-family: 'Heebo', sans-serif;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(.4,0,.2,1);
  min-height: 50px;      /* touch target */
  min-width: 44px;
  text-decoration: none;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}

.btn:focus-visible,
.btn:focus {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary */
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  color: var(--white);
  box-shadow: 0 2px 8px rgba(37,99,235,0.30);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37,99,235,0.38);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(37,99,235,0.25);
}

/* Secondary */
.btn-secondary {
  background: rgba(255,255,255,0.85);
  color: var(--fg-muted);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--white);
  border-color: var(--primary);
  color: var(--primary);
}

/* Nav row */
.nav-buttons {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.nav-buttons .btn {
  flex: 1;
}

/* ======================================================
   LOADER
   ====================================================== */
.loader {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(37,99,235,0.15);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ======================================================
   ICON CONTAINERS (SVG-based — no emoji)
   ====================================================== */
.icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 20px;
}

.icon-container.warning {
  background: #FEF3C7;
  color: #D97706;
}

.icon-container.success {
  background: #D1FAE5;
  color: var(--success);
}

.icon-container svg {
  width: 36px;
  height: 36px;
}

/* ======================================================
   ERROR SCREEN
   ====================================================== */
#error-screen .card h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 10px;
}

#error-screen .card p {
  color: var(--fg-muted);
  font-size: 0.975rem;
}

/* ======================================================
   THANK YOU SCREEN
   ====================================================== */
.thank-you-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 10px;
}

.thank-you-sub {
  font-size: 1rem;
  color: var(--fg-muted);
  line-height: 1.7;
  margin-bottom: 24px;
}

.thank-you-steps {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  text-align: right;
  margin-bottom: 20px;
}

.thank-you-steps h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.step-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.step-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 0.925rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

.step-num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

/* Social hint */
.social-hint {
  background: var(--accent-light);
  border: 1px solid #FDE68A;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 0.875rem;
  color: #92400E;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: right;
}

.social-hint svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  color: #D97706;
  margin-top: 1px;
}

/* ======================================================
   SUBMITTING SCREEN
   ====================================================== */
#submitting .card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 8px;
}

#submitting .card p {
  color: var(--fg-muted);
  font-size: 0.95rem;
}

/* ======================================================
   WELCOME — Start button centered
   ====================================================== */
.welcome-btn-row {
  margin-top: 24px;
}

/* ======================================================
   ACCESSIBILITY UTILITIES
   ====================================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ======================================================
   RESPONSIVE — Mobile
   ====================================================== */
@media (max-width: 600px) {
  #app {
    padding: 16px 12px 40px;
  }

  .card {
    padding: 24px 18px;
  }

  .brand h1 {
    font-size: 1.45rem;
  }

  .center-card {
    margin-top: 5vh;
  }

  .forced-choice {
    flex-direction: column;
  }

  .forced-choice .option {
    min-height: 66px;
    padding: 14px 16px;
  }

  .likert {
    gap: 5px;
  }

  .likert-option {
    padding: 10px 3px 8px;
    min-height: 52px;
  }

  .likert-num {
    font-size: 1rem;
  }

  .likert-word {
    font-size: 0.6rem;
  }

  .info-chips {
    gap: 8px;
  }

  .info-chip {
    font-size: 0.825rem;
    padding: 7px 13px;
  }

  .btn {
    padding: 13px 20px;
    font-size: 0.975rem;
  }

  .question-text {
    font-size: 1.025rem;
  }

  .progress-section-name {
    font-size: 0.75rem;
  }
}

@media (max-width: 380px) {
  .likert-word {
    display: none;
  }
  .likert-option {
    min-height: 44px;
    padding: 8px 2px;
  }
}
