/* ============================================================
 * R&K Kelas Inggris — Profile Wizard + Accessibility CSS
 * ============================================================ */

/* ===== Onboarding Wizard ===== */
.wiz-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  z-index: 9998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}
.wiz-overlay.show { display: flex; }

.wiz-box {
  background: white;
  border-radius: 22px;
  max-width: 620px;
  width: 100%;
  max-height: 92vh;
  overflow-y: auto;
  padding: 28px 24px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
  animation: wizPop 0.35s ease;
}
@keyframes wizPop {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.wiz-step { display: none; }
.wiz-step.active { display: block; }

.wiz-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
}
.wiz-progress > div {
  flex: 1;
  height: 6px;
  background: var(--border-soft);
  border-radius: 99px;
  transition: background 0.3s;
}
.wiz-progress > div.done {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.wiz-title {
  font-size: 1.45rem;
  font-weight: 900;
  color: var(--primary);
  text-align: center;
  margin: 0 0 6px;
  line-height: 1.25;
}
.wiz-sub {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 22px;
  line-height: 1.5;
}

.wiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.wiz-grid.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.wiz-card {
  background: var(--bg-soft);
  border: 2.5px solid var(--border-soft);
  border-radius: 16px;
  padding: 18px 14px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  font-family: inherit;
  font-size: 1rem;
}
.wiz-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.wiz-card.selected {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  border-color: var(--primary);
  box-shadow: var(--shadow);
}
.wiz-card .ico {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 6px;
  line-height: 1;
}
.wiz-card .lbl {
  font-weight: 800;
  color: var(--primary);
  display: block;
  margin-bottom: 2px;
  font-size: 1rem;
}
.wiz-card .desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-weight: 600;
  display: block;
  line-height: 1.4;
}

.wiz-actions {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 14px;
}
.wiz-btn {
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 800;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.18s;
  flex: 1;
}
.wiz-btn:hover { transform: translateY(-2px); }
.wiz-btn-skip {
  background: transparent;
  color: var(--text-muted);
  font-weight: 700;
}
.wiz-btn-back {
  background: var(--bg-soft);
  color: var(--text-secondary);
  border: 2px solid var(--border-soft);
}
.wiz-btn-next {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  box-shadow: 0 6px 16px rgba(249, 112, 86, 0.32);
}
.wiz-btn-next:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.wiz-finish {
  text-align: center;
  padding: 14px 0;
}
.wiz-finish .big {
  font-size: 3.5rem;
  margin-bottom: 8px;
}
.wiz-summary {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  border-radius: 14px;
  padding: 16px;
  margin: 16px 0;
  text-align: left;
}
.wiz-summary > div {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 0.92rem;
  font-weight: 700;
}
.wiz-summary > div + div { border-top: 1px solid rgba(255,255,255,0.4); }
.wiz-summary span:first-child { color: var(--text-secondary); }
.wiz-summary span:last-child { color: var(--primary); }

/* ===== Accessibility Toolbar (floating) ===== */
.a11y-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  cursor: pointer;
  font-size: 1.5rem;
  box-shadow: 0 8px 22px rgba(30, 58, 138, 0.32);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: transform 0.2s;
}
.a11y-toggle:hover { transform: scale(1.1); }
.a11y-toggle:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.a11y-panel {
  position: fixed;
  bottom: 88px;
  right: 20px;
  background: white;
  border-radius: 18px;
  padding: 20px;
  min-width: 280px;
  max-width: calc(100vw - 40px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  z-index: 9001;
  display: none;
  animation: a11yPop 0.25s ease;
  border: 2px solid var(--primary-light);
}
.a11y-panel.show { display: block; }
@keyframes a11yPop {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.a11y-panel h4 {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.a11y-row {
  margin-bottom: 14px;
}
.a11y-row label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 6px;
}
.a11y-segments {
  display: flex;
  gap: 4px;
  background: var(--bg-soft);
  padding: 4px;
  border-radius: 99px;
}
.a11y-segments button {
  flex: 1;
  padding: 8px 6px;
  border: none;
  background: transparent;
  border-radius: 99px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: inherit;
  transition: all 0.2s;
}
.a11y-segments button.active {
  background: var(--primary);
  color: white;
}
.a11y-panel .close-x {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--bg-soft);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  color: var(--text-muted);
}

/* ===== Body classes (applied based on a11y settings) ===== */
body.fz-large { font-size: 18px; }
body.fz-xlarge { font-size: 20px; }
body.fz-xlarge .vocab-eng { font-size: 1.4rem; }
body.fz-xlarge .example { font-size: 1.05rem; }

body.contrast-high {
  background: #fff !important;
}
body.contrast-high .card,
body.contrast-high .grammar-box,
body.contrast-high .vocab-card,
body.contrast-high .quiz-box {
  border: 2px solid #1f2937 !important;
}
body.contrast-high {
  --text: #000;
  --text-secondary: #1f2937;
  --primary: #0f172a;
  --secondary: #b91c1c;
}

/* ===== Profile filter helper ===== */
[data-profile] { display: block; }
body[data-active-profile="anak"] [data-profile]:not([data-profile*="anak"]):not([data-profile*="all"]) { display: none !important; }
body[data-active-profile="pelajar"] [data-profile]:not([data-profile*="pelajar"]):not([data-profile*="all"]) { display: none !important; }
body[data-active-profile="karyawan"] [data-profile]:not([data-profile*="karyawan"]):not([data-profile*="all"]) { display: none !important; }
body[data-active-profile="irt"] [data-profile]:not([data-profile*="irt"]):not([data-profile*="all"]) { display: none !important; }
body[data-active-profile="lansia"] [data-profile]:not([data-profile*="lansia"]):not([data-profile*="all"]) { display: none !important; }
body[data-active-profile="umum"] [data-profile]:not([data-profile*="umum"]):not([data-profile*="all"]) { display: none !important; }

/* ===== Profile Selector on Hero ===== */
.profile-picker {
  background: white;
  padding: 24px;
  border-radius: 20px;
  margin-top: 24px;
  box-shadow: var(--shadow);
  border: 2px dashed var(--primary-light);
}
.profile-picker h3 {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 1.15rem;
  text-align: center;
}
.profile-picker p {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin: 0 0 16px;
  font-weight: 600;
}
.profile-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.profile-chips button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 2px solid var(--border-soft);
  background: white;
  border-radius: 99px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text-secondary);
  font-family: inherit;
  transition: all 0.2s;
}
.profile-chips button:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}
.profile-chips button.active {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border-color: transparent;
}
.profile-chips button .e { font-size: 1.15rem; }

/* Highlight card "Untuk Siapa" sesuai profil aktif */
body[data-active-profile="anak"]     .card[data-pid="anak"],
body[data-active-profile="pelajar"]  .card[data-pid="pelajar"],
body[data-active-profile="karyawan"] .card[data-pid="karyawan"],
body[data-active-profile="irt"]      .card[data-pid="irt"],
body[data-active-profile="lansia"]   .card[data-pid="lansia"],
body[data-active-profile="umum"]     .card[data-pid="umum"] {
  border-color: var(--primary) !important;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light)) !important;
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* Active profile banner (sticky info) */
.profile-banner {
  background: linear-gradient(135deg, var(--primary-light), var(--secondary-light));
  padding: 10px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--primary);
  gap: 10px;
  flex-wrap: wrap;
}
.profile-banner button {
  background: white;
  border: 1.5px solid var(--primary);
  color: var(--primary);
  padding: 6px 12px;
  border-radius: 99px;
  font-weight: 800;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
}
.profile-banner button:hover { background: var(--primary); color: white; }

/* Hide on print */
@media print {
  .a11y-toggle, .a11y-panel, .wiz-overlay { display: none !important; }
}
