/* ═══════════════════════════════════════════════════════════════════
   INTERACTOMA MODULAR DCQB · UACJ — SISTEMA DE DISEÑO DE GUÍAS
   Hoja de estilo unificada para las guías didácticas e interactivas
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,400;0,500;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&family=DM+Serif+Display:ital@0;1&display=swap');

:root {
  /* Tipografía */
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'DM Serif Display', Georgia, serif;
  --font-mono: 'DM Mono', 'SFMono-Regular', Consolas, Menlo, monospace;

  /* Paleta Corporativa Modo Oscuro (Por defecto) */
  --bg-page: #05080f;
  --bg-page-alt: #080d1a;
  --bg-card: #0c1220;
  --bg-card2: #101828;
  --bg-card-subtle: rgba(255, 255, 255, 0.02);
  
  --border: #1e2d40;
  --border-hi: #304d68;
  --border-subtle: rgba(255, 255, 255, 0.06);

  --text: #e8edf5;
  --text-dim: #94a8bc;
  --text-xdim: #5c728a;

  /* Acentos de Interactoma */
  --blue: #38bdf8;
  --blue-dim: rgba(56, 189, 248, 0.12);
  --blue-border: rgba(56, 189, 248, 0.35);

  --green: #22c97a;
  --green-dim: rgba(34, 201, 122, 0.12);
  --green-border: rgba(34, 201, 122, 0.35);

  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.12);
  --purple-border: rgba(167, 139, 250, 0.35);

  --gold: #f5a623;
  --gold-dim: rgba(245, 166, 35, 0.12);
  --gold-border: rgba(245, 166, 35, 0.35);

  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.12);
  --red-border: rgba(248, 113, 113, 0.35);

  --teal: #14b8a6;
  --teal-dim: rgba(20, 184, 166, 0.12);
  --teal-border: rgba(20, 184, 166, 0.35);

  /* Sombras y Radios */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.35);
  --shadow-card-hover: 0 8px 30px rgba(0, 0, 0, 0.45);
}

/* Modo Claro (Sincronizado vía data-theme="light" o body.light) */
html[data-theme="light"],
body.light {
  --bg-page: #f0f4fa;
  --bg-page-alt: #e4eaf4;
  --bg-card: #ffffff;
  --bg-card2: #f8fafc;
  --bg-card-subtle: rgba(0, 0, 0, 0.02);

  --border: #d0daea;
  --border-hi: #9fb4cc;
  --border-subtle: rgba(0, 0, 0, 0.06);

  --text: #0f1c2e;
  --text-dim: #4a6680;
  --text-xdim: #7f99b3;

  --blue: #1d4ed8;
  --blue-dim: rgba(29, 78, 216, 0.08);
  --blue-border: rgba(29, 78, 216, 0.28);

  --green: #16a34a;
  --green-dim: rgba(22, 163, 74, 0.08);
  --green-border: rgba(22, 163, 74, 0.28);

  --purple: #7c3aed;
  --purple-dim: rgba(124, 58, 237, 0.08);
  --purple-border: rgba(124, 58, 237, 0.28);

  --gold: #d97706;
  --gold-dim: rgba(217, 119, 6, 0.08);
  --gold-border: rgba(217, 119, 6, 0.28);

  --red: #dc2626;
  --red-dim: rgba(220, 38, 38, 0.08);
  --red-border: rgba(220, 38, 38, 0.28);

  --teal: #0d9488;
  --teal-dim: rgba(13, 148, 136, 0.08);
  --teal-border: rgba(13, 148, 136, 0.28);

  --shadow-card: 0 4px 16px rgba(15, 28, 46, 0.06), 0 1px 3px rgba(15, 28, 46, 0.04);
  --shadow-card-hover: 0 8px 24px rgba(15, 28, 46, 0.1);
}

/* ════ RESET Y ESTRUCTURA BASE ════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark light;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 0;
  margin: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* Contenedor Principal de la Guía */
.guide-shell {
  max-width: 1020px;
  margin: 20px auto;
  padding: 24px 28px;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

@media (max-width: 768px) {
  .guide-shell {
    margin: 10px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
  }
}

/* ════ BARRA SUPERIOR UNIFICADA (TOPBAR) ════ */
.guide-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 24px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.guide-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
}

.guide-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.guide-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.guide-btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.guide-btn-action:hover {
  background: var(--bg-card2);
  border-color: var(--blue);
  color: var(--blue);
}

.guide-theme-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
}

.guide-theme-toggle:hover {
  border-color: var(--blue);
  color: var(--blue);
}

/* ════ ENCABEZADOS Y TEXTO ════ */
.guide-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 18px;
  margin-bottom: 24px;
}

.guide-category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--blue-dim);
  border: 1px solid var(--blue-border);
  color: var(--blue);
  margin-bottom: 10px;
}

.guide-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
  margin: 0 0 8px 0;
  letter-spacing: -0.02em;
}

.guide-subtitle {
  font-size: 14.5px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0;
}

h1, h2, h3, h4, h5 {
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 18px;
  margin: 28px 0 14px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 4px solid var(--blue);
  padding-left: 10px;
}

h3 {
  font-size: 15.5px;
  margin: 20px 0 10px 0;
  color: var(--text);
}

p {
  margin-bottom: 14px;
  color: var(--text);
  line-height: 1.65;
}

strong {
  font-weight: 700;
  color: var(--text);
}

/* ════ TARJETAS (CARDS) ════ */
.guide-card, .card {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.guide-card:hover, .card:hover {
  border-color: var(--border-hi);
}

/* ════ CALLOUTS / CAJAS DE ALERTA ════ */
.guide-callout, .callout {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  font-size: 13.5px;
  line-height: 1.6;
  border-left: 4px solid var(--blue);
  background: var(--blue-dim);
  color: var(--text);
}

.callout-info {
  border-left-color: var(--blue);
  background: var(--blue-dim);
}

.callout-success {
  border-left-color: var(--green);
  background: var(--green-dim);
}

.callout-warning {
  border-left-color: var(--gold);
  background: var(--gold-dim);
}

.callout-danger {
  border-left-color: var(--red);
  background: var(--red-dim);
}

.callout-purple {
  border-left-color: var(--purple);
  background: var(--purple-dim);
}

/* ════ TABLAS DE DATOS ════ */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.guide-table, table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}

.guide-table th, table th {
  background: var(--bg-card2);
  color: var(--text);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

.guide-table td, table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
}

.guide-table tbody tr:last-child td, table tbody tr:last-child td {
  border-bottom: none;
}

.guide-table tbody tr:hover, table tbody tr:hover {
  background: var(--bg-card-subtle);
}

/* ════ FÓRMULAS Y BLOQUES DE CÓDIGO ════ */
.formula-box, .ecuacion, pre, code {
  font-family: var(--font-mono);
}

.formula-box, .ecuacion {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin: 16px 0;
  text-align: center;
  font-size: 14px;
  color: var(--blue);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

code {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 13px;
  color: var(--blue);
}

/* ════ LISTAS ════ */
ul, ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

li {
  margin-bottom: 6px;
  color: var(--text);
}

/* ════ ESTILOS DE IMPRESIÓN (PRINT) ════ */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
  }
  .guide-shell {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-width: 100% !important;
  }
  .guide-topbar, .guide-actions, .guide-theme-toggle {
    display: none !important;
  }
  .guide-card, .card, .guide-callout, .callout {
    border: 1px solid #ccc !important;
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
  }
  a {
    text-decoration: none !important;
    color: #000 !important;
  }
}
