/* ================================================
   SpGestion – Manual de Uso
   Hoja de estilos compartida
   ================================================ */

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

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primario:   #1a4a8a;
    --color-secundario: #2563eb;
    --color-acento:     #3b82f6;
    --color-fondo:      #f4f6fb;
    --color-sidebar:    #1e293b;
    --color-sidebar-txt:#cbd5e1;
    --color-sidebar-act:#ffffff;
    --color-borde:      #dde3ef;
    --color-nota:       #eff6ff;
    --color-nota-borde: #3b82f6;
    --color-advertencia:#fff7ed;
    --color-adv-borde:  #f97316;
    --color-texto:      #1e293b;
    --color-texto-suave:#64748b;
    --sidebar-w:        250px;
    --sidebar-collapsed: 48px;
    --transition:       .22s ease;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: var(--color-texto);
    background: var(--color-fondo);
    overflow: hidden;           /* el scroll lo maneja #contenido */
}

/* ══════════════════════════════════════
   SIDEBAR — fijo, colapsable
══════════════════════════════════════ */
#sidebar {
    width: var(--sidebar-w);
    background: var(--color-sidebar);
    height: 100vh;
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 200;
    transition: width var(--transition);
}

/* Estado colapsado */
body.sidebar-collapsed #sidebar {
    width: var(--sidebar-collapsed);
}

/* ── Cabecera del sidebar ── */
#sidebar .brand {
    padding: 14px 14px 12px;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    flex-shrink: 0;
}

#sidebar .brand .brand-text {
    overflow: hidden;
    white-space: nowrap;
    transition: opacity var(--transition), width var(--transition);
}

#sidebar .brand h1 {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    white-space: nowrap;
}

#sidebar .brand p {
    font-size: 10.5px;
    color: #94a3b8;
    margin-top: 2px;
    white-space: nowrap;
}

/* ── Botón FAQ ── */
#btn-faq {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    margin-left: auto;
    padding: 4px;
    transition: transform 0.2s, filter 0.2s;
    filter: grayscale(1);
}
#btn-faq:hover {
    transform: scale(1.15);
    filter: grayscale(0);
}
body.sidebar-collapsed #btn-faq {
    display: none;
}

body.sidebar-collapsed #sidebar .brand-text {
    opacity: 0;
    width: 0;
    pointer-events: none;
}

/* ── Modal FAQ ── */
.faq-modal {
    position: absolute;
    top: 57px; /* Debajo de brand */
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 41, 59, 0.98);
    backdrop-filter: blur(4px);
    z-index: 400;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform var(--transition);
}
.faq-modal.abierto {
    transform: translateX(0);
}
body.sidebar-collapsed .faq-modal {
    display: none;
}
.faq-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid #334155;
    background: #0f172a;
}
.faq-header h3 {
    color: var(--color-acento);
    font-size: 13.5px;
    font-weight: 700;
}
.faq-header button {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.faq-header button:hover {
    color: #fff;
}
.faq-body {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}
.faq-body a {
    display: block;
    padding: 12px 14px;
    color: #cbd5e1;
    font-size: 12.5px;
    text-decoration: none;
    border-bottom: 1px solid #334155;
    transition: background 0.15s;
    line-height: 1.4;
}
.faq-body a::before {
    content: "▸";
    margin-right: 6px;
    color: var(--color-acento);
}
.faq-body a:hover {
    background: rgba(255,255,255,.05);
    color: #fff;
}

/* ── Buscador ── */
.search-container {
    padding: 10px 14px;
    border-bottom: 1px solid #334155;
    position: relative;
    transition: opacity var(--transition);
}
body.sidebar-collapsed .search-container {
    opacity: 0;
    pointer-events: none;
    height: 0;
    padding: 0;
    overflow: hidden;
}
.search-container input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #334155;
    background: #0f172a;
    color: #fff;
    font-size: 13px;
    outline: none;
}
.search-container input::placeholder {
    color: #64748b;
}
.search-container input:focus {
    border-color: var(--color-acento);
}
.search-results {
    position: absolute;
    top: 100%;
    left: 14px;
    right: 14px;
    background: #1e293b;
    border: 1px solid #334155;
    border-top: none;
    border-radius: 0 0 4px 4px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 300;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}
.search-results::-webkit-scrollbar { width: 6px; }
.search-results::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }

.search-results a {
    display: block;
    padding: 8px 10px;
    color: #cbd5e1;
    font-size: 12px;
    text-decoration: none;
    border-bottom: 1px solid #334155;
    line-height: 1.4;
}
.search-results a:last-child {
    border-bottom: none;
}
.search-results a:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
}
.search-results .res-title {
    font-weight: 700;
    color: var(--color-acento);
    margin-bottom: 2px;
}
.search-results .res-snippet {
    font-size: 11px;
    color: #94a3b8;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Botón toggle ── */
#btn-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color .15s, background .15s;
    min-width: 28px;
}

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

#btn-toggle svg {
    width: 20px;
    height: 20px;
}

/* ── Navegación del sidebar ── */
#sidebar nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 0 20px;
    scrollbar-width: thin;
    scrollbar-color: #334155 transparent;
}

#sidebar nav .seccion-titulo {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #475569;
    padding: 14px 14px 5px;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition);
}

body.sidebar-collapsed #sidebar nav .seccion-titulo {
    opacity: 0;
    pointer-events: none;
}

#sidebar nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 14px;
    color: var(--color-sidebar-txt);
    text-decoration: none;
    font-size: 13px;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    transition: background .15s, border-color .15s, color .15s;
}

#sidebar nav a:hover {
    background: rgba(255,255,255,.06);
    color: #fff;
    border-left-color: var(--color-acento);
}

#sidebar nav a.activo {
    background: rgba(59,130,246,.18);
    color: var(--color-sidebar-act);
    border-left-color: var(--color-acento);
    font-weight: 600;
}

/* Etiqueta de número de sección */
#sidebar nav a .num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #334155;
    color: #94a3b8;
    font-size: 10px;
    border-radius: 4px;
    padding: 2px 5px;
    font-weight: 700;
    flex-shrink: 0;
    min-width: 22px;
}

#sidebar nav a.activo .num {
    background: var(--color-acento);
    color: #fff;
}

/* Texto del enlace se oculta al colapsar */
#sidebar nav a .link-txt {
    overflow: hidden;
    white-space: nowrap;
    transition: opacity var(--transition);
}

body.sidebar-collapsed #sidebar nav a .link-txt {
    opacity: 0;
    pointer-events: none;
}

/* ── Flecha de expansión ── */
#sidebar nav a.tiene-subitems {
    justify-content: space-between;
}

#sidebar nav a.tiene-subitems .flecha {
    font-size: 13px; /* Aumentado para mejor visibilidad */
    margin-left: auto;
    transition: transform var(--transition), color 0.2s, text-shadow 0.2s;
    flex-shrink: 0;
    color: #94a3b8; /* Gris más claro y visible */
}

#sidebar nav a.tiene-subitems:hover .flecha {
    color: #e2e8f0; /* Se ilumina al pasar el mouse por la sección */
}

#sidebar nav a.tiene-subitems.expandido .flecha {
    transform: rotate(90deg);
    color: var(--color-acento);
    text-shadow: 0 0 5px rgba(0, 163, 255, 0.5); /* Sutil resplandor azul */
}

body.sidebar-collapsed #sidebar nav a .flecha {
    display: none;
}

/* ── Sub-items ── */
.subitems {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    max-height: 0;
    transition: max-height .25s ease;
}

.subitems.abierto {
    max-height: 1200px;
}

body.sidebar-collapsed .subitems {
    max-height: 0 !important;
}

.subitems li a {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 14px 5px 32px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 12px;
    border-left: 3px solid transparent;
    white-space: nowrap;
    overflow: hidden;
    transition: background .15s, color .15s, border-color .15s;
}

.subitems li a::before {
    content: '•';
    color: var(--color-acento); /* Punto azul visible */
    font-size: 18px; /* Un poco más grande para que se note */
    flex-shrink: 0;
    transition: color 0.2s, transform 0.2s;
}

.subitems li a:hover::before {
    color: #fff; /* Se ilumina al pasar el mouse */
    transform: scale(1.2);
}

.subitems li a:hover {
    background: rgba(255,255,255,.05);
    color: #e2e8f0;
    border-left-color: #475569;
}

.subitems li a.activo-sub {
    color: var(--color-acento);
    border-left-color: var(--color-acento);
    font-weight: 600;
}

body.sidebar-collapsed .subitems li a .link-txt {
    opacity: 0;
    pointer-events: none;
}

/* ══════════════════════════════════════
   CONTENIDO — desplazable, ocupa el resto
══════════════════════════════════════ */
#wrapper {
    display: flex;
    flex-direction: column;
    height: 100vh;
    margin-left: var(--sidebar-w);
    overflow: hidden;
    transition: margin-left var(--transition);
}

body.sidebar-collapsed #wrapper {
    margin-left: var(--sidebar-collapsed);
}

/* ── Topbar fija ── */
header.topbar {
    background: #fff;
    border-bottom: 1px solid var(--color-borde);
    padding: 12px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    z-index: 50;
}

header.topbar .breadcrumb {
    font-size: 13px;
    color: var(--color-texto-suave);
}

header.topbar .breadcrumb a {
    color: var(--color-secundario);
    text-decoration: none;
    font-weight: 500;
}

header.topbar .breadcrumb a:hover { text-decoration: underline; }

header.topbar .breadcrumb span {
    margin: 0 6px;
    color: #94a3b8;
}

header.topbar .version {
    font-size: 12px;
    color: #94a3b8;
    white-space: nowrap;
}

/* ── Zona de scroll del contenido ── */
#scroll-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
}

/* ── Main ── */
main {
    padding: 32px 40px 60px;
    width: 100%;
}

/* ── Footer ── */
footer {
    padding: 13px 40px;
    font-size: 12px;
    color: #94a3b8;
    border-top: 1px solid var(--color-borde);
    background: #fff;
    flex-shrink: 0;
}

/* ══════════════════════════════════════
   TÍTULOS DE PÁGINA
══════════════════════════════════════ */
.titulo-pagina { margin-bottom: 6px; }

.titulo-pagina .modulo-tag {
    display: inline-block;
    background: var(--color-acento);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.titulo-pagina h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-primario);
    line-height: 1.2;
}

.titulo-pagina .descripcion {
    color: var(--color-texto-suave);
    font-size: 15px;
    margin-top: 8px;
    line-height: 1.6;
    max-width: 760px;
}

hr.separador {
    border: none;
    border-top: 1px solid var(--color-borde);
    margin: 24px 0;
}

/* ══════════════════════════════════════
   PANTALLAS
══════════════════════════════════════ */
.pantalla {
    background: #fff;
    border: 1px solid var(--color-borde);
    border-radius: 10px;
    padding: 26px 30px;
    margin-bottom: 24px;
}

.pantalla-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 16px;
}

.pantalla-num {
    width: 34px;
    height: 34px;
    min-width: 34px;
    background: var(--color-primario);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    margin-top: 2px;
}

.pantalla-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-primario);
    line-height: 1.2;
}

.pantalla-header .subtitulo {
    font-size: 12.5px;
    color: var(--color-texto-suave);
    margin-top: 3px;
}

.pantalla p {
    color: var(--color-texto);
    line-height: 1.75;
    margin-bottom: 12px;
}

.pantalla ul, .pantalla ol {
    padding-left: 22px;
    color: var(--color-texto);
    line-height: 1.9;
    margin-bottom: 14px;
}

.pantalla ul li, .pantalla ol li { margin-bottom: 3px; }

/* ── Tabla de campos ── */
.tabla-campos {
    width: 100%;
    border-collapse: collapse;
    margin: 14px 0;
    font-size: 14px;
}

.tabla-campos th {
    background: var(--color-primario);
    color: #fff;
    text-align: left;
    padding: 9px 14px;
    font-weight: 600;
}

.tabla-campos td {
    padding: 8px 14px;
    border-bottom: 1px solid var(--color-borde);
    vertical-align: top;
}

.tabla-campos tr:nth-child(even) td { background: #f8fafd; }

/* ── Alertas ── */
.nota {
    background: var(--color-nota);
    border-left: 4px solid var(--color-nota-borde);
    border-radius: 0 6px 6px 0;
    padding: 11px 15px;
    font-size: 13.5px;
    color: #1e40af;
    margin: 13px 0;
    line-height: 1.6;
}

.nota strong { font-weight: 700; }

.advertencia {
    background: var(--color-advertencia);
    border-left: 4px solid var(--color-adv-borde);
    border-radius: 0 6px 6px 0;
    padding: 11px 15px;
    font-size: 13.5px;
    color: #9a3412;
    margin: 13px 0;
    line-height: 1.6;
}

.advertencia strong { font-weight: 700; }

/* ── Espacio para captura ── */
.captura {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 28px 20px;
    text-align: center;
    color: #94a3b8;
    font-size: 13px;
    margin: 16px 0;
    background: #f8fafd;
}

.captura .icono { font-size: 26px; margin-bottom: 5px; }
.captura p { margin: 0; color: #94a3b8; }

/* ── Grid de módulos ── */
.grid-modulos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 12px;
    margin: 14px 0;
}

.modulo-card {
    background: var(--color-fondo);
    border: 1px solid var(--color-borde);
    border-radius: 8px;
    padding: 13px 15px;
    font-size: 13.5px;
}

.modulo-card .nombre {
    font-weight: 700;
    color: var(--color-primario);
    margin-bottom: 4px;
}

.modulo-card .desc {
    color: var(--color-texto-suave);
    font-size: 12.5px;
    line-height: 1.5;
}

/* ── Navegación entre páginas ── */
.nav-paginas {
    display: flex;
    justify-content: space-between;
    margin-top: 36px;
    padding-top: 18px;
    border-top: 1px solid var(--color-borde);
}

.nav-paginas a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--color-secundario);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    padding: 8px 16px;
    border: 1px solid var(--color-borde);
    border-radius: 6px;
    background: #fff;
    transition: all .17s;
}

.nav-paginas a:hover {
    background: var(--color-secundario);
    color: #fff;
    border-color: var(--color-secundario);
}

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 640px) {
    body.sidebar-collapsed #sidebar { width: 0; }
    main { padding: 20px 16px 48px; }
    header.topbar { padding: 10px 16px; }
}

/* ══════════════════════════════════════
   EFECTO DE ATERRIZAJE (BÚSQUEDA)
══════════════════════════════════════ */
.aterrizaje-highlight {
    background-color: #fca5a5; 
    color: #7f1d1d;
    border-radius: 4px;
    padding: 2px 4px;
    box-shadow: 0 0 0 5px rgba(252, 165, 165, 0.6);
    font-weight: bold;
    transition: all 1.5s ease-in-out;
}

.aterrizaje-highlight.fade-out {
    background-color: transparent;
    color: inherit;
    box-shadow: 0 0 0 0px rgba(252, 165, 165, 0);
}
