/* ==========================================================================
   STYLE CSS — Aplikasi Latihan Ucap Tajwid BTQ
   Tema: Islamic Emerald, Royal Gold & Sand Luxury Glassmorphism
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Amiri:ital,wght@0,400;0,700;1,400;1,700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg-deep-1: #071F20;
  --bg-deep-2: #0E3638;
  --bg-deep-3: #154C4E;
  --surface: rgba(14, 54, 56, 0.75);
  --surface-card: rgba(244, 238, 221, 0.05);
  --surface-border: rgba(201, 163, 78, 0.25);
  --surface-hover: rgba(201, 163, 78, 0.12);

  --sand: #F4EEDD;
  --sand-dim: #D5CCA2;
  --sand-card: #FAF6EB;
  --ink: #102422;
  --ink-light: #1E3F3B;

  --gold: #C9A34E;
  --gold-light: #E7C97F;
  --gold-dark: #967429;

  --mad-color: #26799F;
  --tasydid-color: #C04326;
  --ghunnah-color: #10B981;
  --qalqalah-color: #D97706;

  --correct: #10B981;
  --wrong: #EF4444;
  --warn: #F59E0B;
  --info: #3B82F6;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-gold: 0 0 25px rgba(201, 163, 78, 0.22);

  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  background: 
    radial-gradient(circle at 10% 15%, rgba(201, 163, 78, 0.12), transparent 45%),
    radial-gradient(circle at 90% 85%, rgba(46, 121, 159, 0.15), transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(201, 163, 78, 0.05), transparent 70%),
    linear-gradient(150deg, var(--bg-deep-1) 0%, var(--bg-deep-2) 50%, #081B1C 100%);
  background-attachment: fixed;
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--sand);
  line-height: 1.6;
  padding: 16px 12px 60px;
  display: flex;
  justify-content: center;
}

.app-container {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
}

/* Header & Brand */
.header-brand {
  text-align: center;
  margin-bottom: 20px;
  position: relative;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(201, 163, 78, 0.15);
  border: 1px solid var(--gold);
  border-radius: 50px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gold-light);
  margin-bottom: 8px;
}

.app-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--sand);
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.app-title span {
  color: var(--gold);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-desc {
  font-size: 13px;
  color: var(--sand-dim);
  max-width: 440px;
  margin: 0 auto 16px;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  background: rgba(10, 31, 32, 0.7);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 4px;
  gap: 4px;
  margin-bottom: 20px;
  backdrop-filter: blur(12px);
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  flex: 1;
  min-width: 80px;
  padding: 9px 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--sand-dim);
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tab-btn:hover {
  color: var(--sand);
  background: var(--surface-hover);
}

.tab-btn.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(201, 163, 78, 0.3);
}

/* Status / Notice Box */
.notice-box {
  background: rgba(201, 163, 78, 0.08);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--sand-dim);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  line-height: 1.5;
}

.notice-box.warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
  color: #FDE68A;
}

.notice-box.success {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
  color: #A7F3D0;
}

.notice-icon {
  font-size: 18px;
  flex-shrink: 0;
}

/* Category Filter Bar */
.filter-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.chip-btn {
  padding: 6px 12px;
  background: rgba(244, 238, 221, 0.06);
  border: 1px solid rgba(201, 163, 78, 0.25);
  border-radius: 50px;
  color: var(--sand-dim);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: var(--transition);
}

.chip-btn:hover, .chip-btn.active {
  background: var(--gold);
  color: var(--ink);
  border-color: var(--gold);
}

/* Beads / Progress */
.beads-wrapper {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.bead-item {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(244, 238, 221, 0.12);
  border: 1.5px solid rgba(201, 163, 78, 0.35);
  transition: var(--transition);
}

.bead-item.current {
  background: var(--gold);
  border-color: #fff;
  transform: scale(1.3);
  box-shadow: 0 0 10px var(--gold);
}

.bead-item.correct {
  background: var(--correct);
  border-color: var(--correct);
}

.bead-item.retry {
  background: var(--warn);
  border-color: var(--warn);
}

/* Scorebar */
.score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  color: var(--sand-dim);
  padding: 0 6px;
  margin-bottom: 12px;
}

.score-highlight {
  color: var(--gold-light);
  font-weight: 700;
}

/* Islamic Arch Word Card */
.arch-card-wrapper {
  position: relative;
  filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.35));
  margin-bottom: 16px;
}

.arch-dome {
  width: 100%;
  height: 48px;
  background: var(--sand-card);
  border: 3px solid var(--gold);
  border-bottom: none;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  position: relative;
}

.arch-dome::after {
  content: "✦";
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--gold-dark);
  font-size: 14px;
}

.arch-content {
  width: 100%;
  background: var(--sand-card);
  border: 3px solid var(--gold);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 10px 20px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.arabic-display {
  font-family: 'Amiri', serif;
  font-size: clamp(2.4rem, 10vw, 3.6rem);
  font-weight: 700;
  color: var(--ink);
  direction: rtl;
  line-height: 1.4;
  margin-bottom: 6px;
  user-select: none;
}

/* Highlight Tajwid Rules */
.hl-mad {
  color: var(--mad-color);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

.hl-tasydid {
  color: var(--tasydid-color);
  text-decoration: underline;
  text-decoration-thickness: 3px;
  text-underline-offset: 6px;
}

.word-latin {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-light);
  margin-bottom: 2px;
}

.word-meaning {
  font-size: 13px;
  color: var(--gold-dark);
  font-style: italic;
  margin-bottom: 10px;
}

.surah-tag {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  color: #64748B;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.tajwid-tip {
  font-size: 12px;
  color: #334155;
  background: rgba(201, 163, 78, 0.15);
  border-left: 3px solid var(--gold);
  padding: 8px 12px;
  border-radius: 6px;
  text-align: left;
  line-height: 1.5;
  width: 100%;
}

/* Action Controls */
.action-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.btn-action {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--sand);
  background: rgba(244, 238, 221, 0.07);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-action:hover:not(:disabled) {
  background: rgba(201, 163, 78, 0.2);
  border-color: var(--gold);
  transform: translateY(-2px);
}

.btn-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-action.btn-record.recording {
  background: var(--wrong);
  border-color: var(--wrong);
  color: #fff;
  animation: pulse-red 1.2s infinite;
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* User Voice Replay Button */
.user-playback-btn {
  grid-column: span 2;
  background: rgba(46, 121, 159, 0.15);
  border: 1px dashed rgba(46, 121, 159, 0.6);
  color: #7DD3FC;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--transition);
}

.user-playback-btn.show {
  display: flex;
}

.user-playback-btn:hover {
  background: rgba(46, 121, 159, 0.3);
}

/* Transcript & Verdict Feedback */
.transcript-card {
  background: rgba(10, 31, 32, 0.65);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 12px;
  display: none;
  text-align: center;
}

.transcript-card.show {
  display: block;
}

.transcript-label {
  font-size: 11px;
  color: var(--sand-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.transcript-arabic {
  font-family: 'Amiri', serif;
  font-size: 22px;
  color: var(--gold-light);
  direction: rtl;
  margin-bottom: 6px;
}

.verdict-badge {
  font-size: 12.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 50px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.verdict-badge.good {
  background: rgba(16, 185, 129, 0.2);
  color: #6EE7B7;
  border: 1px solid var(--correct);
}

.verdict-badge.mid {
  background: rgba(245, 158, 11, 0.2);
  color: #FCD34D;
  border: 1px solid var(--warn);
}

.verdict-badge.bad {
  background: rgba(239, 68, 68, 0.2);
  color: #FCA5A5;
  border: 1px solid var(--wrong);
}

/* Self Check Evaluation */
.selfcheck-section {
  background: rgba(244, 238, 221, 0.05);
  border: 1px solid var(--surface-border);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
  display: none;
}

.selfcheck-section.show {
  display: block;
}

.selfcheck-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.check-item {
  margin-bottom: 10px;
}

.check-item:last-child {
  margin-bottom: 0;
}

.check-q {
  font-size: 12.5px;
  color: var(--sand);
  margin-bottom: 6px;
  display: block;
}

.yn-btn-group {
  display: flex;
  gap: 8px;
}

.yn-option {
  flex: 1;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 8px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(201, 163, 78, 0.3);
  background: transparent;
  color: var(--sand-dim);
  cursor: pointer;
  transition: var(--transition);
}

.yn-option:hover {
  border-color: var(--gold);
  background: var(--surface-hover);
}

.yn-option.picked-yes {
  background: var(--correct);
  border-color: var(--correct);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.yn-option.picked-no {
  background: var(--wrong);
  border-color: var(--wrong);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

/* Navigation Button (Next) */
.btn-primary-next {
  width: 100%;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: var(--ink);
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  border: none;
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(201, 163, 78, 0.35);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
}

.btn-primary-next.show {
  display: flex;
}

.btn-primary-next:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(201, 163, 78, 0.45);
}

/* End Round / Certificate Card */
.end-card {
  background: rgba(14, 54, 56, 0.85);
  border: 2px solid var(--gold);
  border-radius: var(--radius-xl);
  padding: 30px 20px;
  text-align: center;
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-gold);
  display: none;
}

.end-card.show {
  display: block;
  animation: fadeIn 0.4s ease-out;
}

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

.end-badge-icon {
  font-size: 52px;
  margin-bottom: 8px;
}

.end-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--gold-light);
  margin-bottom: 4px;
}

.final-score-val {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 56px;
  font-weight: 800;
  color: var(--sand);
  line-height: 1.1;
  margin: 10px 0;
  text-shadow: 0 0 20px rgba(201, 163, 78, 0.4);
}

.score-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.stat-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
}

.stat-box .val {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
}

.stat-box .lbl {
  font-size: 10.5px;
  color: var(--sand-dim);
}

.save-score-form {
  margin: 20px 0 16px;
  display: flex;
  gap: 8px;
}

.input-name {
  flex: 1;
  padding: 12px 14px;
  background: rgba(244, 238, 221, 0.08);
  border: 1.5px solid var(--surface-border);
  border-radius: var(--radius-md);
  color: var(--sand);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  outline: none;
}

.input-name:focus {
  border-color: var(--gold);
  background: rgba(244, 238, 221, 0.12);
}

.btn-save-score {
  padding: 12px 18px;
  background: var(--correct);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.btn-save-score:hover {
  background: #059669;
}

/* Material / Teori View */
.materi-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.materi-card {
  background: rgba(14, 54, 56, 0.65);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: var(--transition);
}

.materi-card:hover {
  border-color: var(--gold);
  background: rgba(14, 54, 56, 0.85);
}

.materi-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.materi-desc {
  font-size: 13px;
  color: var(--sand-dim);
  line-height: 1.6;
  margin-bottom: 10px;
}

.materi-examples {
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: 'Amiri', serif;
  font-size: 20px;
  color: var(--sand);
  direction: rtl;
  text-align: center;
}

/* Leaderboard View */
.leaderboard-table-card {
  background: rgba(14, 54, 56, 0.7);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lb-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--sand-dim);
  border-bottom: 1px solid var(--surface-border);
}

.lb-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(201, 163, 78, 0.1);
}

.lb-rank {
  font-weight: 800;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--gold);
  width: 36px;
}

.lb-rank-1 { color: #F59E0B; }
.lb-rank-2 { color: #94A3B8; }
.lb-rank-3 { color: #D97706; }

.lb-name {
  font-weight: 600;
  color: var(--sand);
}

.lb-score {
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--gold-light);
  text-align: right;
}

/* Admin / Manage Words Modal & View */
.admin-card {
  background: rgba(14, 54, 56, 0.75);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.form-group {
  margin-bottom: 12px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--sand-dim);
  margin-bottom: 4px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  background: rgba(244, 238, 221, 0.08);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  color: var(--sand);
  font-family: inherit;
  font-size: 13px;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
}

.form-control.arabic-input {
  font-family: 'Amiri', serif;
  font-size: 20px;
  direction: rtl;
}

.admin-words-list {
  max-height: 280px;
  overflow-y: auto;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-word-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(201, 163, 78, 0.15);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
}

.btn-del {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid var(--wrong);
  color: #FCA5A5;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 11px;
  cursor: pointer;
}

/* Legend & Footer */
.tajwid-legend {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 11.5px;
  color: var(--sand-dim);
  margin-top: 20px;
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

/* Modal Window */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background: #0D3335;
  border: 2px solid var(--gold);
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 100%;
  padding: 20px;
  box-shadow: var(--shadow-md);
  max-height: 90vh;
  overflow-y: auto;
}
