/**
 * LOMBA MHQ - Musabaqoh Hifdzil Quran
 * Stylesheet untuk Panitia/Juri - REVISI
 */

:root {
  --primary: #1a5f3f;
  --primary-dark: #0d3d27;
  --primary-light: #2d8a5e;
  --gold: #d4af37;
  --gold-light: #f4d03f;
  --bg-dark: #0a1f15;
  --bg-card: #112a1d;
  --text-light: #f5f5f5;
  --text-muted: #a0c4b0;
  --border: #1e4d35;
  --shadow: rgba(0, 0, 0, 0.4);
  --gradient-primary: linear-gradient(135deg, #1a5f3f 0%, #0d3d27 100%);
  --gradient-gold: linear-gradient(135deg, #d4af37 0%, #b8860b 100%);
  
  /* Accessibility Variables */
  --arab-font-size: 24px;
  --arab-font-family: 'Amiri', 'Traditional Arabic', serif;
  --arab-color: #d4af37;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-dark);
  color: var(--text-light);
  min-height: 100vh;
  background-image: 
    radial-gradient(ellipse at top, #1a3d2a 0%, transparent 50%),
    radial-gradient(ellipse at bottom, #0d2818 0%, transparent 50%);
  line-height: 1.6;
}

/* PASSWORD MODAL */
.password-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(10px);
}

.password-modal {
  background: var(--bg-card);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 450px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(212, 175, 55, 0.3);
}

.password-modal h2 {
  color: var(--gold);
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.password-modal p {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.password-modal .lock-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.password-input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.password-input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg-dark);
  color: var(--text-light);
  font-size: 1rem;
  text-align: center;
  letter-spacing: 2px;
}

.password-input:focus {
  outline: none;
  border-color: var(--gold);
}

.password-btn {
  padding: 0.75rem 1.5rem;
  background: var(--gradient-gold);
  color: var(--bg-dark);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s;
}

.password-btn:hover {
  transform: scale(1.05);
}

.password-error {
  color: #ff6b6b;
  font-size: 0.85rem;
  margin-top: 0.5rem;
  display: none;
}

.password-error.show {
  display: block;
}

/* ACCESSIBILITY PANEL */
.accessibility-panel {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-card);
  border: 1px solid var(--gold);
  border-radius: 12px;
  padding: 1rem;
  z-index: 1000;
  box-shadow: 0 10px 30px var(--shadow);
  display: none; /* Hidden by default, shown via JS */
  flex-direction: column;
  gap: 0.75rem;
  min-width: 200px;
  max-width: 280px;
}

.accessibility-panel.show {
  display: flex;
}

.accessibility-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--gradient-gold);
  color: var(--bg-dark);
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 1001;
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.accessibility-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
}

.accessibility-toggle.active {
  background: var(--bg-card);
  color: var(--gold);
  border: 2px solid var(--gold);
}

.accessibility-title {
  font-size: 0.75rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.25rem;
}

.accessibility-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.accessibility-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 60px;
}

.font-size-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

.font-size-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.font-size-btn:hover {
  background: var(--gold);
  color: var(--bg-dark);
}

.font-size-value {
  font-size: 0.85rem;
  color: var(--text-light);
  min-width: 40px;
  text-align: center;
}

.font-select, .color-select {
  flex: 1;
  padding: 0.4rem;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-light);
  font-size: 0.8rem;
  cursor: pointer;
}

.font-select:focus, .color-select:focus {
  outline: none;
  border-color: var(--gold);
}

/* RESET BUTTON */
.reset-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 0.5rem 1rem;
  background: rgba(255, 107, 107, 0.2);
  border: 1px solid #ff6b6b;
  color: #ff6b6b;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  z-index: 999;
  transition: all 0.2s;
}

.reset-btn:hover {
  background: #ff6b6b;
  color: white;
}

/* HEADER */
header {
  background: var(--gradient-primary);
  padding: 1.5rem 2rem;
  text-align: center;
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 4px 20px var(--shadow);
}

header h1 {
  font-size: 2rem;
  color: var(--gold-light);
  text-shadow: 2px 2px 4px var(--shadow);
  margin-bottom: 0.3rem;
}

header .subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  font-weight: 300;
}

/* MAIN CONTAINER */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* PAKET GRID */
.paket-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.paket-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  color: var(--text-light);
  position: relative;
  overflow: hidden;
}

.paket-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-gold);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.paket-card:hover {
  transform: translateY(-5px);
  border-color: var(--gold);
  box-shadow: 0 10px 30px rgba(212, 175, 55, 0.2);
}

.paket-card:hover::before {
  transform: scaleX(1);
}

.paket-card.used {
  background: #2a2a2a;
  border-color: #555;
  opacity: 0.7;
}

.paket-card.used::after {
  content: '✓';
  position: absolute;
  top: 5px;
  right: 8px;
  background: var(--gold);
  color: var(--bg-dark);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.paket-card.used .number,
.paket-card.used .label {
  color: #888;
}

.paket-card .number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gold);
  display: block;
  margin-bottom: 0.5rem;
}

.paket-card .label {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* BACK BUTTON */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--gradient-primary);
  color: var(--text-light);
  text-decoration: none;
  border-radius: 8px;
  border: 1px solid var(--gold);
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
  font-weight: 500;
}

.back-btn:hover {
  background: var(--primary-light);
  transform: translateX(-3px);
}

.back-btn svg {
  width: 18px;
  height: 18px;
}

/* SOAL CONTAINER */
.soal-container {
  background: var(--bg-card);
  border-radius: 16px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 10px 40px var(--shadow);
}

.paket-header {
  background: var(--gradient-primary);
  padding: 1.5rem 2rem;
  border-bottom: 2px solid var(--gold);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.paket-header h2 {
  color: var(--gold-light);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.paket-badge {
  background: var(--gold);
  color: var(--bg-dark);
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.9rem;
}

/* SOAL ITEM */
.soal-item {
  padding: 2rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.soal-item:last-child {
  border-bottom: none;
}

.soal-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--gradient-gold);
  color: var(--bg-dark);
  font-weight: 700;
  border-radius: 50%;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.soal-jenis {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  background: var(--primary);
  color: var(--text-light);
  border-radius: 15px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-left: 0.75rem;
  vertical-align: middle;
}

.soal-pertanyaan {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--text-light);
  line-height: 1.7;
}

/* AYAT BOX */
.ayat-box {
  background: rgba(26, 95, 63, 0.3);
  border: 2px solid var(--primary-light);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 1rem 0;
  font-family: var(--arab-font-family);
  font-size: var(--arab-font-size);
  text-align: right;
  line-height: 2;
  direction: rtl;
  color: var(--arab-color);
  transition: all 0.3s ease;
}

.referensi {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: 'Segoe UI', sans-serif;
  text-align: left;
  font-style: italic;
}

/* TOGGLE BUTTON */
.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--gradient-gold);
  color: var(--bg-dark);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 1rem;
}

.toggle-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(212, 175, 55, 0.4);
}

.toggle-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.3s ease;
}

.toggle-btn.active svg {
  transform: rotate(180deg);
}

/* KUNCI JAWABAN */
.kunci-jawaban {
  margin-top: 1rem;
  padding: 1.5rem;
  background: rgba(212, 175, 55, 0.1);
  border: 2px solid var(--gold);
  border-radius: 12px;
  display: none;
  animation: slideDown 0.3s ease;
}

.kunci-jawaban.show {
  display: block;
}

.kunci-label {
  font-size: 0.85rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
  display: block;
}

.kunci-text {
  font-size: 1rem;
  color: var(--text-light);
  line-height: 1.7;
  margin-bottom: 1rem;
}

.kunci-arab {
  font-family: var(--arab-font-family);
  font-size: var(--arab-font-size);
  color: var(--arab-color);
  text-align: right;
  direction: rtl;
  line-height: 2;
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 8px;
  margin-top: 0.5rem;
}

/* ANIMATIONS */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.soal-container {
  animation: fadeIn 0.5s ease;
}

/* FOOTER */
footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* RESPONSIVE */
@media (max-width: 768px) {
  header h1 {
    font-size: 1.5rem;
  }
  
  .paket-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
  }
  
  .paket-card {
    padding: 1rem;
  }
  
  .paket-card .number {
    font-size: 1.75rem;
  }
  
  main {
    padding: 1rem;
  }
  
  .soal-item {
    padding: 1.5rem 1rem;
  }
  
  .ayat-box, .kunci-arab {
    font-size: calc(var(--arab-font-size) * 0.8);
    padding: 1rem;
  }
  
  .paket-header {
    flex-direction: column;
    text-align: center;
  }
  
  /* Password modal responsive */
  .password-modal {
    padding: 1.5rem;
    max-width: 90%;
    width: 90%;
    margin: 1rem;
  }
  
  .password-modal h2 {
    font-size: 1.25rem;
  }
  
  .password-modal .lock-icon {
    font-size: 2rem;
  }
  
  .password-input-group {
    flex-direction: column;
    width: 100%;
  }
  
  .password-input {
    width: 100%;
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  .password-btn {
    width: 100%;
    padding: 0.75rem;
  }
  
  /* Accessibility panel responsive */
  .accessibility-panel {
    bottom: 80px;
    right: 10px;
    left: 10px;
    min-width: auto;
    max-width: none;
  }
  
  .accessibility-toggle {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }
  
  .reset-btn {
    top: 10px;
    right: 10px;
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    z-index: 998;
  }
}

/* PRINT STYLES */
@media print {
  body {
    background: white;
    color: black;
  }
  
  header {
    background: #1a5f3f !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  
  .toggle-btn,
  .accessibility-panel,
  .reset-btn,
  .password-overlay {
    display: none !important;
  }
  
  .kunci-jawaban {
    display: block !important;
    border: 1px solid #ccc;
    background: #f5f5f5;
  }
  
  .back-btn {
    display: none;
  }
  
  .ayat-box, .kunci-arab {
    color: #000 !important;
  }
}