/**
 * facturatica-toc — TOC colapsable con paleta brand FACTURATica
 * Verdes (#14501a, #173326, #34D399) + Naranja (#f88c00) + Grises
 * Estilo bufete adaptado, sin nada rojo.
 */
/* 2.4.9 */

.ft-toc-wrap {
    margin: 28px 0 36px 0;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Source Sans 3", sans-serif;
}

.ft-toc-inner {
    position: relative;
    overflow: hidden;
    transition: max-height 0.45s ease;
    border-radius: 12px;
    background: #fbfbfb;
    border: 1px solid #ebeeec;
    border-left: 4px solid #14501a;
    padding: 20px 26px 28px 26px;
    box-shadow: 0 2px 10px rgba(20, 80, 26, 0.06);
}

/* Header */
.ft-toc-header {
    margin: 0 0 14px 0;
}

.ft-toc-title {
    display: inline-block;
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-weight: 700;
    color: #173326;
    border-bottom: 2px solid #34D399;
    padding-bottom: 5px;
}

/* Lista numerada y nesteada */
.ft-toc-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    counter-reset: ft-toc-counter;
}

.ft-toc-list .ft-toc-item {
    list-style: none !important;
    margin: 7px 0 !important;
    padding: 0 !important;
    counter-increment: ft-toc-counter;
    line-height: 1.5;
}

.ft-toc-list .ft-toc-level-2 {
    font-size: 1em;
    font-weight: 600;
}

.ft-toc-list .ft-toc-level-2::before {
    content: counter(ft-toc-counter, decimal) ".";
    color: #14501a;
    font-weight: 700;
    margin-right: 8px;
    display: inline-block;
    min-width: 20px;
}

.ft-toc-list .ft-toc-level-3 {
    margin-left: 26px !important;
    font-size: 0.94em;
    font-weight: 400;
}

.ft-toc-list .ft-toc-level-3::before {
    content: "›";
    color: #34D399;
    margin-right: 8px;
    font-weight: 700;
    font-size: 1.1em;
}

.ft-toc-list .ft-toc-item a {
    color: #2d2d2d;
    text-decoration: none;
    transition: color 0.15s ease;
    border-bottom: 1px dotted transparent;
}

.ft-toc-list .ft-toc-item a:hover,
.ft-toc-list .ft-toc-item a:focus {
    color: #14501a;
    border-bottom-color: #14501a;
}

/* Fade overlay al pie */
.ft-toc-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom,
        rgba(251, 251, 251, 0) 0%,
        rgba(251, 251, 251, 0.85) 45%,
        #fbfbfb 95%);
    pointer-events: none;
    transition: opacity 0.3s ease;
    opacity: 1;
    border-radius: 0 0 12px 12px;
}

.ft-toc-wrap[data-collapsed="0"] .ft-toc-fade {
    opacity: 0;
}

/* Boton toggle — naranja brand FACTURATica */
.ft-toc-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    background: #f88c00;
    color: #ffffff;
    border: none;
    padding: 14px 26px;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 700;
    font-size: 14.5px;
    letter-spacing: 0.015em;
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
    box-shadow: 0 3px 12px rgba(248, 140, 0, 0.22);
}

.ft-toc-toggle:hover,
.ft-toc-toggle:focus {
    background: #da6e00;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(218, 110, 0, 0.32);
    color: #ffffff;
    outline: none;
}

.ft-toc-toggle-arrow {
    display: inline-block;
    transition: transform 0.32s ease;
    font-size: 0.85em;
    line-height: 1;
}

.ft-toc-wrap[data-collapsed="0"] .ft-toc-toggle-arrow {
    transform: rotate(180deg);
}

/* Estado "no hace falta colapsar" (auto-detect JS) */
.ft-toc-no-collapse .ft-toc-inner {
    max-height: none !important;
}

.ft-toc-no-collapse .ft-toc-fade,
.ft-toc-no-collapse .ft-toc-toggle {
    display: none !important;
}

/* Responsive */
@media (max-width: 720px) {
    .ft-toc-inner {
        padding: 16px 20px 26px 20px;
    }
    .ft-toc-toggle {
        padding: 13px 20px;
        font-size: 14px;
    }
    .ft-toc-fade {
        height: 80px;
    }
    .ft-toc-list .ft-toc-level-3 {
        margin-left: 18px !important;
    }
}
