/* -------------------------------------------------------------
   Anwaar al-Qur'an Stylesheet - Elegant, Modern Spiritual Theme
   ------------------------------------------------------------- */

/* --- CSS Variables & Design Tokens --- */
:root {
  --font-arabic: 'Amiri', 'Scheherazade New', serif;
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Theme Colors (Default Dark) */
  --bg-app: #070b13;
  --bg-gradient: linear-gradient(135deg, #070b13 0%, #0d1527 100%);
  --panel-bg: rgba(18, 29, 51, 0.45);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-shadow: rgba(0, 0, 0, 0.4);
  
  --text-primary: #f0f4f9;
  --text-secondary: #a0aec0;
  --text-muted: #6b7280;

  --accent-gold: #dfb15b;
  --accent-gold-hover: #f5d085;
  --accent-gold-glow: rgba(223, 177, 91, 0.35);
  
  --accent-teal: #00f5d4;
  --accent-teal-glow: rgba(0, 245, 212, 0.2);
  --accent-purple: #9d4edd;
  
  --feedback-correct: #10b981;
  --feedback-correct-bg: rgba(16, 185, 129, 0.15);
  --feedback-correct-border: rgba(16, 185, 129, 0.3);
  
  --feedback-error: #ef4444;
  --feedback-error-bg: rgba(239, 68, 68, 0.15);
  --feedback-error-border: rgba(239, 68, 68, 0.3);
  
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s ease;
}

/* --- Light Mode Tokens --- */
[data-theme="light"] {
  --bg-app: #f7f5f0;
  --bg-gradient: linear-gradient(135deg, #f7f5f0 0%, #edeae0 100%);
  --panel-bg: rgba(255, 255, 255, 0.7);
  --panel-border: rgba(139, 94, 26, 0.12);
  --panel-shadow: rgba(139, 94, 26, 0.08);
  
  --text-primary: #2d3748;
  --text-secondary: #4a5568;
  --text-muted: #718096;

  --accent-gold: #b7872c;
  --accent-gold-hover: #9c6e1c;
  --accent-gold-glow: rgba(183, 135, 44, 0.2);
  
  --accent-teal: #0d9488;
  --accent-teal-glow: rgba(13, 148, 136, 0.15);
  --accent-purple: #7c3aed;

  --feedback-correct-bg: rgba(16, 185, 129, 0.1);
  --feedback-error-bg: rgba(239, 68, 68, 0.1);
}

/* --- Base Resets & Global Styles --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-gold) rgba(0, 0, 0, 0.1);
}

body {
  font-family: var(--font-body);
  background: var(--bg-app);
  background-image: var(--bg-gradient);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Webkit Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}
::-webkit-scrollbar-thumb {
  background: var(--accent-gold);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-gold-hover);
}

/* --- Background Orbs (Decorative) --- */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.18;
  transition: var(--transition-smooth);
}
.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--accent-gold);
  top: -100px;
  right: -50px;
}
.orb-2 {
  width: 500px;
  height: 500px;
  background: var(--accent-purple);
  bottom: 10% ;
  left: -200px;
}
.orb-3 {
  width: 350px;
  height: 350px;
  background: var(--accent-teal);
  top: 40%;
  right: 15%;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* --- Layout Elements & Glassmorphism --- */
.glass-card {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px 0 var(--panel-shadow);
  transition: var(--transition-smooth);
}
.glass-card:hover {
  border-color: rgba(223, 177, 91, 0.2);
}

/* --- Header Styling --- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: rgba(7, 11, 19, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--panel-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}
.logo-text {
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.gold-glow {
  color: var(--accent-gold);
  filter: drop-shadow(0 0 8px var(--accent-gold-glow));
}

.verse-selector-nav {
  display: flex;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: 30px;
  border: 1px solid var(--panel-border);
}

.verse-nav-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  padding: 8px 18px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
  transition: var(--transition-smooth);
}
.verse-nav-btn .v-num {
  font-size: 0.75rem;
  opacity: 0.7;
}
.verse-nav-btn .v-name {
  font-size: 0.9rem;
  font-weight: 600;
}
.verse-nav-btn:hover {
  color: var(--text-primary);
}
.verse-nav-btn.active {
  background: var(--accent-gold);
  color: #070b13 !important;
  box-shadow: 0 4px 15px var(--accent-gold-glow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Progress Ring */
.global-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}
.progress-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}
.progress-ring-container {
  position: relative;
  width: 40px;
  height: 40px;
}
.progress-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-heading);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
}
.progress-ring-circle {
  transition: stroke-dashoffset 0.35s;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: var(--transition-fast);
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-gold);
  transform: translateY(-2px);
}

/* --- Hero Section --- */
.hero-section {
  text-align: center;
  padding: 3rem 1.5rem 1.5rem 1.5rem;
}
.hero-title {
  font-size: 2.25rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #ffffff 40%, var(--accent-gold) 120%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme="light"] .hero-title {
  background: linear-gradient(135deg, #111827 40%, var(--accent-gold) 120%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.6;
}

/* --- Main Layout Grid --- */
.main-container {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem 2rem 4rem 2rem;
  flex-grow: 1;
}

.left-pane, .right-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* --- Verse Display Card (Left Pane) --- */
.verse-display-card {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  height: 100%;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 1.25rem;
}
.surah-badge {
  background: rgba(223, 177, 91, 0.12);
  color: var(--accent-gold);
  border: 1px solid rgba(223, 177, 91, 0.25);
  padding: 6px 14px;
  border-radius: 30px;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.verse-reference {
  font-family: var(--font-heading);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
  margin-left: 0.75rem;
}

/* Audio Cluster */
.audio-control-cluster {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.custom-select {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 20px;
  outline: none;
  cursor: pointer;
}
.play-btn {
  background: var(--accent-gold);
  border: none;
  color: #070b13;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-gold-glow);
  transition: var(--transition-smooth);
}
.play-btn:hover {
  background: var(--accent-gold-hover);
  transform: scale(1.08);
}
.play-btn.playing {
  animation: pulse-gold 1.5s infinite alternate;
}

/* Arabic Text Rendering */
.arabic-display-container {
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  padding: 2.5rem 2rem;
  border: 1px dashed rgba(255, 255, 255, 0.05);
  min-height: 220px;
  display: grid;
  align-items: center;
}
.arabic-text {
  font-family: var(--font-arabic);
  font-size: 2.3rem;
  line-height: 2.6;
  text-align: justify;
  text-align-last: center;
  direction: rtl;
  word-wrap: break-word;
  white-space: normal;
}

/* Interactive Word tokens */
.q-word {
  display: inline-block;
  padding: 2px 6px;
  margin: 0 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition-fast);
  position: relative;
  user-select: none;
}
.q-word:hover {
  background: rgba(223, 177, 91, 0.1);
  border-color: rgba(223, 177, 91, 0.25);
  color: var(--accent-gold);
  transform: translateY(-1px);
}
.q-word.active-word {
  background: rgba(223, 177, 91, 0.18) !important;
  border-color: var(--accent-gold) !important;
  color: var(--accent-gold) !important;
  box-shadow: 0 2px 8px var(--accent-gold-glow);
}

/* Hider Active Recall State */
.q-word.hidden-word {
  color: transparent !important;
  text-shadow: none !important;
  background: linear-gradient(135deg, rgba(223, 177, 91, 0.2) 0%, rgba(139, 94, 26, 0.4) 100%) !important;
  border: 1.5px solid var(--accent-gold) !important;
  box-shadow: inset 0 0 10px rgba(223, 177, 91, 0.15) !important;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  min-width: 60px;
  height: 2.4rem;
  top: 10px;
}
.q-word.hidden-word::after {
  content: '\f070'; /* FontAwesome eye-slash icon */
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: var(--accent-gold);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.9rem;
  opacity: 0.65;
}
.q-word.hidden-word:hover::after {
  opacity: 1;
}

/* Translation */
.translation-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.translation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.translation-header h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.translation-mode-tag {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--panel-border);
  padding: 2px 8px;
  border-radius: 10px;
}
.english-translation {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
  font-weight: 400;
  border-left: 3px solid var(--accent-gold);
  padding-left: 1.25rem;
}

/* Virtue/Context Box */
.virtue-card {
  display: flex;
  gap: 1rem;
  background: rgba(0, 245, 212, 0.04);
  border: 1px solid rgba(0, 245, 212, 0.08);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}
.virtue-icon {
  color: var(--accent-teal);
  font-size: 1.3rem;
  margin-top: 2px;
}
.virtue-content h4 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}
.virtue-content p {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* --- Tabs & Right Pane Container --- */
.tabs-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.tabs-header {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--panel-border);
}
.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 1.25rem 0.5rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}
.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}
.tab-btn.active {
  color: var(--accent-gold);
  border-bottom-color: var(--accent-gold);
}

/* Tab Panels */
.tab-panel {
  display: none;
  padding: 2rem;
  flex-grow: 1;
  overflow-y: auto;
  max-height: 700px;
}
.tab-panel.active {
  display: flex;
  flex-direction: column;
  animation: fade-in-up 0.4s ease-out;
}

/* --- Tab 1: Grammar Explorer Layout --- */
.grammar-instruction-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
  color: var(--text-secondary);
  padding: 4rem 1rem;
}
.instruction-animation {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(223, 177, 91, 0.1);
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  color: var(--accent-gold);
  border: 1px dashed var(--accent-gold);
}
.bounce-anim {
  animation: bounce-loop 2s infinite;
}

.grammar-detail-state {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.word-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
}
.word-arabic-tag {
  font-family: var(--font-arabic);
  font-size: 2.2rem;
  color: var(--accent-gold);
}
.word-pronounce-tag {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-right: auto;
  margin-left: 1.5rem;
}
.close-detail-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition-fast);
}
.close-detail-btn:hover {
  color: var(--text-primary);
}

.word-meaning-box {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.label {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.word-meaning-box .meaning {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
}

.breakdown-sections {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.breakdown-card {
  display: flex;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  align-items: flex-start;
}
.breakdown-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.breakdown-icon.gold {
  background: rgba(223, 177, 91, 0.1);
  color: var(--accent-gold);
}
.breakdown-icon.teal {
  background: rgba(0, 245, 212, 0.1);
  color: var(--accent-teal);
}
.breakdown-icon.purple {
  background: rgba(157, 78, 221, 0.1);
  color: var(--accent-purple);
}

.breakdown-info h4 {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}
.root-details {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.root-letters {
  background: rgba(223, 177, 91, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(223, 177, 91, 0.3);
  padding: 4px 12px;
  border-radius: 6px;
  font-family: var(--font-arabic);
  font-size: 1.4rem;
  font-weight: 700;
}
.root-meaning {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.4;
  flex: 1;
  min-width: 180px;
}
.sarf-classification {
  display: flex;
  gap: 0.5rem;
}
.tag {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  border: 1px solid var(--panel-border);
}
.nahw-desc, .gem-desc {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Unique look for literary gem */
.gem-card {
  background: linear-gradient(135deg, rgba(157, 78, 221, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
  border-color: rgba(157, 78, 221, 0.15);
}

/* --- Tab 2: Mutation Sandbox Layout --- */
.whatif-header {
  margin-bottom: 1.5rem;
}
.whatif-header h3 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}
.whatif-header p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.sandbox-cases-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.case-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition-smooth);
}
.case-card:hover {
  background: rgba(223, 177, 91, 0.03);
  border-color: rgba(223, 177, 91, 0.3);
  transform: translateY(-2px);
}
.case-phrase-arabic {
  font-family: var(--font-arabic);
  font-size: 1.8rem;
  color: var(--text-primary);
  direction: rtl;
}
.case-description-eng {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.case-description-eng h4 {
  font-size: 0.95rem;
  color: var(--accent-gold);
}
.case-description-eng p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Simulation panel details */
.sandbox-simulator {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.5rem;
  animation: fade-in-up 0.4s ease-out;
}
.sim-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.75rem;
}
.sim-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent-gold);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sim-display {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--panel-border);
}
.sim-display-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
}
.sim-display-block .sim-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}
.arabic-script-sim {
  font-family: var(--font-arabic);
  font-size: 2.1rem;
  line-height: 1.4;
  color: var(--text-primary);
}
.sim-translation-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
}
.sim-arrow {
  font-size: 1.5rem;
  color: var(--accent-gold);
}

.sim-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.options-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.options-btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.mutation-toggle-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: 20px;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}
.mutation-toggle-btn:hover {
  border-color: rgba(223, 177, 91, 0.3);
  background: rgba(223, 177, 91, 0.05);
}
.mutation-toggle-btn.active {
  background: var(--accent-gold);
  color: #070b13;
  border-color: var(--accent-gold);
  box-shadow: 0 2px 8px var(--accent-gold-glow);
}

.sim-explanation-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.alert-box {
  padding: 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.alert-box h4 {
  font-size: 0.95rem;
  font-weight: 700;
}
.alert-box p {
  font-size: 0.9rem;
  line-height: 1.5;
}
.info-box {
  background: rgba(223, 177, 91, 0.05);
  border: 1px solid rgba(223, 177, 91, 0.15);
  color: var(--text-primary);
}
.info-box h4 {
  color: var(--accent-gold);
}
.danger-box {
  background: var(--feedback-error-bg);
  border: 1px solid var(--feedback-error-border);
  color: var(--text-primary);
}
.danger-box h4 {
  color: var(--feedback-error);
}

/* --- Tab 3: Memorization Suite Layout --- */
.hifz-modes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.hifz-modes-header h3 {
  font-size: 1.2rem;
}
.hifz-selector-tabs {
  display: flex;
  background: rgba(0, 0, 0, 0.15);
  padding: 3px;
  border-radius: 20px;
  border: 1px solid var(--panel-border);
}
.hifz-mode-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 16px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.hifz-mode-btn.active {
  background: var(--accent-gold);
  color: #070b13;
}

.hifz-practice-area {
  display: none;
  animation: fade-in-up 0.3s ease-out;
}
.hifz-practice-area.active {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.hifz-instructions {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.hifz-instructions p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.hifz-actions {
  display: flex;
  gap: 0.75rem;
}
.action-btn {
  background: var(--accent-gold);
  color: #070b13;
  border: none;
  padding: 10px 18px;
  border-radius: 30px;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-fast);
}
.action-btn:hover {
  background: var(--accent-gold-hover);
  transform: translateY(-1px);
}
.action-btn.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
}
.action-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Phrase Rebuilder Game */
.rebuild-arena {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.rebuild-board-outer {
  background: rgba(0, 0, 0, 0.2);
  border: 2px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  min-height: 120px;
}
.board-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: block;
}
.rebuild-board, .rebuild-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  direction: rtl;
  min-height: 60px;
  align-content: flex-start;
}
.rebuild-chunk {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  padding: 6px 14px;
  border-radius: 20px;
  font-family: var(--font-arabic);
  font-size: 1.4rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}
.rebuild-chunk:hover {
  border-color: var(--accent-gold);
  background: rgba(223, 177, 91, 0.08);
  transform: scale(1.02);
}
.rebuild-board .rebuild-chunk {
  background: rgba(223, 177, 91, 0.1);
  border-color: rgba(223, 177, 91, 0.3);
}

.rebuild-controls {
  display: flex;
  gap: 0.75rem;
}
.check-btn {
  background: var(--accent-teal);
  color: #070b13;
}
.check-btn:hover {
  background: #00e0c2;
}

.rebuild-feedback {
  font-size: 0.95rem;
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 8px;
  text-align: center;
  display: none;
}
.rebuild-feedback.correct {
  display: block;
  background: var(--feedback-correct-bg);
  border: 1px solid var(--feedback-correct-border);
  color: var(--feedback-correct);
}
.rebuild-feedback.error {
  display: block;
  background: var(--feedback-error-bg);
  border: 1px solid var(--feedback-error-border);
  color: var(--feedback-error);
}

/* Interactive Vowel Quiz */
.quiz-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
.quiz-progress-bar {
  background: rgba(255, 255, 255, 0.05);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
}
.quiz-progress-fill {
  background: var(--accent-gold);
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

.quiz-question-box {
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.quiz-q-num {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-gold);
  text-transform: uppercase;
}
.quiz-text-arabic {
  font-family: var(--font-arabic);
  font-size: 2.1rem;
  line-height: 1.5;
  color: var(--text-primary);
}
.quiz-blank {
  color: var(--accent-gold);
  font-weight: 700;
  border-bottom: 2px dashed var(--accent-gold);
  padding: 0 10px;
}
.quiz-question-prompt {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.quiz-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.quiz-option-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  padding: 1rem;
  border-radius: var(--radius-md);
  font-family: var(--font-arabic);
  font-size: 1.6rem;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.quiz-option-btn span.translit {
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.quiz-option-btn:hover {
  background: rgba(223, 177, 91, 0.05);
  border-color: rgba(223, 177, 91, 0.3);
  transform: scale(1.01);
}
.quiz-option-btn.selected-correct {
  background: var(--feedback-correct-bg) !important;
  border-color: var(--feedback-correct) !important;
  color: var(--feedback-correct) !important;
}
.quiz-option-btn.selected-incorrect {
  background: var(--feedback-error-bg) !important;
  border-color: var(--feedback-error) !important;
  color: var(--feedback-error) !important;
}

.quiz-feedback-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.quiz-feedback-box.hidden {
  display: none;
}
.feedback-icon {
  font-size: 2rem;
}
.quiz-feedback-box.correct .feedback-icon {
  color: var(--feedback-correct);
}
.quiz-feedback-box.incorrect .feedback-icon {
  color: var(--feedback-error);
}
.feedback-text {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
}
.feedback-explanation {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 400px;
  margin-bottom: 0.5rem;
}

/* Hifz Self Progress Rating */
.hifz-rating-box {
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid var(--panel-border);
  padding: 1.5rem 0 0 0;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.hifz-rating-box h4 {
  font-size: 1rem;
  color: var(--text-primary);
}
.hifz-rating-box p {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.rating-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.rate-btn {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  padding: 10px 4px;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition-smooth);
}
.rate-btn i {
  font-size: 1.3rem;
}
.rate-btn span {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
}
.rate-btn:hover {
  transform: translateY(-2px);
}
.rate-btn.r-1:hover, .rate-btn.r-1.active {
  background: rgba(239, 68, 68, 0.15);
  border-color: #ef4444;
  color: #ef4444;
}
.rate-btn.r-2:hover, .rate-btn.r-2.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #f59e0b;
}
.rate-btn.r-3:hover, .rate-btn.r-3.active {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #10b981;
}
.active-rating-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  color: var(--accent-gold);
}

/* --- Footer --- */
.app-footer {
  border-top: 1px solid var(--panel-border);
  background: rgba(7, 11, 19, 0.8);
  padding: 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}
.footer-links {
  display: flex;
  gap: 1.5rem;
}
.footer-links a {
  color: var(--accent-gold);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition-fast);
}
.footer-links a:hover {
  color: var(--accent-gold-hover);
  text-decoration: underline;
}

/* --- Helper Classes & Utility Animations --- */
.hidden {
  display: none !important;
}

.highlight-pulse {
  animation: border-pulse 2s infinite alternate;
}

/* Animations */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce-loop {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes pulse-gold {
  0% {
    box-shadow: 0 0 0 0 rgba(223, 177, 91, 0.5);
  }
  100% {
    box-shadow: 0 0 0 10px rgba(223, 177, 91, 0);
  }
}

@keyframes border-pulse {
  0% {
    border-color: var(--panel-border);
    box-shadow: 0 0 0 rgba(223, 177, 91, 0);
  }
  100% {
    border-color: var(--accent-gold);
    box-shadow: 0 0 10px var(--accent-gold-glow);
  }
}

/* --- Footer Version --- */
.footer-version {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-gold);
  background: rgba(223, 177, 91, 0.08);
  border: 1px solid rgba(223, 177, 91, 0.2);
  padding: 3px 12px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

/* --- Cloud Sync Button & Modal Styles --- */
.cloud-sync-btn {
  color: var(--accent-gold) !important;
}
.cloud-sync-btn:hover {
  background: rgba(223, 177, 91, 0.15) !important;
  box-shadow: 0 0 10px var(--accent-gold-glow);
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 11, 19, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fade-in-up 0.25s ease-out;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  background: rgba(18, 29, 51, 0.95);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.75rem;
}
.modal-header h3 {
  font-size: 1.2rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.modal-desc {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.sync-code-box, .sync-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sync-code-box label, .sync-input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.sync-code-display, .sync-input-row {
  display: flex;
  gap: 0.5rem;
}
.sync-code-display input, .sync-input-row input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--accent-gold);
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  outline: none;
}
.sync-input-row input {
  color: var(--text-primary);
  letter-spacing: 0.05em;
  font-size: 1rem;
}

.sync-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0.25rem 0;
}
.sync-divider::before, .sync-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--panel-border);
}
.sync-divider span {
  padding: 0 0.75rem;
}

.sync-status-badge {
  background: rgba(0, 245, 212, 0.06);
  border: 1px solid rgba(0, 245, 212, 0.2);
  color: var(--accent-teal);
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.backup-actions {
  border-top: 1px solid var(--panel-border);
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.backup-actions h4 {
  font-size: 0.9rem;
  color: var(--text-primary);
}
.backup-btns {
  display: flex;
  gap: 0.75rem;
}

/* --- Color Highlighter & Tagging Toolbar Styles --- */
.highlighter-bar {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.highlighter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.hl-title {
  font-family: var(--font-heading);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-hl-mode-btn {
  background: rgba(223, 177, 91, 0.1);
  border: 1px solid rgba(223, 177, 91, 0.25);
  color: var(--accent-gold);
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.toggle-hl-mode-btn:hover, .toggle-hl-mode-btn.active {
  background: var(--accent-gold);
  color: #070b13;
}

.highlighter-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.color-swatches-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.color-swatch {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 16px;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-fast);
}
.color-swatch:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.3);
}

.swatch-circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
}

/* Swatch Colors */
.color-swatch.gold .swatch-circle { background: #dfb15b; box-shadow: 0 0 6px rgba(223, 177, 91, 0.5); }
.color-swatch.emerald .swatch-circle { background: #10b981; box-shadow: 0 0 6px rgba(16, 185, 129, 0.5); }
.color-swatch.teal .swatch-circle { background: #00f5d4; box-shadow: 0 0 6px rgba(0, 245, 212, 0.5); }
.color-swatch.purple .swatch-circle { background: #a855f7; box-shadow: 0 0 6px rgba(168, 85, 247, 0.5); }
.color-swatch.coral .swatch-circle { background: #ff6b6b; box-shadow: 0 0 6px rgba(255, 107, 107, 0.5); }
.color-swatch.eraser { color: var(--text-muted); }

/* Active Swatches */
.color-swatch.gold.active { background: rgba(223, 177, 91, 0.2); border-color: #dfb15b; color: #dfb15b; }
.color-swatch.emerald.active { background: rgba(16, 185, 129, 0.2); border-color: #10b981; color: #10b981; }
.color-swatch.teal.active { background: rgba(0, 245, 212, 0.2); border-color: #00f5d4; color: #00f5d4; }
.color-swatch.purple.active { background: rgba(168, 85, 247, 0.2); border-color: #a855f7; color: #c084fc; }
.color-swatch.coral.active { background: rgba(255, 107, 107, 0.2); border-color: #ff6b6b; color: #ff8585; }
.color-swatch.eraser.active { background: rgba(255, 255, 255, 0.1); border-color: var(--text-primary); color: var(--text-primary); }

.tag-edit-row input {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.82rem;
  outline: none;
}
.tag-edit-row input:focus {
  border-color: var(--accent-gold);
}

/* --- Word Highlight Colors & Tag Tooltips --- */
.q-word.hl-gold {
  background: rgba(223, 177, 91, 0.22) !important;
  border: 1px solid #dfb15b !important;
  color: #f5d085 !important;
  box-shadow: 0 2px 8px rgba(223, 177, 91, 0.25);
}
.q-word.hl-emerald {
  background: rgba(16, 185, 129, 0.22) !important;
  border: 1px solid #10b981 !important;
  color: #34d399 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}
.q-word.hl-teal {
  background: rgba(0, 245, 212, 0.2) !important;
  border: 1px solid #00f5d4 !important;
  color: #5effeb !important;
  box-shadow: 0 2px 8px rgba(0, 245, 212, 0.25);
}
.q-word.hl-purple {
  background: rgba(168, 85, 247, 0.22) !important;
  border: 1px solid #a855f7 !important;
  color: #d8b4fe !important;
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.25);
}
.q-word.hl-coral {
  background: rgba(255, 107, 107, 0.22) !important;
  border: 1px solid #ff6b6b !important;
  color: #ff9b9b !important;
  box-shadow: 0 2px 8px rgba(255, 107, 107, 0.25);
}

/* Hover Tag Label Tooltip */
.q-word[data-tag-label]:not([data-tag-label=""]):hover::before {
  content: attr(data-tag-label);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: #070b13;
  color: #ffffff;
  border: 1px solid var(--accent-gold);
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 50;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  animation: fade-in-up 0.15s ease-out;
}


/* --- Responsive Media Queries --- */
@media (max-width: 1024px) {
  .main-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .left-pane, .right-pane {
    height: auto;
  }
  .tab-panel {
    max-height: 600px;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem 1rem;
  }
  .verse-selector-nav {
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
  }
  .verse-nav-btn {
    min-width: 100px;
    flex-shrink: 0;
  }
  .hero-title {
    font-size: 1.8rem;
  }
  .hero-subtitle {
    font-size: 0.95rem;
  }
  .main-container {
    padding: 1rem 1rem 3rem 1rem;
  }
  .arabic-text {
    font-size: 1.95rem;
  }
  .quiz-options-grid {
    grid-template-columns: 1fr;
  }
}

