/* =============================================
   Kuiz Ihya Ramadan – Ramadan Theme
   Teal + Gold, mobile-first, CSS clamp()
   ============================================= */

:root {
  --teal:        #0d7e7e;
  --teal-dark:   #095e5e;
  --teal-light:  #e0f5f5;
  --gold:        #c9a227;
  --gold-light:  #f5e6a3;
  --white:       #ffffff;
  --text:        #1a2e2e;
  --text-light:  #4a6e6e;
  --bg:          #f0fafa;
  --card-bg:     #ffffff;
  --error:       #c0392b;
  --success:     #27ae60;
  --radius:      12px;
  --shadow:      0 4px 20px rgba(13,126,126,0.15);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── BACKGROUND DECORATION ───────────────────── */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(13,126,126,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 10%, rgba(201,162,39,0.08) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── SCREEN WRAPPER ──────────────────────────── */
.screen {
  width: 100%;
  max-width: 600px;
  padding: clamp(16px, 4vw, 32px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(16px, 3vw, 24px);
}

/* ── HEADER ──────────────────────────────────── */
.header {
  text-align: center;
  width: 100%;
}

.header-mosque {
  font-size: clamp(48px, 12vw, 80px);
  line-height: 1;
  margin-bottom: 4px;
}

.header-title {
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 700;
  color: var(--teal);
  letter-spacing: 0.5px;
}

.header-sub {
  font-size: clamp(12px, 3vw, 15px);
  color: var(--text-light);
  margin-top: 4px;
}

.bismillah {
  font-family: 'Traditional Arabic', 'Scheherazade New', serif;
  font-size: clamp(14px, 3.5vw, 18px);
  color: var(--gold);
  direction: rtl;
  letter-spacing: 1px;
  text-align: center;
}

/* ── CARD ────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 5vw, 32px);
  width: 100%;
}

/* ── FORM ELEMENTS ───────────────────────────── */
label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

select, input[type="text"], input[type="password"],
input[type="datetime-local"] {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #d0e8e8;
  border-radius: 8px;
  font-size: clamp(14px, 3.5vw, 16px);
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color 0.2s;
  appearance: none;
  -webkit-appearance: none;
}

select:focus, input:focus {
  border-color: var(--teal);
}

/* ── BUTTONS ──────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: clamp(12px, 3vw, 16px);
  border: none;
  border-radius: 8px;
  font-size: clamp(14px, 4vw, 17px);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  text-align: center;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: var(--white);
  box-shadow: 0 4px 12px rgba(13,126,126,0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 18px rgba(13,126,126,0.4);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #a07a18);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(201,162,39,0.3);
}

.btn-danger {
  background: var(--error);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--teal);
  color: var(--teal);
}

/* ── COUNTDOWN ────────────────────────────────── */
.countdown-box {
  text-align: center;
  background: var(--teal-light);
  border-radius: var(--radius);
  padding: clamp(16px, 4vw, 24px);
  width: 100%;
}

.countdown-label {
  font-size: 13px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.countdown-time {
  font-size: clamp(28px, 8vw, 48px);
  font-weight: 800;
  color: var(--teal);
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.status-waiting { background: #fff3cd; color: #856404; }
.status-active  { background: #d4edda; color: #155724; }
.status-ended   { background: #f8d7da; color: #721c24; }

/* ── SYARAT PANEL ─────────────────────────────── */
.syarat-panel {
  background: var(--teal-light);
  border-left: 4px solid var(--teal);
  border-radius: 0 8px 8px 0;
  padding: 16px;
  font-size: clamp(12px, 3vw, 14px);
  color: var(--text);
}

.syarat-panel h3 {
  color: var(--teal);
  margin-bottom: 8px;
  font-size: clamp(13px, 3.5vw, 15px);
}

.syarat-panel ol {
  padding-left: 20px;
}

.syarat-panel li {
  margin-bottom: 4px;
  line-height: 1.5;
}

/* ── QUIZ SCREEN ──────────────────────────────── */
.quiz-header {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: var(--white);
  border-radius: var(--radius);
  padding: clamp(12px, 3vw, 20px);
  text-align: center;
  width: 100%;
}

.quiz-header .bismillah {
  color: var(--gold-light);
  font-size: clamp(13px, 3vw, 16px);
}

.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.3);
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.question-counter {
  font-size: clamp(11px, 2.5vw, 13px);
  opacity: 0.85;
  margin-top: 6px;
}

.question-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 5vw, 28px);
  width: 100%;
}

.question-text {
  font-size: clamp(15px, 4vw, 18px);
  font-weight: 600;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 16px;
}

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

.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  background: var(--white);
  border: 2px solid #d0e8e8;
  border-radius: 8px;
  font-size: clamp(13px, 3.5vw, 15px);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, background 0.2s;
}

.option-btn:hover {
  border-color: var(--teal);
  background: var(--teal-light);
}

.option-btn.selected {
  border-color: var(--teal);
  background: var(--teal-light);
  font-weight: 600;
}

.option-letter {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--teal-light);
  color: var(--teal);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.option-btn.selected .option-letter {
  background: var(--teal);
  color: var(--white);
}

.nav-btns {
  display: flex;
  gap: 12px;
  width: 100%;
}

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

/* ── TOUCH TO START ───────────────────────────── */
.touch-screen {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: clamp(32px, 8vw, 64px) clamp(16px, 4vw, 32px);
}

.touch-icon {
  font-size: clamp(60px, 15vw, 96px);
}

/* ── THANKYOU SCREEN ──────────────────────────── */
.thankyou-screen {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: clamp(32px, 8vw, 64px) clamp(16px, 4vw, 32px);
}

.thankyou-icon {
  font-size: clamp(60px, 15vw, 96px);
}

.thankyou-title {
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 800;
  color: var(--teal);
}

.thankyou-sub {
  font-size: clamp(14px, 3.5vw, 16px);
  color: var(--text-light);
  max-width: 360px;
  line-height: 1.6;
}

/* ── STARS ────────────────────────────────────── */
.stars {
  display: flex;
  justify-content: center;
  gap: 6px;
  font-size: clamp(18px, 5vw, 24px);
  color: var(--gold);
  letter-spacing: 4px;
}

/* ── ERROR MESSAGE ────────────────────────────── */
.error-msg {
  background: #fff0f0;
  border: 1px solid #f5c6c6;
  color: var(--error);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  text-align: center;
  width: 100%;
}

/* ── LOADING ──────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-light);
  font-size: 14px;
  padding: 32px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 3px solid var(--teal-light);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ── ADMIN SPECIFIC ───────────────────────────── */
.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(12px, 2.5vw, 14px);
}

th {
  background: var(--teal);
  color: var(--white);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #e8f4f4;
}

tr:nth-child(even) td { background: var(--teal-light); }
tr:first-child td { font-weight: 700; color: var(--teal); }

.rank-gold   { color: #c9a227; font-weight: 800; }
.rank-silver { color: #808080; font-weight: 700; }
.rank-bronze { color: #cd7f32; font-weight: 700; }

/* ── UTILITY ──────────────────────────────────── */
.text-center  { text-align: center; }
.text-muted   { color: var(--text-light); font-size: 13px; }
.mt-sm        { margin-top: 8px; }
.mt-md        { margin-top: 16px; }
.hidden       { display: none !important; }

/* ── SCROLLBAR ────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--teal); border-radius: 3px; }
