/* ─── RESET & BASE ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --terra:       #8B3613;
  --terra-light: #C07040;
  --terra-pale:  #F9EDE6;
  --green:       #2D5016;
  --green-mid:   #4A7A28;
  --green-pale:  #EAF3DE;
  --navy:        #1E3A5F;
  --navy-mid:    #3A6A9F;
  --navy-pale:   #E6F1FB;
  --gold:        #B8860B;
  --gold-pale:   #FDF5DC;
  --sand:        #F5F0EA;
  --charcoal:    #1A1A1A;
  --muted:       #5A4F4A;
  --border:      #DDD8D2;
  --white:       #FFFFFF;
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 4px rgba(0,0,0,.08);
  --shadow-md:   0 3px 12px rgba(0,0,0,.10);
  --font-body:   'Inter', system-ui, sans-serif;
  --font-serif:  'Lora', Georgia, serif;
  --transition:  0.2s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.7;
  color: var(--charcoal);
  background: var(--sand);
  min-height: 100vh;
}

/* ─── HEADER ────────────────────────────────────────────────── */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--terra);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.5px;
}

.brand-text { display: flex; flex-direction: column; gap: 0; }
.brand-name { font-size: 15px; font-weight: 600; color: var(--charcoal); line-height: 1.2; }
.brand-sub  { font-size: 11px; color: var(--muted); line-height: 1.2; }

.header-actions { display: flex; gap: 6px; align-items: center; }

.voice-selector-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  height: 36px;
  background: var(--white);
  color: var(--muted);
}
.voice-selector-wrap select {
  border: none;
  outline: none;
  background: transparent;
  font-size: 12px;
  color: var(--charcoal);
  max-width: 130px;
  cursor: pointer;
}

.btn-icon {
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.btn-icon:hover { background: var(--sand); color: var(--charcoal); }

/* ─── TABS ──────────────────────────────────────────────────── */
.tab-nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 20px;
  gap: 4px;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
  color: var(--muted);
  font-family: var(--font-body);
}
.tab-btn:hover { color: var(--charcoal); }
.tab-btn.active { color: var(--terra); border-bottom-color: var(--terra); }
.tab-btn[data-tab="fisa2"].active { color: var(--navy); border-bottom-color: var(--navy); }
.tab-btn[data-tab="fisa3"].active { color: var(--terra); border-bottom-color: var(--terra); }

.tab-num { font-size: 11px; font-weight: 600; opacity: 0.5; }
.tab-label { font-size: 14px; font-weight: 500; }

/* ─── PROGRESS ──────────────────────────────────────────────── */
.progress-bar-wrap {
  max-width: 780px;
  margin: 0 auto;
  height: 3px;
  background: var(--border);
}
.progress-bar {
  height: 100%;
  background: var(--terra);
  width: 0%;
  transition: width 0.4s ease;
}

/* ─── PANELS ────────────────────────────────────────────────── */
.main-content { max-width: 780px; margin: 0 auto; padding: 24px 20px 80px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ─── FIȘĂ HEADER ───────────────────────────────────────────── */
.fisa-header {
  background: var(--terra);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  margin-bottom: 24px;
  color: var(--white);
  position: relative;
  overflow: hidden;
}
.fisa-header.navy-theme { background: var(--navy); }

.fisa-header::before {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.fisa-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 3px 12px;
  margin-bottom: 10px;
}

.fisa-title {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 8px;
}

.fisa-desc {
  font-size: 14px;
  opacity: 0.85;
  line-height: 1.6;
  max-width: 560px;
}

.fisa-play-intro {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── PLAY BUTTON ───────────────────────────────────────────── */
.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.18);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 99px;
  color: var(--white);
  padding: 7px 16px 7px 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-body);
}
.btn-play:hover { background: rgba(255,255,255,0.28); }
.btn-play.speaking { background: rgba(255,255,255,0.3); animation: pulse-border 1.2s infinite; }

.btn-play .play-icon {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.btn-play .play-icon svg { transition: var(--transition); }

.btn-play-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--muted);
  padding: 4px 12px 4px 6px;
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-body);
}
.btn-play-inline:hover { border-color: var(--terra-light); color: var(--terra); }
.btn-play-inline.speaking { border-color: var(--terra); color: var(--terra); animation: pulse-border 1.2s infinite; }
.btn-play-inline .play-icon-sm {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--terra-pale);
  display: flex; align-items: center; justify-content: center;
}
.navy-theme-section .btn-play-inline:hover,
.navy-theme-section .btn-play-inline.speaking { border-color: var(--navy-mid); color: var(--navy); }
.navy-theme-section .btn-play-inline .play-icon-sm { background: var(--navy-pale); }

@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139,54,19,0.3); }
  50%       { box-shadow: 0 0 0 5px rgba(139,54,19,0); }
}

/* ─── STEP CARDS ────────────────────────────────────────────── */
.step-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.step-card:hover { box-shadow: var(--shadow-sm); }

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
}

.step-number {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  background: var(--terra-pale);
  color: var(--terra);
}
.navy-theme-section .step-number { background: var(--navy-pale); color: var(--navy); }
.step-card.completed .step-number { background: var(--green-pale); color: var(--green); }

.step-title-wrap { flex: 1; }
.step-title { font-size: 15px; font-weight: 500; color: var(--charcoal); line-height: 1.3; }
.step-hint  { font-size: 12px; color: var(--muted); margin-top: 2px; }

.step-header-right { display: flex; align-items: center; gap: 8px; }

.step-chevron {
  color: var(--muted);
  transition: transform var(--transition);
  flex-shrink: 0;
}
.step-card.open .step-chevron { transform: rotate(180deg); }

.step-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.step-card.open .step-body { max-height: 9999px; }

.step-content { padding: 0 20px 20px; }

/* ─── GUIDANCE PANEL ────────────────────────────────────────── */
.guidance {
  background: var(--terra-pale);
  border-left: 3px solid var(--terra);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.navy-theme-section .guidance { background: var(--navy-pale); border-left-color: var(--navy); }

.guidance-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--terra);
  margin-bottom: 6px;
}
.navy-theme-section .guidance-label { color: var(--navy); }

.guidance-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 14px;
  color: var(--charcoal);
  line-height: 1.7;
}

/* ─── QUESTIONS ─────────────────────────────────────────────── */
.questions-list { display: flex; flex-direction: column; gap: 16px; }

.question-item {}
.question-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--charcoal);
  margin-bottom: 6px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.q-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--terra-pale);
  color: var(--terra);
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 1px;
}
.navy-theme-section .q-num { background: var(--navy-pale); color: var(--navy); }

textarea.answer-field, input.answer-field {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--charcoal);
  background: var(--white);
  resize: vertical;
  transition: border-color var(--transition);
  line-height: 1.6;
}
textarea.answer-field { min-height: 80px; }
textarea.answer-field:focus, input.answer-field:focus {
  outline: none;
  border-color: var(--terra-light);
  box-shadow: 0 0 0 3px rgba(139,54,19,0.08);
}
.navy-theme-section textarea.answer-field:focus,
.navy-theme-section input.answer-field:focus {
  border-color: var(--navy-mid);
  box-shadow: 0 0 0 3px rgba(30,58,95,0.08);
}

/* ─── SUPERPUTERI CHECKBOXES ────────────────────────────────── */
.sp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.sp-chip {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  background: var(--white);
}
.sp-chip:hover { border-color: var(--green-mid); background: var(--green-pale); }
.sp-chip.selected {
  border-color: var(--green-mid);
  background: var(--green-pale);
  box-shadow: inset 0 0 0 1px var(--green-mid);
}

.sp-chip input[type="checkbox"] { display: none; }

.sp-check {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.sp-chip.selected .sp-check {
  background: var(--green-mid);
  border-color: var(--green-mid);
}
.sp-check-mark {
  display: none;
  color: white;
}
.sp-chip.selected .sp-check-mark { display: block; }

.sp-name { font-size: 13px; font-weight: 500; color: var(--charcoal); line-height: 1.3; }
.sp-def  { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

.sp-counter {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.sp-counter strong { color: var(--green); }

/* ─── SUPERPUTERI TABLE ─────────────────────────────────────── */
.sp-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.sp-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--white);
  padding: 10px 12px;
  background: var(--green);
}
.sp-table th:first-child { border-radius: var(--radius-sm) 0 0 0; width: 40%; }
.sp-table th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }
.sp-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.sp-table tr:nth-child(even) td { background: var(--green-pale); }
.sp-table input[type="text"] {
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  padding: 4px;
  color: var(--charcoal);
}
.sp-table input[type="text"]:focus { outline: 1px solid var(--green-mid); border-radius: 3px; }
.sp-row-num {
  width: 28px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
}

/* ─── DECADE GRID ───────────────────────────────────────────── */
.decade-grid-wrap { overflow-x: auto; }
.decade-grid {
  min-width: 560px;
  border-collapse: collapse;
  width: 100%;
}
.decade-grid th {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 12px;
  background: var(--navy);
  color: var(--white);
  text-align: left;
}
.decade-grid th.decade-col { width: 110px; }
.decade-grid td {
  padding: 4px 6px;
  border: 1px solid var(--border);
  vertical-align: top;
}
.decade-grid tr:nth-child(even) td { background: #F8FAFD; }
.decade-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  background: var(--navy-pale);
  padding: 8px 10px;
  text-align: center;
}
.decade-grid textarea {
  width: 100%;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 12px;
  resize: none;
  min-height: 70px;
  padding: 4px;
  color: var(--charcoal);
}
.decade-grid textarea:focus { outline: 1px solid var(--navy-mid); border-radius: 3px; }

/* ─── RANI LEGEND ───────────────────────────────────────────── */
.rani-legend {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.rani-chip {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}
.rani-code {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  background: var(--navy-pale);
  color: var(--navy);
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 4px;
}
.rani-name { font-size: 13px; font-weight: 500; color: var(--charcoal); }
.rani-sign { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 2px; line-height: 1.4; }

/* ─── TOP 10 TABLE ──────────────────────────────────────────── */
.top10-table { width: 100%; border-collapse: collapse; }
.top10-table th {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--white);
  padding: 10px 10px; background: var(--terra); text-align: left;
}
.top10-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); }
.top10-table tr:nth-child(even) td { background: var(--terra-pale); }
.top10-table td input {
  width: 100%; border: none; background: transparent;
  font-family: var(--font-body); font-size: 13px;
  padding: 5px 4px; color: var(--charcoal);
}
.top10-table td input:focus { outline: 1px solid var(--terra-light); border-radius: 3px; }
.top10-rank {
  width: 30px; text-align: center;
  font-size: 12px; font-weight: 700; color: var(--terra);
}

/* ─── BALANCE TABLE ─────────────────────────────────────────── */
.balance-table { width: 100%; border-collapse: collapse; }
.balance-table th {
  padding: 10px 12px; font-size: 13px; font-weight: 600;
  color: var(--white); text-align: center;
}
.balance-table .th-dezav { background: var(--terra); }
.balance-table .th-benef { background: var(--green); }
.balance-table td { padding: 4px 6px; border: 1px solid var(--border); vertical-align: top; }
.balance-table tr:nth-child(odd) .td-dezav { background: #FFF5F0; }
.balance-table tr:nth-child(odd) .td-benef { background: #F5FFF0; }
.balance-table td input {
  width: 100%; border: none; background: transparent;
  font-family: var(--font-body); font-size: 13px;
  padding: 6px 4px; color: var(--charcoal);
}
.balance-table td input:focus { outline: 1px solid var(--terra-light); border-radius: 3px; }

/* ─── CHECKBOXES (MANIFESTĂRI) ──────────────────────────────── */
.manifest-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.manifest-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}
.manifest-item:hover { border-color: var(--terra-light); }
.manifest-item.checked { background: var(--terra-pale); border-color: var(--terra-light); }
.manifest-item input[type="checkbox"] { display: none; }
.manifest-cb {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.manifest-item.checked .manifest-cb { background: var(--terra); border-color: var(--terra); }
.manifest-cb-mark { display: none; color: white; }
.manifest-item.checked .manifest-cb-mark { display: block; }
.manifest-text { font-size: 14px; color: var(--charcoal); line-height: 1.4; }
.manifest-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ─── SECTION DIVIDER ───────────────────────────────────────── */
.section-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 28px 0 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-divider::before, .section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── TIP BOX ───────────────────────────────────────────────── */
.tip-box {
  background: var(--gold-pale);
  border-left: 3px solid var(--gold);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 13px;
  color: var(--charcoal);
  line-height: 1.6;
}
.tip-box strong { color: var(--gold); }

/* ─── OPTIONAL FIELD ────────────────────────────────────────── */
.optional-field-wrap {
  margin-top: 14px;
}
.optional-field-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

/* ─── TOAST ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--charcoal);
  color: var(--white);
  padding: 10px 20px;
  border-radius: 99px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 999;
  white-space: nowrap;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 540px) {
  .tab-label { display: none; }
  .fisa-title { font-size: 22px; }
  .header-inner { padding: 10px 16px; }
  .main-content { padding: 16px 14px 80px; }
}

@media print {
  .site-header, .tab-nav, .progress-bar-wrap, .btn-play, .btn-play-inline, .header-actions { display: none !important; }
  .tab-panel { display: block !important; }
  .step-body { max-height: none !important; }
}
