/**
 * FCGP Doc Importer -- Document Viewer (front-end).
 *
 * Two-panel layout:
 *   Left  (1/4) — vertical stacked section tabs (table of contents)
 *   Right (3/4) — section content + prev/next pagination
 *
 * Collapses to stacked layout on mobile (sidebar on top, content below).
 *
 * Node-type styles (.doc-importer-heading, .doc-importer-paragraph, etc.)
 * live in the theme's style/doc-importer.css.
 */

/* ---- Two-panel grid ------------------------------------------------------ */
.fcgp-doc-viewer--active {
    display: grid;
    gap: 0;
    grid-template-columns: 1fr 3fr;
    position: relative;
}

/* ---- Left sidebar (1/4) -------------------------------------------------- */
.fcgp-doc-sidebar {
    border-right: 1px solid #e2e8f0;
    padding-right: 20px;
}

.fcgp-doc-sidebar__header {
    color: #1a365d;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    padding: 0 12px;
    text-transform: uppercase;
}

.fcgp-doc-sidebar__list,
.fcgp-doc-sidebar__list li,
.single-page .fcgp-doc-sidebar__list,
.single-page .fcgp-doc-sidebar__list li,
.theme-page .fcgp-doc-sidebar__list,
.theme-page .fcgp-doc-sidebar__list li {
    list-style: none !important;
    list-style-type: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.fcgp-doc-sidebar__list li::before,
.fcgp-doc-sidebar__list li::marker,
.single-page .fcgp-doc-sidebar__list li::before,
.single-page .fcgp-doc-sidebar__list li::marker,
.single-page ul.fcgp-doc-sidebar__list li::before,
.theme-page .fcgp-doc-sidebar__list li::before,
.theme-page .fcgp-doc-sidebar__list li::marker {
    content: none !important;
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.fcgp-doc-sidebar__tab {
    align-items: flex-start;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    border-radius: 0;
    color: #64748b;
    cursor: pointer;
    display: flex;
    font-family: inherit;
    font-size: 0.82rem;
    gap: 6px;
    line-height: 1.4;
    padding: 8px 12px;
    text-align: left;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    width: 100%;
}

.fcgp-doc-sidebar__tab:hover {
    background: #f8fafc;
    color: #1a365d;
}

.fcgp-doc-sidebar__tab.is-active {
    background: #eef3fb;
    border-left-color: #1a365d;
    color: #1a365d;
    font-weight: 600;
}

.fcgp-doc-sidebar__num {
    color: #94a3b8;
    flex-shrink: 0;
    font-size: 0.75rem;
    min-width: 1.4em;
}

.fcgp-doc-sidebar__tab.is-active .fcgp-doc-sidebar__num {
    color: #1a365d;
}

.fcgp-doc-sidebar__title {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ---- Right content panel (3/4) ------------------------------------------ */
.fcgp-doc-main {
    min-width: 0;
    padding-left: 28px;
}

/* ---- Section counter ----------------------------------------------------- */
.fcgp-doc-section-info {
    color: #94a3b8;
    font-size: 0.78rem;
    margin-bottom: 12px;
    text-align: right;
}

/* ---- Pagination bar ------------------------------------------------------ */
.fcgp-doc-pagination {
    align-items: center;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-top: 32px;
    padding-top: 20px;
}

.fcgp-doc-pagination__btn {
    align-items: center;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    color: #1a365d;
    cursor: pointer;
    display: flex;
    font-family: inherit;
    font-size: 0.85rem;
    gap: 8px;
    max-width: 40%;
    padding: 10px 16px;
    transition: background 0.15s, border-color 0.15s;
}

.fcgp-doc-pagination__btn:hover:not(:disabled) {
    background: #eef3fb;
    border-color: #1a365d;
}

.fcgp-doc-pagination__btn:disabled {
    color: #cbd5e1;
    cursor: default;
    opacity: 0.5;
}

.fcgp-doc-pagination__btn--prev {
    text-align: left;
}

.fcgp-doc-pagination__btn--next {
    text-align: right;
}

.fcgp-doc-pagination__arrow {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.fcgp-doc-pagination__label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fcgp-doc-pagination__counter {
    color: #94a3b8;
    flex-shrink: 0;
    font-size: 0.8rem;
    text-align: center;
}

/* ---- Responsive: collapse to stacked on mobile --------------------------- */
@media (max-width: 768px) {
    .fcgp-doc-viewer--active {
        grid-template-columns: 1fr;
    }

    .fcgp-doc-sidebar {
        border-bottom: 1px solid #e2e8f0;
        border-right: none;
        margin-bottom: 20px;
        padding-bottom: 16px;
        padding-right: 0;
    }

    .fcgp-doc-sidebar__list {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
    }

    .fcgp-doc-sidebar__tab {
        border-left: none;
        border-bottom: 2px solid transparent;
        font-size: 0.78rem;
        padding: 6px 10px;
    }

    .fcgp-doc-sidebar__tab.is-active {
        border-bottom-color: #1a365d;
        border-left: none;
    }

    .fcgp-doc-sidebar__num {
        display: none;
    }

    .fcgp-doc-main {
        padding-left: 0;
    }

    .fcgp-doc-pagination {
        flex-wrap: wrap;
        gap: 8px;
    }

    .fcgp-doc-pagination__btn {
        flex: 1 1 45%;
        max-width: none;
        font-size: 0.8rem;
        padding: 8px 12px;
    }

    .fcgp-doc-pagination__counter {
        flex-basis: 100%;
        order: -1;
    }

    .fcgp-doc-pagination__label {
        display: none;
    }
}
