/* ==========================================================================
   KILOPOLIS ACADEMIA · MANUALES Y TUTORIALES INTERACTIVOS
   Estilo Moderno Inspirado en W3Schools y Documentación Oficial
   ========================================================================== */

:root {
  --kilo-manual-primary: #2563eb;
  --kilo-manual-navy: #0b1536;
  --kilo-manual-dark: #0f172a;
  --kilo-manual-green: #059669;
  --kilo-manual-green-hover: #047857;
  --kilo-manual-bg: #f8fafc;
  --kilo-manual-card: #ffffff;
  --kilo-manual-border: #e2e8f0;
  --kilo-manual-text: #1e293b;
  --kilo-manual-muted: #64748b;
  --kilo-sidebar-w: 290px;
}

/* Layout Container */
.manual-wrapper {
  display: flex;
  min-height: calc(100vh - 74px);
  background-color: #ffffff;
  position: relative;
}

/* Sidebar de Navegación */
.manual-sidebar {
  width: var(--kilo-sidebar-w);
  min-width: var(--kilo-sidebar-w);
  background: #f8fafc;
  border-right: 1px solid var(--kilo-manual-border);
  height: calc(100vh - 74px);
  position: sticky;
  top: 74px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.manual-sidebar-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--kilo-manual-border);
  background: #ffffff;
}

.manual-search-box {
  position: relative;
  margin-top: 8px;
}

.manual-search-box input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  font-size: 0.85rem;
  border: 1px solid var(--kilo-manual-border);
  border-radius: 8px;
  background: #f1f5f9;
  outline: none;
  transition: all 0.2s ease;
}

.manual-search-box input:focus {
  background: #ffffff;
  border-color: var(--kilo-manual-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.manual-search-box i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--kilo-manual-muted);
  font-size: 0.95rem;
}

.manual-sidebar-menu {
  padding: 14px 10px 40px;
  flex-grow: 1;
}

.manual-menu-group {
  margin-bottom: 18px;
}

.manual-group-title {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--kilo-manual-muted);
  padding: 6px 12px;
  margin-bottom: 4px;
}

.manual-menu-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 0.875rem;
  color: #334155;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.15s ease;
  line-height: 1.35;
}

.manual-menu-link:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.manual-menu-link.active {
  background: #eff6ff;
  color: var(--kilo-manual-primary);
  font-weight: 600;
  border-left: 3px solid var(--kilo-manual-primary);
  border-radius: 0 6px 6px 0;
}

/* Área de Contenido Principal */
.manual-content-main {
  flex-grow: 1;
  padding: 32px 48px 60px;
  max-width: 960px;
  min-width: 0;
}

/* Encabezados y Textos */
.manual-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 20px;
  background: #eff6ff;
  color: var(--kilo-manual-primary);
  margin-bottom: 8px;
}

.manual-title {
  font-size: 2.15rem;
  font-weight: 800;
  color: var(--kilo-manual-navy);
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  line-height: 1.25;
}

.manual-lead {
  font-size: 1.1rem;
  color: #475569;
  line-height: 1.6;
  margin-bottom: 24px;
}

.manual-section {
  margin: 32px 0 24px;
}

.manual-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--kilo-manual-navy);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.manual-section h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin: 20px 0 10px;
}

.manual-section p {
  font-size: 0.98rem;
  color: #334155;
  line-height: 1.65;
  margin-bottom: 14px;
}

.manual-checklist {
  list-style: none;
  padding-left: 0;
  margin: 14px 0 20px;
}

.manual-checklist li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 8px;
  font-size: 0.95rem;
  color: #334155;
  line-height: 1.5;
}

.manual-checklist li::before {
  content: "✔";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--kilo-manual-green);
  font-weight: bold;
}

/* Alertas Didácticas */
.manual-alert {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 20px;
  border-radius: 10px;
  margin: 22px 0;
  font-size: 0.93rem;
  line-height: 1.55;
}

.manual-alert.info {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.manual-alert.tip {
  background: #fefce8;
  border: 1px solid #fef08a;
  color: #854d0e;
}

.manual-alert.warning {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.manual-alert-icon {
  font-size: 1.3rem;
  line-height: 1;
}

/* Tablas Didácticas */
.manual-table-wrap {
  overflow-x: auto;
  margin: 20px 0 24px;
  border: 1px solid var(--kilo-manual-border);
  border-radius: 8px;
}

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

.manual-table th {
  background: #f8fafc;
  padding: 12px 16px;
  font-weight: 700;
  color: #1e293b;
  border-bottom: 1px solid var(--kilo-manual-border);
}

.manual-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
}

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

.manual-table tr:nth-child(even) td {
  background: #fafafa;
}

/* ==========================================================================
   CAJETÍN DE EJEMPLO INTERACTIVO (W3SCHOOLS STYLE)
   ========================================================================== */
.manual-example-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 4px solid var(--kilo-manual-green);
  border-radius: 10px;
  padding: 22px 24px;
  margin: 28px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.manual-example-box h3.example-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin-top: 0;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.manual-example-box p.example-desc {
  font-size: 0.93rem;
  color: #475569;
  margin-bottom: 14px;
}

.manual-code-snippet {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.manual-code-snippet pre {
  margin: 0;
  font-family: 'Fira Code', 'Consolas', monospace;
  font-size: 0.9rem;
  color: #0f172a;
  line-height: 1.6;
}

.manual-btn-try {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--kilo-manual-green);
  color: #ffffff !important;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 10px 22px;
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

.manual-btn-try:hover {
  background-color: var(--kilo-manual-green-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
}

/* Botones de Navegación Anterior / Siguiente */
.manual-nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 40px 0 32px;
  padding-top: 24px;
  border-top: 1px solid var(--kilo-manual-border);
}

.manual-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.manual-nav-btn.prev {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--kilo-manual-border);
}

.manual-nav-btn.prev:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.manual-nav-btn.next {
  background: var(--kilo-manual-primary);
  color: #ffffff;
  margin-left: auto;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}

.manual-nav-btn.next:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

/* Tarjeta Freemium CTA hacia el Bootcamp */
.manual-cta-bootcamp {
  background: linear-gradient(135deg, #0b1536 0%, #1e2a5e 100%);
  color: #ffffff;
  border-radius: 12px;
  padding: 26px 30px;
  margin-top: 40px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(11, 21, 54, 0.2);
}

.manual-cta-bootcamp h4 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 8px;
}

.manual-cta-bootcamp p {
  color: #cbd5e1;
  font-size: 0.95rem;
  margin-bottom: 16px;
  max-width: 650px;
}

.manual-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #38bdf8;
  color: #0b1536 !important;
  font-weight: 700;
  padding: 10px 22px;
  border-radius: 30px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.manual-cta-btn:hover {
  background: #7dd3fc;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(56, 189, 248, 0.4);
}

/* Botón flotante móvil para desplegar temario */
.manual-mobile-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--kilo-manual-navy);
  color: #ffffff;
  border: none;
  border-radius: 30px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  z-index: 100;
  cursor: pointer;
}

/* Responsividad */
@media (max-width: 991px) {
  .manual-sidebar {
    position: fixed;
    top: 74px;
    left: -100%;
    width: 320px;
    height: calc(100vh - 74px);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 5px 0 25px rgba(0,0,0,0.25);
  }

  .manual-sidebar.open {
    left: 0;
  }

  .manual-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 15;
  }

  .manual-sidebar-backdrop.active {
    display: block;
  }

  .manual-content-main {
    padding: 24px 20px 60px;
  }

  .manual-title {
    font-size: 1.75rem;
  }

  .manual-mobile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
}

/* ==========================================================================
   VENTANA DE CÓDIGO CON APARIENCIA DE IDE (MODO SOLO LECTURA)
   Soporte para HTML5, CSS3, JavaScript, PHP 8 y MySQL / SQL
   ========================================================================== */
.kilo-ide-window {
  background: #181b20;
  border: 1px solid #282c34;
  border-radius: 10px;
  overflow: hidden;
  margin: 20px 0;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.35);
  font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
}

.kilo-ide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #131519;
  border-bottom: 1px solid #282c34;
  padding: 8px 14px;
  user-select: none;
}

.kilo-ide-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.kilo-ide-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #181b20;
  color: #abb2bf;
  padding: 4px 12px;
  border-radius: 6px 6px 0 0;
  border-top: 2px solid #0284c7;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.kilo-ide-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.kilo-ide-readonly-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: #64748b;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kilo-ide-copy-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.kilo-ide-copy-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
}

.kilo-ide-copy-btn.copied {
  background: #059669 !important;
  border-color: #10b981 !important;
  color: #ffffff !important;
}

.kilo-ide-body {
  padding: 0;
  margin: 0;
  background: #181b20 !important;
  color: #e2e8f0 !important;
}

/* Fallback para bloques <pre> dentro del contenido antes o después de ser procesados */
.manual-body-content pre {
  background: #181b20 !important;
  color: #e2e8f0 !important;
  border-radius: 8px;
  border: 1px solid #282c34;
}

.manual-body-content pre code {
  color: #e2e8f0 !important;
  font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace !important;
}

.kilo-ide-body pre {
  margin: 0 !important;
  padding: 16px 20px !important;
  background: transparent !important;
  color: #e2e8f0 !important;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.65;
}

.kilo-ide-body pre code,
.kilo-ide-body pre code.hljs {
  padding: 0 !important;
  background: transparent !important;
  color: #e2e8f0 !important;
  font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace !important;
  font-size: 0.88rem !important;
  line-height: 1.65 !important;
}

/* Contraste absoluto para cualquier código plano o lenguaje sin tokens */
.kilo-ide-body pre code,
.kilo-ide-body pre code:not(.hljs),
.kilo-ide-body pre code.language-plaintext,
.kilo-ide-body pre code.language-text,
.kilo-ide-body pre code.language-bat,
.kilo-ide-body pre code.language-apache,
.kilo-ide-body pre code.language-ini,
.kilo-ide-body pre code.language-bash,
.kilo-ide-body pre code.language-sh {
  color: #e2e8f0 !important;
}

/* Tokens de sintaxis Highlight.js con máximo contraste sobre fondo oscuro */
.kilo-ide-body pre code .hljs-comment,
.kilo-ide-body pre code .hljs-quote,
.hljs-comment,
.hljs-quote {
  color: #94a3b8 !important; /* Slate-400: muy nítido y legible */
  font-style: italic;
}

.kilo-ide-body pre code .hljs-keyword,
.kilo-ide-body pre code .hljs-selector-tag,
.kilo-ide-body pre code .hljs-subst,
.hljs-keyword,
.hljs-selector-tag,
.hljs-subst {
  color: #c678dd !important; /* Púrpura */
  font-weight: 600;
}

.kilo-ide-body pre code .hljs-string,
.kilo-ide-body pre code .hljs-regexp,
.kilo-ide-body pre code .hljs-addition,
.hljs-string,
.hljs-regexp,
.hljs-addition {
  color: #98c379 !important; /* Verde menta */
}

.kilo-ide-body pre code .hljs-title,
.kilo-ide-body pre code .hljs-section,
.kilo-ide-body pre code .hljs-function,
.kilo-ide-body pre code .hljs-title.function_,
.hljs-title,
.hljs-section,
.hljs-function,
.hljs-title.function_ {
  color: #61aeee !important; /* Azul cielo */
}

.kilo-ide-body pre code .hljs-variable,
.kilo-ide-body pre code .hljs-template-variable,
.kilo-ide-body pre code .hljs-variable.language_,
.hljs-variable,
.hljs-template-variable,
.hljs-variable.language_ {
  color: #e5c07b !important; /* Amarillo cálido */
}

.kilo-ide-body pre code .hljs-number,
.kilo-ide-body pre code .hljs-literal,
.hljs-number,
.hljs-literal {
  color: #d19a66 !important; /* Naranja ámbar */
}

.kilo-ide-body pre code .hljs-attr,
.kilo-ide-body pre code .hljs-attribute,
.kilo-ide-body pre code .hljs-tag,
.hljs-attr,
.hljs-attribute,
.hljs-tag {
  color: #56b6c2 !important; /* Cian turquesa */
}

.kilo-ide-body pre code .hljs-built_in,
.kilo-ide-body pre code .hljs-class .hljs-title,
.hljs-built_in,
.hljs-class .hljs-title {
  color: #e5c07b !important;
}

.manual-table .kilo-ide-window {
  margin: 6px 0;
  font-size: 0.82rem;
}
.manual-table .kilo-ide-header {
  padding: 4px 10px;
}
.manual-table .kilo-ide-body pre {
  padding: 10px 12px !important;
  font-size: 0.82rem;
}

.kilo-ide-body pre::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}
.kilo-ide-body pre::-webkit-scrollbar-track {
  background: #131519;
}
.kilo-ide-body pre::-webkit-scrollbar-thumb {
  background: #333842;
  border-radius: 4px;
}
.kilo-ide-body pre::-webkit-scrollbar-thumb:hover {
  background: #4b5263;
}

/* ==========================================================================
   MINI-QUIZZES DE RETENCIÓN ACTIVA
   ========================================================================== */
.quiz-option-btn:not([disabled]):hover {
  background-color: #f8fafc !important;
  border-color: #94a3b8 !important;
  transform: translateX(4px);
}
.quiz-option-btn[disabled] {
  cursor: default;
}
.quiz-option-btn:focus {
  box-shadow: none;
}
