/* ============================================================
   OpoSERGAS — Main Stylesheet
   Civil service exam preparation web app
   ============================================================ */

/* ── Google Fonts ───────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Custom Properties ──────────────────────────────────── */
:root {
  /* Brand */
  --primary: #1a73e8;
  --primary-hover: #1557b0;
  --primary-light: rgba(26, 115, 232, 0.1);

  /* Semantic */
  --success: #1a7f5a;
  --success-light: #059669;
  --success-bg: rgba(5, 150, 105, 0.1);
  --error: #c0392b;
  --error-light: #dc2626;
  --error-bg: rgba(220, 38, 38, 0.1);
  --warning: #f39c12;
  --warning-light: #d97706;
  --warning-bg: rgba(243, 156, 18, 0.1);

  /* Neutrals */
  --neutral-50: #f8f9fa;
  --neutral-100: #f1f3f5;
  --neutral-200: #e9ecef;
  --neutral-300: #dee2e6;
  --neutral-400: #adb5bd;
  --neutral-500: #6c757d;
  --neutral-600: #495057;
  --neutral-700: #343a40;
  --neutral-800: #212529;

  /* Sidebar */
  --sidebar-bg: #0f172a;
  --sidebar-width: 260px;
  --sidebar-text: #94a3b8;
  --sidebar-active: #1a73e8;

  /* Layout */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07), 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);

  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --text: #212529;
  --text-muted: #6c757d;

  /* Transitions */
  --transition: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* ── 1. Reset & Base ────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--neutral-50);
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

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

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 600;
  color: var(--neutral-800);
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

/* ── 2. Sidebar ─────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  transition: transform var(--transition-slow);
}

.sidebar-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}

.sidebar-logo:hover {
  color: #fff;
}

.sidebar-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--primary);
  color: #fff;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1.5rem;
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition);
  text-decoration: none;
  position: relative;
}

.nav-item:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: #fff;
  background: rgba(26, 115, 232, 0.2);
  border-right: 3px solid var(--primary);
}

.nav-item.active .nav-icon {
  color: var(--primary);
}

.nav-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.user-details {
  flex: 1;
  min-width: 0;
}

.user-details strong {
  display: block;
  color: #fff;
  font-size: 0.8125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-details span {
  font-size: 0.75rem;
  color: var(--sidebar-text);
}

.sidebar-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* ── 3. Mobile Nav ──────────────────────────────────────────── */
.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--neutral-200);
  z-index: 1000;
  padding: 0.5rem 0;
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--neutral-500);
  text-decoration: none;
  transition: color var(--transition);
  flex: 1;
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item .nav-icon {
  width: 22px;
  height: 22px;
  font-size: 1.15rem;
}

/* ── 4. Topbar (Mobile) ────────────────────────────────────── */
.topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--neutral-200);
  z-index: 999;
  padding: 0 1rem;
  align-items: center;
  gap: 0.75rem;
}

.topbar-search {
  flex: 1;
  position: relative;
}

.topbar-search input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.25rem;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-sm);
  background: var(--neutral-50);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition);
}

.topbar-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.mobile-menu-toggle {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--neutral-700);
  transition: background var(--transition);
}

.mobile-menu-toggle:hover {
  background: var(--neutral-100);
}

/* ── 5. Main Content ────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: 2rem;
}

.content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
}

/* ── 6. Cards ───────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--neutral-800);
}

.card-highlight {
  border-left: 4px solid var(--primary);
}

.card-warning {
  border-left: 4px solid var(--warning);
  background: linear-gradient(to right, var(--warning-bg), #fff 30%);
}

.card-action {
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card-action:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary);
}

/* ── 7. Stats Grid ──────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stats-grid-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.stat-info {
  flex: 1;
  min-width: 0;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--neutral-800);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--neutral-500);
  margin-top: 0.15rem;
}

.stats-inline {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.stats-inline .stat-card {
  flex: 1;
  min-width: 140px;
}

/* Stat icon backgrounds */
.bg-blue    { background: rgba(26, 115, 232, 0.12); color: var(--primary); }
.bg-green   { background: rgba(5, 150, 105, 0.12);  color: var(--success-light); }
.bg-orange  { background: rgba(217, 119, 6, 0.12);  color: var(--warning-light); }
.bg-purple  { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
.bg-red     { background: rgba(220, 38, 38, 0.12);  color: var(--error-light); }
.bg-teal    { background: rgba(20, 184, 166, 0.12); color: #14b8a6; }

/* ── 8. Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.35);
}

.btn-outline {
  background: #fff;
  color: var(--primary);
  border-color: var(--primary);
}

.btn-outline:hover:not(:disabled) {
  background: var(--primary-light);
}

.btn-danger {
  background: var(--error-light);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: var(--error);
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.35);
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-warning:hover:not(:disabled) {
  background: var(--warning-light);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--neutral-500);
  transition: all var(--transition);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-danger-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  background: var(--error-bg);
  color: var(--error-light);
  border-radius: var(--radius-xs);
  border: none;
  font-weight: 500;
  transition: all var(--transition);
}

.btn-danger-sm:hover {
  background: var(--error-light);
  color: #fff;
}

/* ── 9. Forms ───────────────────────────────────────────────── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--neutral-700);
  margin-bottom: 0.4rem;
}

.form-input {
  width: 100%;
  padding: 0.6rem 0.875rem;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-input::placeholder {
  color: var(--neutral-400);
}

.form-select {
  width: 100%;
  padding: 0.6rem 2rem 0.6rem 0.875rem;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E") no-repeat right 0.75rem center;
  appearance: none;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-textarea {
  width: 100%;
  padding: 0.6rem 0.875rem;
  border: 1px solid var(--neutral-300);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text);
  background: #fff;
  outline: none;
  resize: vertical;
  min-height: 100px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.form-select-sm {
  padding: 0.35rem 1.75rem 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.form-input-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--neutral-700);
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

/* ── 10. Progress Bars ──────────────────────────────────────── */
.progress-bar-lg {
  width: 100%;
  height: 10px;
  background: var(--neutral-200);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar-sm {
  width: 100%;
  height: 6px;
  background: var(--neutral-200);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: inherit;
  transition: width 0.6s ease;
}

.progress-fill.success {
  background: var(--success-light);
}

.progress-fill.warning {
  background: var(--warning);
}

.progress-fill.danger {
  background: var(--error-light);
}

/* ── 11. Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-new {
  background: var(--error-bg);
  color: var(--error-light);
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
}

.badge-info {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-light);
}

.badge-sm {
  padding: 0.12rem 0.45rem;
  font-size: 0.625rem;
}

/* ── 12. Filter Bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 0;
  background: var(--neutral-100);
  border-radius: var(--radius-sm);
  padding: 0.2rem;
}

.filter-btn {
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--neutral-600);
  border-radius: calc(var(--radius-sm) - 2px);
  transition: all var(--transition);
  border: none;
  background: none;
}

.filter-btn:hover {
  color: var(--neutral-800);
}

.filter-btn.active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow);
}

/* ── 13. Temario ────────────────────────────────────────────── */
.temas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.bloque-section {
  margin-bottom: 2rem;
}

.bloque-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--neutral-800);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--neutral-200);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tema-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
  text-decoration: none;
  color: inherit;
  display: block;
}

.tema-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
  color: inherit;
}

.tema-card-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.tema-numero {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.tema-titulo {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--neutral-800);
}

.tema-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--neutral-500);
  flex-wrap: wrap;
}

.tema-estudiado {
  border-color: var(--success-bg);
  border-left: 4px solid var(--success-light);
}

.bloque-progress-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.bloque-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.bloque-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.bloque-name {
  flex: 1;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--neutral-700);
}

.bloque-pct {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--neutral-600);
  min-width: 38px;
  text-align: right;
}

/* ── 14. Tema Detail ────────────────────────────────────────── */
.tema-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: start;
}

.tema-content {
  min-width: 0;
}

.tema-sidebar {
  position: sticky;
  top: 2rem;
}

.tema-body {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  line-height: 1.8;
}

.tema-body h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--neutral-200);
}

.tema-body h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.tema-body p {
  margin-bottom: 1rem;
}

.tema-body ul,
.tema-body ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
  list-style: disc;
}

.tema-body ol {
  list-style: decimal;
}

.tema-body li {
  margin-bottom: 0.35rem;
}

.tema-detail-header {
  margin-bottom: 1.5rem;
}

.tema-meta-lg {
  display: flex;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--neutral-500);
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.tema-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--neutral-500);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--neutral-500);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb span {
  color: var(--neutral-400);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  background: var(--neutral-100);
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--neutral-600);
}

.referencias-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.referencia-item {
  padding: 0.75rem;
  background: var(--neutral-50);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  font-size: 0.8125rem;
}

.doc-mini-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--neutral-50);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.doc-mini-card:hover {
  background: var(--neutral-100);
}

.nota-card {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-size: 0.8125rem;
  line-height: 1.6;
}

/* ── 15. Test ───────────────────────────────────────────────── */
.test-modes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.test-mode-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  border: 2px solid transparent;
}

.test-mode-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.mode-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: var(--primary-light);
  color: var(--primary);
}

.test-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.test-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: 0.8125rem;
  color: var(--neutral-500);
}

.test-timer {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--neutral-800);
}

.test-progress-bar {
  width: 100%;
  height: 4px;
  background: var(--neutral-200);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.test-progress-bar .progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.4s ease;
}

.test-question-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-bottom: 1rem;
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.question-number {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
}

.question-text {
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  color: var(--neutral-800);
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border: 2px solid var(--neutral-200);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.option-item:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  font-weight: 500;
}

.option-item.correct {
  border-color: var(--success-light);
  background: var(--success-bg);
  color: var(--success);
}

.option-item.incorrect {
  border-color: var(--error-light);
  background: var(--error-bg);
  color: var(--error);
}

.question-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--neutral-200);
}

.feedback-card {
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 1rem;
}

.feedback-header {
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feedback-card.correct .feedback-header {
  background: var(--success-bg);
  color: var(--success);
}

.feedback-card.incorrect .feedback-header {
  background: var(--error-bg);
  color: var(--error);
}

.feedback-body {
  padding: 1rem;
  font-size: 0.875rem;
  line-height: 1.7;
  background: var(--neutral-50);
  border: 1px solid var(--neutral-200);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.feedback-ref {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--neutral-200);
  font-size: 0.8125rem;
  color: var(--neutral-500);
}

.feedback-ejemplo {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: #fff;
  border-radius: var(--radius-xs);
  font-size: 0.8125rem;
  border: 1px solid var(--neutral-200);
}

.question-map {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 1rem;
}

.question-map-item {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--neutral-100);
  color: var(--neutral-600);
  border: 1px solid var(--neutral-200);
}

.question-map-item:hover {
  border-color: var(--primary);
}

.question-map-item.answered {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.question-map-item.current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.question-map-item.correct {
  background: var(--success-bg);
  color: var(--success);
  border-color: var(--success-light);
}

.question-map-item.incorrect {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-light);
}

.map-legend {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 1rem;
  font-size: 0.7rem;
  color: var(--neutral-500);
  border-top: 1px solid var(--neutral-200);
  flex-wrap: wrap;
}

.map-legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.3rem;
  vertical-align: middle;
}

/* ── 16. Documents ──────────────────────────────────────────── */
.docs-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.doc-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  transition: box-shadow var(--transition);
}

.doc-card:hover {
  box-shadow: var(--shadow-md);
}

.doc-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
  background: var(--error-bg);
  color: var(--error-light);
}

.doc-card-body {
  flex: 1;
  min-width: 0;
}

.doc-card-body h4 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.doc-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--neutral-500);
}

.upload-progress {
  width: 100%;
  height: 4px;
  background: var(--neutral-200);
  border-radius: 2px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.upload-progress .progress-fill {
  background: var(--primary);
  height: 100%;
  transition: width 0.3s ease;
}

/* PDF Viewer */
.pdf-viewer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 2000;
  display: flex;
  flex-direction: column;
}

.pdf-viewer-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pdf-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: var(--sidebar-bg);
  color: #fff;
}

.pdf-viewer-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pdf-viewer-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.pdf-canvas-wrapper {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  padding: 1rem;
  background: #525659;
}

.pdf-sidebar {
  width: 320px;
  background: #fff;
  overflow-y: auto;
  padding: 1rem;
  border-left: 1px solid var(--neutral-200);
}

.pdf-question-item {
  padding: 0.75rem;
  border-bottom: 1px solid var(--neutral-200);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background var(--transition);
}

.pdf-question-item:hover {
  background: var(--neutral-50);
}

/* ── 17. Resumen / Fichas ───────────────────────────────────── */
.flashcards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.flashcard {
  perspective: 1000px;
  height: 200px;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
}

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

.flashcard-front,
.flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  text-align: center;
}

.flashcard-front {
  background: #fff;
  font-weight: 600;
  font-size: 1rem;
  color: var(--neutral-800);
}

.flashcard-back {
  background: var(--primary);
  color: #fff;
  transform: rotateY(180deg);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* Glosario */
.glosario-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.glosario-item {
  display: flex;
  gap: 1rem;
  padding: 1rem;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  align-items: baseline;
}

.glosario-term {
  font-weight: 700;
  color: var(--primary);
  min-width: 140px;
  font-size: 0.875rem;
}

.glosario-def {
  font-size: 0.875rem;
  color: var(--neutral-700);
  line-height: 1.6;
}

/* Timeline */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--neutral-200);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -2rem;
  top: 0.4rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-year {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.timeline-content {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--neutral-700);
}

/* Data table */
.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table th {
  background: var(--neutral-100);
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--neutral-700);
  white-space: nowrap;
  border-bottom: 2px solid var(--neutral-200);
}

.data-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--neutral-200);
  color: var(--neutral-700);
}

.data-table tbody tr:nth-child(even) {
  background: var(--neutral-50);
}

.data-table tbody tr:hover {
  background: var(--primary-light);
}

/* ── 18. Progress Page ──────────────────────────────────────── */
.heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, 14px);
  gap: 3px;
  padding: 0.5rem 0;
}

.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  transition: transform var(--transition);
}

.heatmap-cell:hover {
  transform: scale(1.4);
}

.level-0 { background: var(--neutral-200); }
.level-1 { background: #bbf7d0; }
.level-2 { background: #6ee7b7; }
.level-3 { background: #34d399; }
.level-4 { background: #059669; }

.logros-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.logro-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  text-align: center;
  transition: all var(--transition);
}

.logro-card.desbloqueado {
  border: 2px solid var(--warning);
}

.logro-card.desbloqueado .logro-icon {
  color: var(--warning);
}

.logro-card.bloqueado {
  opacity: 0.5;
  filter: grayscale(1);
}

.logro-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  color: var(--neutral-400);
}

/* ── 19. Referencias ────────────────────────────────────────── */
.referencias-sections {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.ref-section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--neutral-800);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--neutral-200);
}

.ref-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.ref-item {
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  transition: box-shadow var(--transition);
}

.ref-item:hover {
  box-shadow: var(--shadow-md);
}

.ref-header {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
  color: var(--neutral-800);
}

.ref-meta {
  font-size: 0.75rem;
  color: var(--neutral-500);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ── 20. Admin ──────────────────────────────────────────────── */
.admin-section {
  margin-bottom: 2rem;
}

.preguntas-admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pregunta-admin-item {
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: box-shadow var(--transition);
}

.pregunta-admin-item:hover {
  box-shadow: var(--shadow-md);
}

.pregunta-admin-text {
  flex: 1;
  font-size: 0.875rem;
  line-height: 1.5;
  min-width: 0;
}

.pregunta-admin-meta {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--neutral-500);
}

.pregunta-admin-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.revision-item {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.revision-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

.option-correct {
  color: var(--success);
  font-weight: 600;
}

.revision-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--neutral-200);
}

.tema-admin-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  margin-bottom: 0.5rem;
}

.fallada-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  margin-bottom: 0.75rem;
  border-left: 3px solid var(--error-light);
}

/* ── 21. Countdown ──────────────────────────────────────────── */
.countdown-wrapper {
  text-align: center;
  padding: 1.5rem;
}

.countdown {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.countdown-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}

.countdown-item strong {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary);
}

.countdown-item span {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--neutral-500);
  margin-top: 0.25rem;
}

/* ── 22. Quick Actions ──────────────────────────────────────── */
.quick-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: #fff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--neutral-700);
  transition: all var(--transition);
  border: 1px solid var(--neutral-200);
}

.quick-action-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* ── 23. Search Overlay ─────────────────────────────────────── */
.search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  z-index: 3000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}

.search-overlay.active {
  opacity: 1;
  visibility: visible;
}

.search-panel {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 600px;
  margin: 0 1rem;
  overflow: hidden;
  transform: translateY(-20px);
  transition: transform var(--transition-slow);
}

.search-overlay.active .search-panel {
  transform: translateY(0);
}

.search-panel input {
  width: 100%;
  padding: 1rem 1.25rem;
  border: none;
  font-size: 1rem;
  outline: none;
  border-bottom: 1px solid var(--neutral-200);
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 0.5rem;
}

.search-results a {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--neutral-700);
  transition: background var(--transition);
}

.search-results a:hover {
  background: var(--neutral-50);
  color: var(--primary);
}

.search-hint {
  padding: 0.75rem 1.25rem;
  font-size: 0.75rem;
  color: var(--neutral-400);
  border-top: 1px solid var(--neutral-200);
}

/* ── 24. Toast ──────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--sidebar-bg);
  color: #fff;
  font-size: 0.875rem;
  min-width: 280px;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  animation: toast-slide-in 0.35s ease forwards;
}

.toast.toast-removing {
  animation: toast-slide-out 0.3s ease forwards;
}

.toast-success {
  border-left: 4px solid var(--success-light);
}

.toast-error {
  border-left: 4px solid var(--error-light);
}

@keyframes toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes toast-slide-out {
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* ── 25. Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  z-index: 4000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-slow);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  transform: scale(0.95);
  transition: transform var(--transition-slow);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal h3 {
  margin-bottom: 1.25rem;
}

/* ── 26. Utilities ──────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

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

.text-muted {
  color: var(--neutral-500);
}

.text-sm {
  font-size: 0.8125rem;
}

.text-xs {
  font-size: 0.75rem;
}

.text-success {
  color: var(--success-light);
}

.text-danger {
  color: var(--error-light);
}

/* Skeleton loader */
.skeleton-loader {
  background: linear-gradient(90deg, var(--neutral-200) 25%, var(--neutral-100) 50%, var(--neutral-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  min-height: 1rem;
}

@keyframes skeleton-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── 27. Responsive ─────────────────────────────────────────── */

/* ---- Tablet and below (max 1199px) ---- */
@media (max-width: 1199px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .main-content {
    margin-left: 0;
    padding: 1.25rem;
    padding-top: calc(56px + 1.25rem);
    padding-bottom: calc(60px + 1.25rem);
  }

  .topbar {
    display: flex;
  }

  .mobile-nav {
    display: flex;
  }

  .tema-layout {
    grid-template-columns: 1fr;
  }

  .tema-sidebar {
    position: static;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }

  .test-modes-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .pdf-sidebar {
    display: none;
  }
}

/* ---- Mobile (max 767px) ---- */
@media (max-width: 767px) {
  body {
    font-size: 13px;
  }

  .main-content {
    padding: 1rem;
    padding-top: calc(56px + 1rem);
    padding-bottom: calc(60px + 1rem);
  }

  .stats-grid,
  .stats-grid-6 {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-value {
    font-size: 1.25rem;
  }

  .test-modes-grid {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .temas-grid {
    grid-template-columns: 1fr;
  }

  .flashcards-grid {
    grid-template-columns: 1fr;
  }

  .logros-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
  }

  .filter-group {
    flex-shrink: 0;
  }

  .test-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .test-info {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .question-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .question-actions .btn {
    width: 100%;
  }

  .countdown-item strong {
    font-size: 1.5rem;
  }

  .card {
    padding: 1.25rem;
  }

  .test-question-card {
    padding: 1.25rem;
  }

  .tema-body {
    padding: 1.25rem;
  }

  .modal {
    padding: 1.25rem;
    max-width: 100%;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }

  .glosario-item {
    flex-direction: column;
    gap: 0.25rem;
  }

  .glosario-term {
    min-width: auto;
  }

  .pregunta-admin-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: calc(60px + 1rem);
  }

  .toast {
    min-width: auto;
    max-width: 100%;
  }

  .quick-actions {
    flex-direction: column;
  }

  .quick-action-btn {
    width: 100%;
    justify-content: center;
  }

  .stats-inline {
    flex-direction: column;
  }

  .stats-inline .stat-card {
    min-width: auto;
  }
}

/* ---- Desktop (1200px+) ---- */
@media (min-width: 1200px) {
  .sidebar {
    transform: translateX(0);
  }

  .topbar {
    display: none;
  }

  .mobile-nav {
    display: none;
  }
}

/* ── Print ──────────────────────────────────────────────────── */
@media print {
  .sidebar,
  .mobile-nav,
  .topbar,
  .toast-container {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }

  .card {
    box-shadow: none;
    border: 1px solid var(--neutral-300);
    break-inside: avoid;
  }
}
