/* ==========================================================================
   EUSKARA A1 · GRAMATIKA IBILBIDEA — SISTEMA DE DISEÑO (EuskoLabs Book2App)
   Responsive, Mobile-First, Alto Contraste, Modo Claro / Oscuro Confortable
   ========================================================================== */

:root {
  /* Paleta Base — Ikurriña Dark Ergonomikoa (Confort Visual Euskaldun) */
  --bg-primary: #0d131a;
  --bg-secondary: #141d27;
  --bg-card: #1c2836;
  --bg-card-hover: #243447;
  --bg-input: #111822;
  --border-subtle: #293a4d;
  --border-strong: #3b526d;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  /* Colores Oficiales de la Bandera de la Ikurriña */
  --ikurrina-red: #dc2626;
  --ikurrina-red-dark: #b91c1c;
  --ikurrina-red-glow: rgba(220, 38, 38, 0.25);

  --ikurrina-green: #16a34a;
  --ikurrina-green-dark: #15803d;
  --ikurrina-green-glow: rgba(22, 163, 74, 0.25);

  --ikurrina-white: #ffffff;

  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-amber: #f59e0b;
  --accent-purple: #a855f7;

  /* Códigos Cromáticos de Sufijos Gramaticales */
  --suffix-singular: #22c55e;   /* Verde para Singular */
  --suffix-plural: #38bdf8;     /* Azul para Plural */
  --suffix-propio: #fbbf24;     /* Ámbar para Nombres Propios */
  --suffix-ergativo: #ef4444;   /* Rojo Ikurriña para NORK Ergativo */

  /* Tipografías del Sistema */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Sombras y Radios */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.35);

  /* Layout */
  --sidebar-width: 320px;
  --topbar-height: 64px;
  --bottomnav-height: 64px;
}

/* Modo Claro Papel (Lectura Tradicional de Estudio) */
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input: #ffffff;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;

  --suffix-singular: #16a34a;
  --suffix-plural: #0284c7;
  --suffix-propio: #d97706;
  --suffix-ergativo: #dc2626;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Reset y Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* App Wrapper */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Topbar */
.topbar {
  position: relative;
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  z-index: 30;
  flex-shrink: 0;
}

/* Cinta Tricolor Oficial de la Ikurriña */
.ikurrina-ribbon {
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, 
    var(--ikurrina-red) 0%, 
    var(--ikurrina-red) 33.3%, 
    var(--ikurrina-green) 33.3%, 
    var(--ikurrina-green) 66.6%, 
    var(--ikurrina-white) 66.6%, 
    var(--ikurrina-white) 100%
  );
  position: absolute;
  top: 0;
  left: 0;
  z-index: 40;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-badge {
  background: linear-gradient(135deg, var(--ikurrina-red) 0%, var(--ikurrina-green) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 0 12px var(--ikurrina-green-glow);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: none;
}

@media (min-width: 768px) {
  .brand-subtitle {
    display: inline;
  }
}

/* Progress Bar en Topbar */
.topbar-progress {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-card);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.progress-track {
  width: 100px;
  height: 8px;
  background: var(--bg-input);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ikurrina-green) 0%, #10b981 100%);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}

/* Topbar Acciones */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
}

.btn-hiztegia {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
}

.btn-hiztegia:hover {
  filter: brightness(1.1);
}

/* Main Body Layout */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* Sidebar de Navegación */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.25s ease;
  z-index: 25;
}

.sidebar-search {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  padding: 0.55rem 0.75rem 0.55rem 2rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent-cyan);
}

.search-icon {
  position: absolute;
  left: 0.65rem;
  font-size: 0.85rem;
  color: var(--text-subtle);
}

/* Pestañas de Vista en Sidebar (7 Vistas Maestras) */
.nav-views {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-subtle);
}

.view-tab-btn {
  flex: 1 1 calc(33.333% - 0.35rem);
  min-width: 60px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.45rem 0.2rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.view-tab-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: var(--border-strong);
}

.view-tab-btn.active {
  background: var(--ikurrina-green);
  border-color: var(--ikurrina-green);
  color: #ffffff;
  box-shadow: 0 0 10px var(--ikurrina-green-glow);
}

/* Lista de Unidades en Sidebar */
.units-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
}

.module-header {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-cyan);
  padding: 0.65rem 0.5rem 0.35rem 0.5rem;
  margin-top: 0.5rem;
}

.unit-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.25rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.unit-item-btn:hover {
  background: var(--bg-card);
  border-color: var(--border-subtle);
}

.unit-item-btn.active {
  background: var(--bg-card);
  border-color: var(--accent-cyan);
  color: #38bdf8;
  font-weight: 600;
}

.unit-num-badge {
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  margin-right: 0.5rem;
  font-weight: 700;
}

.unit-item-btn.active .unit-num-badge {
  background: var(--accent-cyan);
  color: #0f141a;
}

.unit-status-icon {
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.unit-status-icon.done {
  color: var(--ikurrina-green);
  font-weight: bold;
}

/* Contenido Principal (Lienzo Central) */
.main-canvas {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Vista 1: Lección */
.lesson-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.lesson-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lesson-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.badge-module {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
}

.btn-pdf-link {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.btn-pdf-link:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

.lesson-title-eu {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.lesson-title-es {
  font-size: 1.05rem;
  color: var(--text-muted);
  font-weight: 500;
}

.lesson-question-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  width: fit-content;
}

/* Bloques de la Lección */
.section-block {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.section-block-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.explanation-text {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.65;
  background: var(--bg-secondary);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent-cyan);
}

/* Caja de Truco Mnemotécnico ("El Truco de Patxi") */
.mnemonic-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-left: 4px solid var(--accent-amber);
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  color: var(--text-main);
}

.mnemonic-header {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-amber);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mnemonic-content {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Tablas Gramaticales */
.grammar-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.grammar-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.grammar-table th {
  background: var(--bg-secondary);
  padding: 0.75rem 1rem;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.grammar-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.grammar-table tr:last-child td {
  border-bottom: none;
}

.grammar-table tr:hover td {
  background: var(--bg-card-hover);
}

/* Ejemplos del PDF */
.examples-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.example-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.example-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.example-eu {
  font-size: 1.05rem;
  font-weight: 700;
  color: #38bdf8;
}

.example-es {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.example-breakdown {
  font-size: 0.8rem;
  color: var(--text-subtle);
  font-family: var(--font-mono);
  background: var(--bg-input);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.btn-speak {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-speak:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

/* Mini Quizzes */
.quiz-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.quiz-question-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.quiz-options-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

.quiz-option-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

.quiz-option-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-card-hover);
}

.quiz-option-btn.correct {
  background: rgba(34, 197, 94, 0.15) !important;
  border-color: var(--ikurrina-green) !important;
  color: #4ade80 !important;
  font-weight: 700;
}

.quiz-option-btn.incorrect {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: var(--ikurrina-red) !important;
  color: #f87171 !important;
}

.quiz-feedback {
  font-size: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  display: none;
}

.quiz-feedback.show {
  display: block;
}

.quiz-feedback.success {
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.quiz-feedback.error {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Bloc de Notas */
.notes-textarea {
  width: 100%;
  height: 90px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  color: var(--text-main);
  font-size: 0.85rem;
  resize: vertical;
  outline: none;
}

.notes-textarea:focus {
  border-color: var(--accent-cyan);
}

/* Botonera Inferior de Lección */
.lesson-footer-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn-mark-done {
  background: var(--ikurrina-green-dark);
  color: #ffffff;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-mark-done:hover {
  background: var(--ikurrina-green);
}

.btn-mark-done.is-done {
  background: var(--bg-input);
  color: var(--ikurrina-green);
  border: 1px solid var(--ikurrina-green);
}

/* Vista 2: Declinador & Verbos */
.declinador-container {
  max-width: 950px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tool-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.declinador-inputs {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.declinador-select {
  padding: 0.6rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  cursor: pointer;
}

.declinador-text-input {
  flex: 1;
  min-width: 200px;
  padding: 0.6rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
}

.declinador-text-input:focus, .declinador-select:focus {
  border-color: var(--accent-cyan);
  outline: none;
}

/* Vista 3: Flashcards */
.flashcards-container {
  max-width: 650px;
  margin: 2rem auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.flashcard-3d-scene {
  width: 100%;
  height: 320px;
  perspective: 1000px;
  cursor: pointer;
}

.flashcard-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.flashcard-inner.flipped {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 1px solid var(--border-subtle);
}

.flashcard-front {
  background: var(--bg-card);
}

.flashcard-back {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  transform: rotateY(180deg);
  border-color: var(--accent-cyan);
}

.flashcard-word-main {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.flashcard-word-sub {
  font-size: 1.25rem;
  color: var(--accent-cyan);
  font-weight: 600;
}

.flashcard-prompt-hint {
  position: absolute;
  bottom: 1rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.flashcard-controls {
  display: flex;
  gap: 1rem;
  width: 100%;
  justify-content: center;
}

/* Cajón / Modal de Hiztegia & Traductor */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer-content {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-subtle);
  z-index: 60;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -10px 0 25px rgba(0, 0, 0, 0.5);
}

.drawer-overlay.open .drawer-content {
  transform: translateX(0);
}

.drawer-header {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-close-drawer {
  background: transparent;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
}

.btn-close-drawer:hover {
  color: var(--text-main);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.drawer-external-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.ext-link-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  text-decoration: none;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: all 0.15s ease;
}

.ext-link-card:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.ext-link-title {
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ext-link-desc {
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.glossary-search-results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.glossary-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.glossary-eu {
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 0.95rem;
}

.glossary-es {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.glossary-unit-badge {
  font-size: 0.7rem;
  background: var(--bg-input);
  color: var(--text-subtle);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}

/* Barra Táctil Inferior (Móviles / Tablets - 7 Vistas Fluidas) */
.bottom-nav {
  height: var(--bottomnav-height);
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-subtle);
  display: none;
  overflow-x: auto;
  overflow-y: hidden;
  align-items: center;
  flex-shrink: 0;
  z-index: 30;
  padding: 0 0.25rem;
  gap: 0.2rem;
  scrollbar-width: none;
}

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

.bottom-nav-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  height: 100%;
  min-width: 54px;
  flex: 1 0 auto;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0.2rem 0.25rem;
}

.bottom-nav-item:hover {
  color: var(--text-main);
}

.bottom-nav-item.active {
  color: var(--ikurrina-green);
  font-weight: 700;
}

.bottom-nav-icon {
  font-size: 1.15rem;
}

/* ==========================================================================
   ESTILOS ESPECÍFICOS DE LAS NUEVAS SUITES (ZENBAKIAK, DENBORA, ADITZAK)
   ========================================================================== */

/* 1. Zenbakiak & Calculadora Vigesimal */
.vigesimal-calc-card {
  border-left: 5px solid var(--ikurrina-green) !important;
}

.number-cell:hover {
  transform: translateY(-2px);
  border-color: var(--ikurrina-green) !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.btn-quick-num:hover {
  background: var(--ikurrina-green) !important;
  color: #ffffff !important;
  border-color: var(--ikurrina-green) !important;
}

/* 2. Hilabeteak & Denbora */
.gaurko-data-banner {
  box-shadow: 0 0 15px var(--ikurrina-green-glow);
}

.month-card:hover {
  transform: translateY(-2px);
  border-color: var(--ikurrina-green) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* 3. Ohiko Hiztegia & Aditz Jokatuak */
.verb-detail-card {
  border-top: 4px solid var(--ikurrina-red) !important;
}

.verb-catalog-item:hover {
  transform: translateY(-2px);
  border-color: var(--ikurrina-green) !important;
}

.btn-cat:hover {
  background: var(--bg-card-hover) !important;
  color: var(--text-main) !important;
}

/* Responsive Breakpoints & Multi-Dispositivo */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    top: var(--topbar-height);
    bottom: var(--bottomnav-height);
    left: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
    z-index: 40;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .bottom-nav {
    display: flex;
  }

  .main-canvas {
    padding: 0.85rem;
  }

  .nav-views {
    display: none;
  }

  .topbar {
    padding: 0 0.75rem;
  }

  .brand-title {
    font-size: 1rem;
  }

  .topbar-progress {
    padding: 0.25rem 0.5rem;
  }

  .progress-track {
    width: 60px;
  }
}

@media (max-width: 480px) {
  .topbar-progress {
    display: none;
  }

  .bottom-nav-item span:not(.bottom-nav-icon) {
    font-size: 0.6rem;
  }
}
