/* ==========================================================================
   DGT PERMISO B — BOTANICAL READING SANCTUARY
   Designed for long, glare-free, distraction-free study sessions.
   Color Science: Soothing off-white paper canvas with sage/forest green accents.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Hind+Siliguri:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Space+Mono:wght@700&display=swap');

:root {
  /* Paper & Reading Canvas (Zero eye-strain, soothing botanical off-white) */
  --bg-paper: #F6F8F5;
  --bg-surface: #FFFFFF;
  --bg-surface-hover: #F2F6F1;
  --bg-subtle: #EDF2EB;
  
  /* Hairlines & Borders */
  --border-light: #E0E7DE;
  --border-subtle: #EAEFE8;
  --border-focus: #15803D;

  /* Typography Colors (Rich Forest Ink for optimal contrast without harshness) */
  --text-primary: #14211A;
  --text-secondary: #4A5B52;
  --text-muted: #73857B;
  --text-light: #94A39B;

  /* Sage & Forest Green Accents (Reading Sanctuary) */
  --green-primary: #15803D;
  --green-primary-hover: #166534;
  --green-soft: #ECFDF5;
  --green-border: #A7F3D0;
  --green-dark: #064E3B;

  /* Feedback Colors */
  --color-success-bg: #ECFDF5;
  --color-success-border: #10B981;
  --color-success-text: #065F46;

  --color-danger-bg: #FEF2F2;
  --color-danger-border: #EF4444;
  --color-danger-text: #991B1B;

  --color-warning-bg: #FFFBEB;
  --color-warning-border: #F59E0B;
  --color-warning-text: #92400E;

  /* Fonts */
  --font-reading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-bn: 'Hind Siliguri', sans-serif;
  --font-mono: 'Space Mono', monospace;

  /* Radii & Shadows */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --shadow-paper: 0 4px 20px rgba(20, 33, 26, 0.05), 0 1px 3px rgba(20, 33, 26, 0.03);
  --shadow-hover: 0 8px 26px rgba(20, 33, 26, 0.08), 0 2px 6px rgba(20, 33, 26, 0.04);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body {
  background-color: var(--bg-paper);
  color: var(--text-primary);
  font-family: var(--font-reading);
  min-height: 100vh;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-bottom: calc(84px + var(--safe-bottom));
  -webkit-font-smoothing: antialiased;
}

/* Custom Soothing Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-paper);
}
::-webkit-scrollbar-thumb {
  background: #CBD5CA;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: #9DB0A1;
}

/* ==========================================================================
   ELEGANT CLEAN HEADER
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-light);
  padding-top: var(--safe-top);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  text-decoration: none;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  color: var(--green-primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}

.brand-info h1 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.brand-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--green-soft);
  color: var(--green-primary);
  border: 1px solid var(--green-border);
  text-transform: uppercase;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-paper);
  border: 1px solid var(--border-light);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green-primary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green-primary);
  box-shadow: 0 0 6px rgba(21, 128, 61, 0.4);
}

/* ==========================================================================
   NAVIGATION TABS
   ========================================================================== */
.nav-tabs {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 20px 10px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  font-family: var(--font-reading);
}

.tab-btn:hover {
  background: var(--bg-paper);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--green-soft);
  border-color: var(--green-border);
  color: var(--green-primary);
  font-weight: 700;
}

/* ==========================================================================
   CONTAINER & READING STATS
   ========================================================================== */
.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 24px 18px;
  width: 100%;
  flex: 1;
}

/* Stats Overview Bar */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.stat-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-paper);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, border-color 0.15s;
}

.stat-box:hover {
  border-color: #CBD5CA;
  transform: translateY(-1px);
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* ==========================================================================
   SEARCH & FILTER CONTROLS
   ========================================================================== */
.filter-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-paper);
  margin-bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-input-wrap {
  position: relative;
  width: 100%;
}

.search-input-wrap input {
  width: 100%;
  background: var(--bg-paper);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 14px 10px 40px;
  color: var(--text-primary);
  font-family: var(--font-reading);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s;
}

.search-input-wrap input:focus {
  border-color: var(--green-primary);
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.12);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 15px;
}

.filter-chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }

.chip-btn {
  padding: 6px 14px;
  background: var(--bg-paper);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: var(--font-reading);
}

.chip-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.chip-btn.active {
  background: var(--green-primary);
  border-color: var(--green-primary);
  color: #FFFFFF;
}

/* ==========================================================================
   READER QUESTION CARD
   ========================================================================== */
.question-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-paper);
  margin-bottom: 24px;
  transition: box-shadow 0.2s ease;
}

.card-header {
  padding: 14px 22px;
  background: #FAFBF9;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.category-badge {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--green-primary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.importance-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  text-transform: uppercase;
}

.importance-badge.trap {
  border-color: #FCA5A5;
  color: #DC2626;
  background: #FEF2F2;
}

.importance-badge.high-yield {
  border-color: #FDE68A;
  color: #D97706;
  background: #FFFBEB;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-btn {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.tool-btn:hover {
  background: var(--bg-paper);
  color: var(--text-primary);
  border-color: #CBD5CA;
}

.tool-btn.bookmarked {
  color: #D97706;
  border-color: #FCD34D;
  background: #FFFBEB;
}

/* Card Reading Content */
.card-content {
  padding: 24px 26px;
}

.media-container {
  margin-bottom: 22px;
  background: #F4F7F3;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  justify-content: center;
}

.media-container img {
  max-width: 100%;
  max-height: 250px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

/* Spanish Question Typography */
.question-text-es {
  font-size: 1.22rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}

/* Minimalist Options */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-bottom: 24px;
}

.option-item {
  background: #FFFFFF;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.option-item:hover:not(.locked) {
  background: var(--bg-surface-hover);
  border-color: #B8C7B5;
  transform: translateY(-1px);
}

.option-letter {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-paper);
  border: 1px solid var(--border-light);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.option-text-es {
  font-size: 1.02rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.5;
  flex: 1;
}

/* Option States */
.option-item.correct {
  background: var(--color-success-bg) !important;
  border-color: var(--color-success-border) !important;
}
.option-item.correct .option-letter {
  background: var(--green-primary);
  color: #FFFFFF;
  border-color: var(--green-primary);
}
.option-item.correct .option-text-es {
  color: var(--color-success-text);
  font-weight: 600;
}

.option-item.incorrect {
  background: var(--color-danger-bg) !important;
  border-color: var(--color-danger-border) !important;
}
.option-item.incorrect .option-letter {
  background: var(--color-danger-border);
  color: #FFFFFF;
  border-color: var(--color-danger-border);
}
.option-item.incorrect .option-text-es {
  color: var(--color-danger-text);
}

/* ==========================================================================
   TEACHER'S EXPLANATION BOX (IN SOOTHING SAGE MINT BANGLA CONTAINER)
   ========================================================================== */
.teacher-box {
  background: linear-gradient(180deg, #F0FDF4 0%, #E8F8EE 100%);
  border: 1.5px solid #86EFAC;
  border-radius: var(--radius-md);
  padding: 20px 22px;
  margin-top: 22px;
  animation: reveal-box 0.25s ease-out;
  box-shadow: 0 4px 14px rgba(22, 101, 52, 0.05);
}

@keyframes reveal-box {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

.teacher-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(22, 101, 52, 0.15);
}

.teacher-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 800;
  color: #14532D;
  letter-spacing: -0.01em;
}

.teacher-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.teacher-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.teacher-content {
  flex: 1;
}

.teacher-label {
  font-size: 0.72rem;
  color: #166534;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}

/* Bangla typography: highly legible, comfortable leading */
.teacher-text-bn {
  font-family: var(--font-bn);
  font-size: 1.05rem;
  color: #1A3828;
  line-height: 1.75;
}

.spanish-exp-details {
  margin-top: 14px;
  border-top: 1px solid rgba(22, 101, 52, 0.15);
  padding-top: 10px;
}

.spanish-exp-details summary {
  font-size: 0.78rem;
  color: #166534;
  cursor: pointer;
  user-select: none;
  font-weight: 700;
}

.spanish-exp-details p {
  font-size: 0.88rem;
  color: #374151;
  margin-top: 8px;
  line-height: 1.55;
  font-style: italic;
}

/* Card Navigation Footer */
.card-footer {
  padding: 16px 24px;
  background: #FAFBF9;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.btn-nav-primary {
  background: var(--green-primary);
  color: #FFFFFF;
  border: none;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
  box-shadow: 0 2px 8px rgba(21, 128, 61, 0.25);
}

.btn-nav-primary:hover {
  background: var(--green-primary-hover);
  transform: translateY(-1px);
}

.btn-nav-secondary {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-nav-secondary:hover {
  background: var(--bg-paper);
  border-color: #CBD5CA;
}

.keyboard-shortcut-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}

kbd {
  background: #FFFFFF;
  border: 1px solid var(--border-light);
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   EXAM SIMULATOR VIEW (LIGHT THEME)
   ========================================================================== */
.exam-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-paper);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.exam-info h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
}

.exam-info p {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.exam-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: #B45309;
}

.exam-grid-pager {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 5px;
  margin-bottom: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px;
  box-shadow: var(--shadow-paper);
}

@media (max-width: 600px) {
  .exam-grid-pager {
    grid-template-columns: repeat(10, 1fr);
  }
}

.exam-pip {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-paper);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.exam-pip.active {
  border-color: var(--green-primary);
  color: var(--green-primary);
  background: var(--green-soft);
  font-weight: 800;
}

.exam-pip.answered {
  background: #E8F8EE;
  border-color: #86EFAC;
  color: #15803D;
}

/* Exam Result Card */
.exam-result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  box-shadow: var(--shadow-paper);
}

.result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  font-size: 36px;
  margin-bottom: 16px;
}

.result-badge.apto {
  background: #ECFDF5;
  border: 2px solid #10B981;
  color: #059669;
}

.result-badge.no-apto {
  background: #FEF2F2;
  border: 2px solid #EF4444;
  color: #DC2626;
}

.result-title {
  font-size: 1.7rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.result-title.apto { color: #059669; }
.result-title.no-apto { color: #DC2626; }

.result-desc {
  font-size: 0.98rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto 26px;
}

.result-stats-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 30px;
}

.result-stat-chip {
  background: var(--bg-paper);
  border: 1px solid var(--border-light);
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  min-width: 110px;
}

.result-stat-chip .val {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 800;
}

.result-stat-chip .lbl {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ==========================================================================
   SPEED & RULES CHEATSHEET
   ========================================================================== */
.cheatsheet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px;
  box-shadow: var(--shadow-paper);
}

.table-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
}

.modern-table th, .modern-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}

.modern-table th {
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.speed-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: #15803D;
  background: var(--green-soft);
  border: 1px solid var(--green-border);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ==========================================================================
   MOBILE BOTTOM NAVIGATION DOCK (CLEAN LIGHT THEME)
   ========================================================================== */
.mobile-dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-light);
  padding: 8px 12px calc(8px + var(--safe-bottom));
  display: flex;
  justify-content: space-around;
  z-index: 50;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

.dock-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  background: none;
  border: none;
  font-size: 0.74rem;
  font-weight: 600;
  font-family: var(--font-reading);
  cursor: pointer;
  transition: color 0.15s;
  padding: 4px 12px;
}

.dock-btn .icon {
  font-size: 19px;
}

.dock-btn.active {
  color: var(--green-primary);
  font-weight: 700;
}

.dock-btn:hover {
  color: var(--text-primary);
}

/* Empty View */
.empty-view {
  text-align: center;
  padding: 48px 20px;
  background: var(--bg-surface);
  border: 1.5px dashed var(--border-light);
  border-radius: var(--radius-lg);
}

.empty-view .icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.empty-view h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-view p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
