/* Variables, layout y estilos globales */
:root {
  --navy: #141932;
  --blue: #334b9a;
  --red: #e84d55;
  --bg: #eef1f7;
  --line: #d9deea;
  --text: #252a3b;
  --muted: #687086;
  --white: #ffffff;
  --accent-glow: rgba(51, 75, 154, 0.15);
  --sidebar-w: 280px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  color: var(--text);
  line-height: 1.6;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
aside {
  width: var(--sidebar-w);
  position: fixed;
  inset: 0 auto 0 0;
  background: var(--navy);
  padding: 24px 16px;
  color: white;
  overflow-y: auto;
  z-index: 100;
  box-shadow: 2px 0 12px rgba(17, 21, 44, 0.2);
}

aside img {
  width: 200px;
  max-width: 100%;
  display: block;
  margin: 0 auto 20px;
  transition: transform 0.2s ease;
}
aside img:hover {
  transform: scale(1.02);
}

.print-actions {
  margin: 0 4px 16px;
}

.btn-print-pdf {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: linear-gradient(135deg, var(--red) 0%, #c4323a 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(232, 77, 85, 0.35);
  transition: all 0.2s ease;
  margin-top: 0;
}

.btn-print-pdf:hover {
  background: linear-gradient(135deg, #ff5e66 0%, var(--red) 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(232, 77, 85, 0.45);
}

.btn-print-pdf svg {
  flex-shrink: 0;
}

aside h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #aeb8df;
  margin: 22px 10px 8px;
  font-weight: 700;
}

aside a {
  display: flex;
  align-items: center;
  color: #d7ddfc;
  text-decoration: none;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  margin-bottom: 3px;
  transition: all 0.2s ease;
}

aside a:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  padding-left: 15px;
}

aside a.active {
  background: var(--blue);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(51, 75, 154, 0.35);
}

/* Main Content */
main {
  margin-left: var(--sidebar-w);
  width: calc(100% - var(--sidebar-w));
  min-height: 100vh;
}

.page {
  max-width: 1100px;
  margin: auto;
  background: #ffffff;
  min-height: 100vh;
  box-shadow: 0 0 35px rgba(20, 25, 50, 0.06);
}

.hero {
  background: linear-gradient(135deg, #11152c 0%, #202b5c 50%, #314996 100%);
  color: white;
  padding: 65px 75px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(232, 77, 85, 0.2) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero img {
  width: 260px;
  max-width: 100%;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: 44px;
  line-height: 1.15;
  margin: 10px 0 16px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.hero p {
  font-size: 18px;
  max-width: 760px;
  color: #e7ebff;
  margin: 0 0 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  background: var(--red);
  color: #ffffff;
  border-radius: 99px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.4px;
  box-shadow: 0 3px 10px rgba(232, 77, 85, 0.3);
}

.section {
  padding: 48px 75px;
  border-bottom: 1px solid var(--line);
}

.section:last-of-type {
  border-bottom: none;
}

.section.alt {
  background: #f8f9fc;
}

h2 {
  font-size: 28px;
  color: var(--navy);
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.3px;
}

h3 {
  color: var(--blue);
  margin-top: 30px;
  font-size: 18px;
}

.footer {
  background: var(--navy);
  color: #dce2fa;
  padding: 35px 75px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.footer img {
  width: 160px;
}

.small {
  font-size: 13px;
  color: var(--muted);
}

ul, ol {
  padding-left: 24px;
}

li {
  margin-bottom: 6px;
}

/* Responsive */
@media (max-width: 900px) {
  aside {
    position: static;
    width: 100%;
  }
  .layout {
    display: block;
  }
  main {
    margin: 0;
    width: 100%;
  }
  .section, .hero, .footer {
    padding: 36px 24px;
  }
  .hero h1 {
    font-size: 32px;
  }
}

/* Carátula Web y de Impresión */
.print-cover {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(145deg, #11152c 0%, #1c2754 50%, #2f4896 100%);
  color: #ffffff;
  padding: 60px 65px;
  border-radius: 12px;
  margin: 20px 0 30px;
  box-shadow: 0 12px 36px rgba(17, 21, 44, 0.18);
  position: relative;
  overflow: hidden;
  min-height: 520px;
}

.print-cover::after {
  content: '';
  position: absolute;
  top: -80px;
  right: -80px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(232, 77, 85, 0.25) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.cover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 18px;
  margin-bottom: 24px;
}

.cover-logo {
  width: 220px;
  max-width: 100%;
}

.cover-badge-top {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #aeb8df;
  background: rgba(255, 255, 255, 0.08);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.cover-body {
  flex: 1;
}

.cover-tag {
  display: inline-block;
  background: var(--red);
  color: #ffffff;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.cover-title {
  font-size: 40px;
  line-height: 1.15;
  margin: 0 0 10px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.cover-subtitle {
  font-size: 18px;
  color: #dbe2ff;
  font-weight: 500;
  margin: 0 0 18px;
  line-height: 1.4;
}

.cover-divider {
  width: 70px;
  height: 4px;
  background: var(--red);
  border-radius: 2px;
  margin: 16px 0 20px;
}

.cover-desc {
  font-size: 14.5px;
  color: #d7deff;
  line-height: 1.6;
  max-width: 820px;
  margin: 0 0 24px;
}

.cover-pillars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.pillar-item {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 12px 14px;
  transition: transform 0.2s;
}

.pillar-item b {
  display: block;
  font-size: 13.5px;
  color: #ffffff;
  margin-bottom: 3px;
}

.pillar-item span {
  font-size: 11.5px;
  color: #bcc6ee;
}

.cover-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 16px;
  margin-top: 24px;
  font-size: 12px;
}

.cover-footer-left strong {
  display: block;
  font-size: 13px;
  color: #ffffff;
}

.cover-footer-left span {
  color: #aeb8df;
}

.cover-footer-right {
  text-align: right;
}

.cover-footer-right span {
  display: block;
  color: #aeb8df;
}

.cover-footer-right strong {
  color: #ffffff;
}

/* Membrete institucional para folleto / reporte PDF */
.print-letterhead {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 10mm 10mm 10mm;
  }

  *, *:before, *:after {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body {
    background: #ffffff !important;
    color: #1a1e2d !important;
    font-size: 9pt !important;
    line-height: 1.35 !important;
  }

  aside, .sidebar, .btn-print-pdf, .print-actions {
    display: none !important;
  }

  .layout, .main {
    display: block !important;
    margin: 0 !important;
    width: 100% !important;
  }

  main {
    margin: 0 !important;
    width: 100% !important;
  }

  .page {
    max-width: 100% !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Carátula Oficial en la primera hoja de impresión */
  .print-cover {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    background: #ffffff !important;
    border: 3px double #334b9a !important;
    border-radius: 8px !important;
    padding: 28px 24px !important;
    margin: 0 0 20px !important;
    min-height: 94vh !important;
    color: #141932 !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .print-cover::after {
    display: none !important;
  }

  .cover-header {
    border-bottom: 2px solid #334b9a !important;
    padding-bottom: 12px !important;
    margin-bottom: 18px !important;
  }

  .cover-logo {
    width: 170px !important;
  }

  .cover-badge-top {
    color: #334b9a !important;
    background: #eef3ff !important;
    border: 1px solid #ccd5f0 !important;
    font-size: 8pt !important;
    padding: 4px 10px !important;
  }

  .cover-tag {
    background: #e84d55 !important;
    color: #ffffff !important;
    font-size: 8pt !important;
    padding: 3px 10px !important;
  }

  .cover-title {
    font-size: 26pt !important;
    color: #141932 !important;
    margin: 6px 0 !important;
  }

  .cover-subtitle {
    font-size: 13pt !important;
    color: #334b9a !important;
    margin-bottom: 12px !important;
  }

  .cover-divider {
    background: #e84d55 !important;
    height: 3px !important;
    margin: 10px 0 14px !important;
  }

  .cover-desc {
    font-size: 9.5pt !important;
    color: #333d59 !important;
    line-height: 1.4 !important;
    margin-bottom: 16px !important;
  }

  .cover-pillars {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  .pillar-item {
    background: #f8f9fd !important;
    border: 1px solid #cbd2e0 !important;
    padding: 8px 10px !important;
  }

  .pillar-item b {
    color: #141932 !important;
    font-size: 9pt !important;
  }

  .pillar-item span {
    color: #555e75 !important;
    font-size: 8pt !important;
  }

  .cover-footer {
    border-top: 1px solid #334b9a !important;
    padding-top: 10px !important;
    margin-top: 18px !important;
    font-size: 8.5pt !important;
  }

  .cover-footer-left strong, .cover-footer-right strong {
    color: #141932 !important;
  }

  .cover-footer-left span, .cover-footer-right span {
    color: #555e75 !important;
  }

  /* Membrete formal en páginas subsecuentes */
  .print-letterhead {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--blue);
    padding-bottom: 4px !important;
    margin-bottom: 10px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .print-letterhead img {
    height: 26px !important;
    width: auto;
  }

  .print-letterhead-info {
    text-align: right;
  }

  .print-doc-title {
    font-size: 10.5pt !important;
    font-weight: 800;
    color: var(--navy);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
  }

  .print-doc-subtitle {
    font-size: 7.5pt !important;
    color: #555e75;
    margin: 1px 0 0 !important;
    font-weight: 600;
  }

  /* Portadas de módulos / Hero */
  .hero {
    background: #f4f6fa !important;
    color: #11152c !important;
    padding: 12px 14px !important;
    border: 1px solid var(--line) !important;
    border-radius: 6px !important;
    margin-bottom: 10px !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .hero::after {
    display: none !important;
  }

  .hero h1 {
    color: var(--navy) !important;
    font-size: 16pt !important;
    margin: 3px 0 4px !important;
    line-height: 1.15 !important;
  }

  .hero p {
    color: #333d59 !important;
    font-size: 9pt !important;
    margin: 0 0 6px !important;
  }

  .hero img {
    width: 110px !important;
    margin-bottom: 4px !important;
  }

  .badge {
    padding: 2px 7px !important;
    font-size: 7.5pt !important;
  }

  /* Reglas ANTI-CORTE en secciones y títulos */
  .section {
    padding: 8px 0 !important;
    border-bottom: 1px dashed #d5dbe5 !important;
    page-break-inside: auto;
  }

  h2, h3, h4 {
    color: var(--blue) !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  h2 {
    font-size: 12pt !important;
    margin: 8px 0 6px !important;
    padding-bottom: 2px;
  }

  h3 {
    font-size: 10pt !important;
    margin-top: 6px !important;
    margin-bottom: 4px !important;
  }

  p, ul, ol {
    margin: 3px 0 !important;
    orphans: 3;
    widows: 3;
  }

  ul, ol {
    padding-left: 16px !important;
  }

  li {
    margin-bottom: 2px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Grillas y tarjetas sin corte */
  .cardgrid, .grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 6px !important;
    margin: 6px 0 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .card {
    padding: 6px 8px !important;
    border-radius: 5px !important;
    font-size: 8.5pt !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    border: 1px solid #cbd2e0 !important;
  }

  .card b {
    font-size: 9pt !important;
  }

  .step {
    gap: 6px !important;
    margin: 4px 0 !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .num {
    width: 20px !important;
    height: 20px !important;
    flex: 0 0 20px !important;
    font-size: 9px !important;
  }

  /* Bloques de contenido: NO CORTAR AL IMPRIMIR */
  .note, .case, .exercise, .task, .challenge, .objective, .warning, .project, .success {
    border-radius: 5px !important;
    padding: 6px 10px !important;
    margin: 6px 0 !important;
    font-size: 8.5pt !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    border: 1px solid #cbd2e0 !important;
  }

  /* Código preformateado: NO CORTAR AL IMPRIMIR */
  pre {
    padding: 8px 10px !important;
    margin: 6px 0 !important;
    font-size: 8pt !important;
    border-radius: 5px !important;
    background: #171b31 !important;
    color: #eef1ff !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    white-space: pre-wrap !important;
    word-break: break-word !important;
  }

  /* Tablas: NO CORTAR FILAS AL IMPRIMIR */
  table {
    margin: 5px 0 !important;
    font-size: 8pt !important;
    page-break-inside: auto !important;
    break-inside: auto !important;
  }

  tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: auto !important;
  }

  thead {
    display: table-header-group !important;
  }

  th, td {
    padding: 3px 5px !important;
  }

  /* Simuladores y diagramas sin corte */
  .shot, .mock, .flow {
    margin: 6px 0 !important;
    border-radius: 5px !important;
    border: 1px solid #cbd2e0 !important;
    background: #fafbfe !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .flow {
    gap: 4px !important;
  }

  .flow div {
    padding: 6px !important;
    font-size: 8pt !important;
  }

  .shotbar, .bar {
    height: 20px !important;
    padding: 0 6px !important;
    font-size: 8pt !important;
  }

  .ribbon {
    height: 28px !important;
    gap: 6px !important;
    padding: 0 8px !important;
  }

  .ribbonbtn {
    padding: 2px 6px !important;
    font-size: 8pt !important;
  }

  .workspace {
    min-height: 110px !important;
  }

  .pq {
    height: 120px !important;
  }

  /* Dashboards: NO CORTAR AL IMPRIMIR */
  .dash {
    padding: 8px 10px !important;
    margin: 6px 0 !important;
    border-radius: 5px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    border: 1px solid #cbd2e0 !important;
  }

  .dash .title {
    font-size: 10pt !important;
    padding-bottom: 3px !important;
    margin-bottom: 6px !important;
  }

  .dash .kpis {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 5px !important;
    margin-bottom: 6px !important;
  }

  .dash .kpi {
    padding: 4px 6px !important;
  }

  .dash .kpi b {
    font-size: 7pt !important;
  }

  .dash .kpi strong {
    font-size: 10pt !important;
  }

  .dash .charts {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }

  .dash .chart-card {
    padding: 6px !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .dash .chart-card b {
    font-size: 8pt !important;
    margin-bottom: 3px !important;
  }

  .dash .chart-container {
    height: 120px !important;
  }

  /* Footer */
  .footer {
    background: transparent !important;
    color: #555e75 !important;
    border-top: 1px solid #cbd2e0 !important;
    padding: 6px 0 0 !important;
    margin-top: 10px !important;
    font-size: 7pt !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .footer img {
    height: 18px !important;
    width: auto;
  }
}


