/* ==========================================================
   VARIABLES Y COLORES CORPORATIVOS
   ========================================================== */
:root {
    --primary: #201d5c;
    --primary-dark: #161442;
    --primary-light: #f0f0fa;
    --accent: #CE1F26;
    --accent-hover: #b0191f;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #CE1F26;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-w: 280px;
}

/* ==========================================================
   MODO OSCURO
   ========================================================== */
body.dark-mode {
    --bg-body: #0b0f19;
    --bg-card: #151c2c;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #243048;
    background-color: var(--bg-body);
    color: var(--text-main);
}
body.dark-mode .sidebar {
    background: #0f1626;
    border-right-color: var(--border-color);
}
body.dark-mode .sidebar-footer {
    background: #0b1120;
    border-top-color: var(--border-color);
}
body.dark-mode .nav-item a {
    color: #94a3b8;
}
body.dark-mode .nav-item a:hover,
body.dark-mode .nav-item a.active {
    background: rgba(32, 29, 92, 0.45);
    color: #ffffff;
}
body.dark-mode .card,
body.dark-mode .step-item,
body.dark-mode .faq-item,
body.dark-mode .changelog-card,
body.dark-mode .video-block-container,
body.dark-mode .feedback-box,
body.dark-mode .floating-support-btn {
    background: var(--bg-card);
    border-color: var(--border-color);
}
body.dark-mode .search-box input {
    background: #111827;
    border-color: var(--border-color);
    color: #f1f5f9;
}
body.dark-mode kbd {
    background: #1e293b;
    border-color: #334155;
    color: #38bdf8;
}
body.dark-mode .version-badge {
    background: #1e293b;
    color: #38bdf8;
    border-color: #334155;
}
body.dark-mode .copy-btn,
body.dark-mode .btn-feedback {
    background: #1e293b;
    color: #f1f5f9;
    border-color: var(--border-color);
}

/* ==========================================================
   RESET Y ESTRUCTURA BASE
   ========================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    min-height: 100vh;
}

/* ==========================================================
   BARRA LATERAL (SIDEBAR)
   ========================================================== */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: #ffffff;
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    z-index: 100;
}
.brand-header {
    padding: 24px 20px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid var(--border-color);
}
.brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 6px rgba(32, 29, 92, 0.08);
    overflow: hidden;
    flex-shrink: 0;
}
.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 2px;
}
.brand-text h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
}
.brand-text span {
    font-size: 12px;
    color: var(--text-muted);
}
.sidebar-scroll-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}
.search-box {
    position: relative;
    margin-bottom: 20px;
}
.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    fill: var(--text-muted);
}
.search-box input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-main);
    outline: none;
    transition: all 0.2s;
}
.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(32, 29, 92, 0.1);
}
.nav-category {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 18px 0 8px 6px;
}
.nav-list {
    list-style: none;
}
.nav-item a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.15s ease;
}
.nav-item a:hover {
    background: var(--primary-light);
    color: var(--primary);
}
.nav-item a.active {
    background: var(--primary);
    color: #ffffff;
}
.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border-color);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.version-badge {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 6px;
    border: 1px solid rgba(32, 29, 92, 0.12);
}
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    cursor: pointer;
    font-size: 17px;
    transition: transform 0.2s ease;
}
.theme-toggle-btn:hover {
    transform: scale(1.08);
}

/* ==========================================================
   ÁREA PRINCIPAL (MAIN CONTENT)
   ========================================================== */
.main-content {
    margin-left: var(--sidebar-w);
    width: calc(100% - var(--sidebar-w));
    padding: 48px 64px 80px;
    max-width: 1200px;
}

/* En modo web, la tabla se comporta como un contenedor transparente normal */
.print-layout-table {
    width: 100%;
    border-collapse: collapse;
    border: none;
}
.print-layout-table,
.print-layout-head,
.print-layout-foot,
.print-layout-body,
.print-layout-head tr,
.print-layout-foot tr,
.print-layout-body tr,
.print-layout-head td,
.print-layout-foot td,
.print-layout-body td {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
}
.print-layout-head,
.print-layout-foot {
    display: none; /* Oculto completamente en la web */
}

/* ==========================================================
   HERO / BANNER PRINCIPAL
   ========================================================== */
.hero {
    background: linear-gradient(135deg, #161442 0%, #201d5c 60%, #301f5c 100%);
    color: #ffffff;
    border-radius: 16px;
    padding: 42px 48px;
    margin-bottom: 44px;
    box-shadow: 0 10px 30px rgba(32, 29, 92, 0.15);
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: "";
    position: absolute;
    top: -50px;
    right: -50px;
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(206, 31, 38, 0.35) 0%, transparent 70%);
    border-radius: 50%;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    background: rgba(206, 31, 38, 0.22);
    border: 1px solid rgba(206, 31, 38, 0.45);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    color: #fca5a5;
    margin-bottom: 16px;
}
.hero h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
    line-height: 1.25;
}
.hero p {
    font-size: 15px;
    color: #cbd5e1;
    max-width: 760px;
    line-height: 1.6;
    margin-bottom: 22px;
}
.hero-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}
.btn-install {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--accent);
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(206, 31, 38, 0.35);
    transition: all 0.2s ease;
}
.btn-install:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(206, 31, 38, 0.45);
}
.btn-print-guide {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 18px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-print-guide:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================
   SECCIONES Y COMPONENTES
   ========================================================== */
.section-block {
    margin-bottom: 56px;
    scroll-margin-top: 30px;
}
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}
.section-icon {
    font-size: 24px;
}
.section-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}
.deep-link {
    opacity: 0;
    font-size: 16px;
    color: var(--text-muted);
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s;
}
.section-header:hover .deep-link {
    opacity: 1;
}
.deep-link:hover {
    color: var(--primary);
}

/* Video Tutorial */
.video-block-container {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 22px;
    margin-bottom: 26px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}
.video-responsive-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #000000;
}
.video-responsive-wrapper iframe,
.video-responsive-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.video-meta-description {
    margin-top: 14px;
    font-size: 14px;
    line-height: 1.6;
}

/* Pasos */
.steps-container {
    margin: 24px 0;
}
.step-item {
    display: flex;
    gap: 18px;
    margin-bottom: 24px;
}
.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.step-content h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}
.step-content div {
    font-size: 14px;
    color: var(--text-muted);
}

/* Tarjetas */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.card {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.card-title {
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

/* Alertas */
.callout {
    display: flex;
    gap: 14px;
    padding: 16px 20px;
    border-radius: 10px;
    margin-bottom: 22px;
    font-size: 14px;
    background: #f8fafc;
    border-left: 4px solid var(--primary);
}
.callout-warning {
    border-left-color: var(--warning);
    background: #fffbeb;
}
.callout-tip {
    border-left-color: var(--success);
    background: #f0fdf4;
}

/* Atajos */
.shortcut-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 28px;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}
.shortcut-table th,
.shortcut-table td {
    padding: 14px 18px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}
.shortcut-table th {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
}
kbd {
    display: inline-block;
    padding: 3px 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.copy-btn {
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
    transition: all 0.2s;
}
.copy-btn:hover {
    background: var(--primary);
    color: #ffffff;
}

/* FAQs */
.faq-item {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}
.faq-question {
    padding: 16px 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.faq-answer {
    display: none;
    padding: 0 20px 18px;
    font-size: 14px;
    color: var(--text-muted);
}
.faq-item.open .faq-answer {
    display: block;
}

/* Feedback */
.feedback-box {
    margin-top: 26px;
    padding: 16px 22px;
    background: #f8fafc;
    border: 1px dashed var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.feedback-actions {
    display: flex;
    gap: 10px;
}
.btn-feedback {
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-feedback:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Changelog */
.changelog-timeline {
    position: relative;
    padding-left: 32px;
    margin-top: 24px;
}
.changelog-timeline::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: #cbd5e1;
}
.changelog-card {
    position: relative;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.changelog-dot {
    position: absolute;
    left: -30px;
    top: 24px;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border: 3px solid #ffffff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--primary);
}
.changelog-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.version-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    padding: 4px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 6px;
}
.version-date {
    font-size: 12px;
    color: var(--text-muted);
}
.changelog-body {
    font-size: 14px;
    color: #334155;
    line-height: 1.7;
}
.changelog-body ul {
    margin-left: 20px;
    margin-top: 8px;
}
.changelog-body li {
    margin-bottom: 6px;
}

/* ==========================================================
   BOTÓN FLOTANTE DE SOPORTE RÁPIDO
   ========================================================== */
.floating-support-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    padding: 10px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 99;
    transition: all 0.2s ease;
}
.floating-support-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
    border-color: var(--primary);
}

/* ==========================================================
   MODAL DE IMÁGENES (LIGHTBOX)
   ========================================================== */
.lightbox-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}
.lightbox-modal.active {
    display: flex;
}
.lightbox-modal img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ==========================================================
   FOOTER WEB
   ========================================================== */
.doc-footer {
    margin-top: 60px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 12px;
}
.doc-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* ==========================================================
   ARQUITECTURA DE IMPRESIÓN / PDF INSTITUCIONAL PROFESIONAL
   ========================================================== */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    @page {
        margin: 1.2cm 1.4cm 1.2cm 1.4cm;
        size: letter;
    }

    body {
        background: #ffffff !important;
        color: #0f172a !important;
        font-size: 10pt !important;
        line-height: 1.5 !important;
        display: block !important;
    }

    /* Ocultar interfaz web interactiva */
    .sidebar,
    .theme-toggle-btn,
    .search-box,
    .feedback-box,
    .copy-btn,
    .deep-link,
    .floating-support-btn,
    .hero-actions,
    .lightbox-modal,
    .doc-footer,
    .video-responsive-wrapper iframe,
    .video-responsive-wrapper video {
        display: none !important;
    }

    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    /* ACTIVACIÓN DE TABLA MAQUETADORA PARA REPETICIÓN LIMPIA */
    .print-layout-table {
        display: table !important;
        width: 100% !important;
        border-collapse: collapse !important;
        border: none !important;
    }
    .print-layout-head {
        display: table-header-group !important; /* Se repite arriba en cada hoja */
    }
    .print-layout-foot {
        display: table-footer-group !important; /* Se repite abajo en cada hoja */
    }
    .print-layout-body {
        display: table-row-group !important;
    }
    .print-layout-table tr {
        display: table-row !important;
    }
    .print-layout-table td {
        display: table-cell !important;
        border: none !important;
        padding: 0 !important;
    }

    /* ENCABEZADO REPETIDO: NO USA POSITION FIXED, NUNCA TAPA CONTENIDO */
    .print-header-pdf {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        border-bottom: 2px solid #201d5c !important;
        padding-bottom: 8px !important;
        margin-bottom: 20px !important;
        background: #ffffff !important;
    }
    .print-header-left {
        display: flex !important;
        align-items: center !important;
        gap: 10px !important;
    }
    .print-ext-name a {
        font-weight: 800 !important;
        font-size: 12pt !important;
        color: #201d5c !important;
        text-decoration: underline !important;
    }
    .print-version {
        font-family: 'JetBrains Mono', monospace !important;
        font-size: 8.5pt !important;
        font-weight: 700 !important;
        background: #f1f5f9 !important;
        border: 1px solid #cbd5e1 !important;
        padding: 2px 7px !important;
        border-radius: 4px !important;
        color: #201d5c !important;
    }
    .print-platform-link {
        font-weight: 700 !important;
        font-size: 10.5pt !important;
        color: #CE1F26 !important;
        text-decoration: underline !important;
    }

    /* PIE DE PÁGINA REPETIDO: RESERVA SU ESPACIO AUTOMÁTICAMENTE */
    .print-footer-pdf {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        border-top: 1px solid #cbd5e1 !important;
        padding-top: 8px !important;
        margin-top: 18px !important;
        font-size: 8.5pt !important;
        color: #64748b !important;
        background: #ffffff !important;
    }
    .print-footer-pdf a {
        color: #201d5c !important;
        text-decoration: underline !important;
        font-weight: 600 !important;
    }

    /* HERO BANNER */
    .hero {
        background: #201d5c !important;
        color: #ffffff !important;
        border-radius: 6px !important;
        padding: 20px 24px !important;
        margin-bottom: 24px !important;
        box-shadow: none !important;
        page-break-inside: avoid !important;
    }
    .hero::after {
        display: none !important;
    }
    .hero-badge {
        background: rgba(206, 31, 38, 0.35) !important;
        border: 1px solid rgba(255, 255, 255, 0.4) !important;
        color: #ffffff !important;
        margin-bottom: 8px !important;
        font-size: 8.5pt !important;
    }
    .hero h1 {
        font-size: 17pt !important;
        color: #ffffff !important;
        margin-bottom: 6px !important;
    }
    .hero p {
        color: #e2e8f0 !important;
        font-size: 9.5pt !important;
        line-height: 1.4 !important;
    }

    /* BLOQUES Y TARJETAS */
    .section-block {
        margin-bottom: 24px !important;
    }
    .section-header {
        border-bottom: 1.5px solid #201d5c !important;
        padding-bottom: 6px !important;
        margin-bottom: 12px !important;
        page-break-after: avoid !important;
    }
    .section-header h2 {
        font-size: 13pt !important;
        color: #201d5c !important;
    }
    .card, 
    .step-item, 
    .faq-item, 
    .changelog-card, 
    .video-block-container {
        page-break-inside: avoid !important;
        box-shadow: none !important;
        border: 1px solid #cbd5e1 !important;
        margin-bottom: 10px !important;
        background: #ffffff !important;
    }
    .video-block-container::after {
        content: "🎥 Video interactivo disponible en la plataforma web.";
        display: block;
        font-size: 8.5pt;
        color: #64748b;
        font-style: italic;
        margin-top: 4px;
    }
    .faq-answer {
        display: block !important;
        padding: 6px 14px 10px !important;
        font-size: 9pt !important;
    }
}