/* ============================================================
   ESTATUTO TRIBUTARIO — Sacot Grupo Empresarial
   Document-reader profesional
   ============================================================ */

:root {
    --e-nav:    70px;
    --e-bar:    52px;
    --e-dark:   #112035;          /* cuerpo de página */
    --e-side:   #0f2238;          /* sidebar */
    --e-side2:  #122844;          /* sidebar header */
    --e-navy:   #0d2137;
    --e-mid:    #1a3a5c;
    --e-cyan:   #0099cc;
    --e-cyan-l: #00bcd4;
    --e-cyan-d: #0078a8;
    --e-gold:   #f0a500;
    --e-white:  #ffffff;
    --e-bg:     #f0f4f9;          /* fondo panel contenido */
    --e-card:   #ffffff;          /* panel artículos */
    --e-gray:   #e2e8f0;
    --e-text:   #1e293b;
    --e-muted:  #64748b;
    --e-shade:  rgba(255,255,255,.05);
    --e-border: rgba(255,255,255,.07);
    --sh:       0 4px 24px rgba(0,0,0,.35);
    --sh-sm:    0 2px 10px rgba(0,0,0,.2);
    --r:        10px;
    --ease:     cubic-bezier(.4,0,.2,1);
}

/* ════════════════════════════════════════════
   BARRA DE BÚSQUEDA (fixed)
════════════════════════════════════════════ */
.search-bar {
    position: fixed;
    top: var(--e-nav);
    left: 0; right: 0;
    background: linear-gradient(135deg, #0e1f36 0%, #152840 100%);
    z-index: 1050;
    padding: 7px 0;
    border-bottom: 1px solid rgba(0,153,204,.3);
    box-shadow: 0 2px 20px rgba(0,0,0,.4);
}

.search-bar .inner-bar {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: nowrap;
}

/* Input búsqueda */
.search-bar-group {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 8px;
    padding: 0 4px 0 12px;
    gap: 4px;
    transition: border-color .2s, background .2s;
}
.search-bar-group:focus-within {
    border-color: var(--e-cyan);
    background: rgba(255,255,255,.11);
    box-shadow: 0 0 0 3px rgba(0,153,204,.15);
}
.search-bar-group .sb-icon {
    color: rgba(255,255,255,.35);
    font-size: .8rem;
    flex-shrink: 0;
}

#searchInput {
    background: transparent;
    border: none;
    color: var(--e-white);
    padding: 7px 4px;
    font-size: .86rem;
    flex: 1;
    min-width: 0;
    outline: none;
    font-family: inherit;
}
#searchInput::placeholder { color: rgba(255,255,255,.35); }

#clearSearch {
    background: transparent;
    border: none;
    color: rgba(255,255,255,.45);
    padding: 4px 6px;
    font-size: 1rem;
    line-height: 1;
    border-radius: 5px;
    cursor: pointer;
    transition: color .15s, background .15s;
    flex-shrink: 0;
}
#clearSearch:hover { color: var(--e-white); background: rgba(255,255,255,.1); }

/* Conteo de resultados */
#searchCount {
    font-size: .7rem;
    font-weight: 600;
    color: var(--e-cyan-l);
    white-space: nowrap;
    padding: 2px 8px;
    background: rgba(0,188,212,.12);
    border-radius: 10px;
    display: none;
    flex-shrink: 0;
}

#searchBtn {
    background: var(--e-cyan);
    border: none;
    color: var(--e-white);
    padding: 7px 15px;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: background .2s, transform .15s;
    display: inline-flex; align-items: center; gap: 5px;
    flex-shrink: 0;
}
#searchBtn:hover { background: var(--e-cyan-d); transform: translateY(-1px); }

#backToTop {
    background: rgba(240,165,0,.18);
    border: 1px solid rgba(240,165,0,.3);
    color: var(--e-gold);
    padding: 7px 12px;
    border-radius: 8px;
    font-size: .78rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: .2s var(--ease);
    display: inline-flex; align-items: center; gap: 5px;
    flex-shrink: 0;
}
#backToTop:hover {
    background: rgba(240,165,0,.28);
    border-color: var(--e-gold);
    transform: translateY(-1px);
}

/* Dropdown de resultados */
#searchResultsContainer {
    background: #0e1f32;
    border: 1px solid rgba(255,255,255,.1);
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 4px 6px 8px;
    box-shadow: 0 12px 32px rgba(0,0,0,.5);
    max-height: 300px;
    overflow-y: auto;
}
#searchResults .list-group-item {
    background: rgba(255,255,255,.04);
    border-color: rgba(255,255,255,.06) !important;
    font-size: .81rem;
    padding: 8px 12px;
    color: rgba(255,255,255,.65);
    cursor: pointer;
    transition: .15s var(--ease);
    border-radius: 6px !important;
    margin-bottom: 2px;
}
#searchResults .list-group-item:hover {
    background: rgba(0,153,204,.14);
    color: var(--e-white);
}
#searchResults .list-group-item strong { color: var(--e-cyan-l); }
#searchResults .list-group-item.text-danger { color: rgba(248,113,113,.8); background: transparent; }

/* ════════════════════════════════════════════
   SIDEBAR
════════════════════════════════════════════ */
.toc-container {
    position: sticky;
    top: calc(var(--e-nav) + var(--e-bar) + 16px);
    max-height: calc(100vh - var(--e-nav) - var(--e-bar) - 32px);
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--e-side);
    border-radius: var(--r);
    box-shadow: var(--sh);
    border: 1px solid var(--e-border);
    scrollbar-width: thin;
    scrollbar-color: rgba(0,153,204,.4) transparent;
}
.toc-container::-webkit-scrollbar { width: 3px; }
.toc-container::-webkit-scrollbar-thumb { background: rgba(0,153,204,.4); border-radius: 3px; }

/* Información del documento */
.toc-doc-info {
    background: linear-gradient(145deg, #102240 0%, var(--e-side2) 100%);
    padding: 16px 14px 14px;
    border-bottom: 1px solid var(--e-border);
    position: sticky;
    top: 0;
    z-index: 3;
}
.tdi-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}
.tdi-icon {
    font-size: 1.25rem;
    color: var(--e-cyan);
    flex-shrink: 0;
    margin-top: 2px;
    opacity: .85;
}
.tdi-label {
    display: block;
    font-size: .58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: var(--e-cyan);
    margin-bottom: 2px;
    opacity: .8;
}
.tdi-title {
    display: block;
    font-size: .88rem;
    font-weight: 700;
    color: var(--e-white);
    line-height: 1.2;
    margin-bottom: 2px;
}
.tdi-sub {
    display: block;
    font-size: .7rem;
    color: rgba(255,255,255,.4);
}
.tdi-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
}
.tdi-decree {
    font-size: .68rem;
    color: rgba(255,255,255,.4);
    display: flex;
    align-items: center;
    gap: 5px;
}
.tdi-decree i { color: rgba(255,255,255,.25); font-size: .6rem; }
.tdi-year {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: linear-gradient(135deg, var(--e-gold), #fbbf24);
    color: #0a1020;
    font-size: .65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 3px 9px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(240,165,0,.3);
}

/* Filtro del índice */
.toc-filter-wrap {
    padding: 10px 12px;
    border-bottom: 1px solid var(--e-border);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,.1);
}
.toc-filter-icon { color: rgba(255,255,255,.25); font-size: .75rem; flex-shrink: 0; }
.toc-filter-input {
    background: transparent;
    border: none;
    color: rgba(255,255,255,.7);
    font-size: .78rem;
    font-family: inherit;
    flex: 1;
    outline: none;
    padding: 2px 0;
}
.toc-filter-input::placeholder { color: rgba(255,255,255,.22); }

/* Cabecera "Índice" */
.toc-header {
    padding: 10px 14px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.toc-header h5 {
    color: rgba(255,255,255,.4);
    font-weight: 700;
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .12em;
    margin: 0;
    display: flex; align-items: center; gap: 6px;
}
.toc-header h5 .bar-accent {
    display: inline-block;
    width: 3px; height: 10px;
    background: var(--e-cyan);
    border-radius: 2px;
    opacity: .6;
}

/* Lista TOC */
.toc-container > ul {
    list-style: none;
    padding: 4px 10px 14px;
    margin: 0;
}
.toc-item {
    background: transparent;
    border-radius: 6px;
    margin-bottom: 2px;
    overflow: hidden;
    cursor: pointer;
    transition: background .18s var(--ease);
}
.toc-item:hover { background: rgba(255,255,255,.04); }
.toc-item.open  { background: rgba(0,153,204,.07); }

.toc-item > a.toc-toggle {
    display: block;
    padding: 7px 26px 7px 10px;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    font-size: .74rem;
    font-weight: 500;
    line-height: 1.4;
    position: relative;
    transition: color .18s;
    border-radius: 6px;
}
.toc-item:hover > a.toc-toggle { color: rgba(255,255,255,.95); }
.toc-item.open > a.toc-toggle  { color: var(--e-cyan-l); }
/* Sin flecha: padding derecho normal */
.toc-item.no-submenu > a.toc-toggle { padding-right: 10px; }

/* Entrada activa (scroll tracking) */
.toc-toggle.toc-active,
.toc-link.toc-active {
    color: var(--e-cyan-l) !important;
    background: rgba(0,188,212,.1) !important;
    border-left: 2px solid var(--e-cyan-l);
    padding-left: 12px !important;
}

/* Chevron — solo en ítems expandibles */
.toc-toggle::after {
    content: '\f107';
    font-family: 'Font Awesome 6 Free'; font-weight: 900; font-style: normal;
    position: absolute;
    right: 8px; top: 50%;
    transform: translateY(-50%);
    font-size: .65rem;
    color: rgba(255,255,255,.38);
    transition: transform .25s var(--ease), color .18s;
}
.toc-item.open > .toc-toggle::after {
    transform: translateY(-50%) rotate(180deg);
    color: var(--e-cyan);
}
/* Sin submenú: sin flecha */
.toc-item.no-submenu > .toc-toggle::after {
    display: none;
}

/* Submenú */
.submenu {
    display: none;
    list-style: none;
    background: rgba(0,0,0,.15);
    padding: 3px 6px 6px;
    border-top: 1px solid var(--e-border);
    margin: 0;
}
.submenu li { margin-bottom: 1px; }
.submenu li a {
    display: block;
    padding: 5px 8px 5px 16px;
    color: rgba(255,255,255,.58);
    text-decoration: none;
    font-size: .69rem;
    border-radius: 5px;
    border-left: 2px solid transparent;
    transition: .15s var(--ease);
}
.submenu li a:hover {
    color: var(--e-cyan-l);
    background: rgba(0,188,212,.07);
    border-left-color: rgba(0,188,212,.4);
    padding-left: 20px;
}

/* ════════════════════════════════════════════
   PANEL CONTENIDO
════════════════════════════════════════════ */
.estatuto-wrapper {
    background: var(--e-bg);
    border-radius: var(--r);
    overflow: hidden;
    box-shadow: var(--sh);
    border: 1px solid rgba(255,255,255,.04);
    min-height: calc(100vh - var(--e-nav) - var(--e-bar) - 48px);
}

/* Barra de progreso de lectura */
.reading-progress-wrap {
    height: 3px;
    background: rgba(255,255,255,.08);
    position: relative;
    overflow: hidden;
}
.reading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--e-cyan) 0%, var(--e-cyan-l) 50%, var(--e-gold) 100%);
    width: 0%;
    transition: width .08s linear;
    border-radius: 0 3px 3px 0;
}

/* Cabecera del documento */
.estatuto-doc-header {
    background: linear-gradient(135deg, var(--e-navy) 0%, var(--e-mid) 60%, #1b5882 100%);
    padding: 20px 28px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    position: relative;
    overflow: hidden;
}
.estatuto-doc-header::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 240px; height: 240px;
    background: radial-gradient(circle, rgba(0,153,204,.12) 0%, transparent 70%);
    pointer-events: none;
}
.estatuto-doc-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--e-cyan) 0%, var(--e-cyan-l) 40%, transparent 100%);
}

.edh-left {}
.edh-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--e-white);
    margin: 0 0 6px;
    line-height: 1.2;
    display: flex;
    align-items: center;
    gap: 10px;
}
.edh-title-icon {
    color: rgba(255,255,255,.4);
    font-size: .95rem;
}
.edh-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.edh-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .76rem;
    color: rgba(255,255,255,.55);
}
.edh-meta-item i { color: var(--e-cyan-l); font-size: .68rem; }
.edh-meta-sep { color: rgba(255,255,255,.2); font-size: .7rem; }

.edh-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.edh-year {
    background: linear-gradient(135deg, var(--e-gold), #fbbf24);
    color: #0a1020;
    font-size: .7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    padding: 5px 14px;
    border-radius: 20px;
    box-shadow: 0 3px 10px rgba(240,165,0,.35);
    white-space: nowrap;
}
.edh-search-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.15);
    color: rgba(255,255,255,.75);
    padding: 6px 13px;
    border-radius: 8px;
    font-size: .76rem;
    font-weight: 500;
    cursor: pointer;
    transition: .2s var(--ease);
    white-space: nowrap;
}
.edh-search-btn:hover {
    background: rgba(0,153,204,.22);
    border-color: var(--e-cyan-l);
    color: var(--e-white);
}

/* Área de contenido */
#estatutoContent {
    padding: 28px 36px 40px;
    max-height: calc(100vh - var(--e-nav) - var(--e-bar) - 160px);
    overflow-y: auto;
    background: var(--e-card);
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    scroll-behavior: smooth;
}
#estatutoContent::-webkit-scrollbar { width: 6px; }
#estatutoContent::-webkit-scrollbar-track { background: transparent; }
#estatutoContent::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
#estatutoContent::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Tipografía del contenido ─────────────────────────────── */
#estatutoContent * { font-family: 'Poppins', sans-serif !important; }

#estatutoContent h1 {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--e-navy);
    margin: 2rem 0 1rem;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(0,153,204,.07), rgba(0,188,212,.03));
    border-left: 4px solid var(--e-cyan);
    border-radius: 0 var(--r) var(--r) 0;
    text-transform: uppercase;
    letter-spacing: .03em;
}

#estatutoContent h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--e-mid);
    margin: 2rem 0 .9rem;
    padding: 10px 14px;
    background: rgba(0,153,204,.04);
    border-left: 3px solid rgba(0,153,204,.45);
    border-radius: 0 8px 8px 0;
    text-transform: uppercase;
    letter-spacing: .04em;
}

#estatutoContent h3 {
    font-size: .9rem;
    font-weight: 700;
    color: #1e3a5c;
    margin: 1.5rem 0 .65rem;
    padding-left: 10px;
    border-left: 2px solid rgba(0,153,204,.28);
}

#estatutoContent h1:first-child,
#estatutoContent h2:first-child { margin-top: 0; }

/* Párrafos con artículo */
#estatutoContent p {
    font-size: .88rem;
    line-height: 1.78;
    color: var(--e-text);
    margin-bottom: .65rem;
}

/* Etiqueta de artículo */
#estatutoContent .articulo {
    display: inline-flex;
    align-items: center;
    background: rgba(0,153,204,.1);
    border: 1px solid rgba(0,153,204,.2);
    color: var(--e-cyan-d);
    font-size: .68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .07em;
    padding: 2px 7px 2px 5px;
    border-radius: 4px;
    margin-right: 7px;
    vertical-align: middle;
    white-space: nowrap;
}

/* Tablas */
#estatutoContent table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
    margin: 1rem 0 1.25rem;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
#estatutoContent table td,
#estatutoContent table th {
    padding: 7px 10px;
    border: 1px solid var(--e-gray);
    vertical-align: top;
    line-height: 1.55;
}
#estatutoContent table th {
    background: var(--e-mid);
    color: var(--e-white);
    font-weight: 600;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
#estatutoContent table tr:nth-child(even) td {
    background: #f8fafc;
}
#estatutoContent table tr:hover td { background: rgba(0,153,204,.04); }

/* Links internos */
#estatutoContent a[onclick] {
    color: var(--e-cyan-d);
    text-decoration: none;
    border-bottom: 1px dotted rgba(0,153,204,.4);
    transition: color .15s, border-color .15s;
}
#estatutoContent a[onclick]:hover {
    color: var(--e-cyan);
    border-bottom-color: var(--e-cyan);
}

/* ── Highlights búsqueda ────────────────────────────────────── */
.highlight {
    background: rgba(240,165,0,.3);
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: inherit;
    box-shadow: 0 0 0 1px rgba(240,165,0,.2);
}
.highlightold {
    background: rgba(240,165,0,.1);
    padding: 1px 3px;
    border-radius: 3px;
}

/* ════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════ */
@media (max-width: 991px) {
    .toc-container {
        position: relative;
        top: 0;
        max-height: 240px;
        margin-bottom: 16px;
    }
    .estatuto-wrapper { min-height: auto; }
    #estatutoContent {
        max-height: 65vh;
        padding: 18px 20px 28px;
    }
    .estatuto-doc-header { padding: 16px 18px 14px; }
    .edh-title { font-size: 1.1rem; }
}

@media (max-width: 767px) {
    .edh-right .edh-search-btn { display: none; }
    #estatutoContent { max-height: none; }
    #backToTop { display: none; }
}

/* Pulse WhatsApp */
@keyframes pulse {
    0%, 100% { box-shadow: 0 4px 10px rgba(0,0,0,.3), 0 0 0 0 rgba(37,211,102,.45); }
    50%       { box-shadow: 0 4px 10px rgba(0,0,0,.3), 0 0 0 12px rgba(37,211,102,0); }
}
