/* =====================================================
   HUB SUB-NAVIGATION
   Grouped secondary sidebar for the Settings & Reports
   hubs. Fixed to the left of the icon sidebar; the host
   page reserves space via a body[data-page] offset rule
   so no per-page layout edits are needed.
   ===================================================== */

.hub-nav {
    position: fixed;
    top: var(--header-height);
    left: var(--sidebar-width);
    bottom: 0;
    width: 248px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 14px;
    background: var(--white);
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Hub title */
.hub-nav-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2px 8px 10px;
    border-bottom: 1px solid var(--border-light);
}

.hub-nav-head i {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 19px;
    background: var(--indigo-bg-gradient, rgba(99, 102, 241, .1));
    color: var(--indigo-600, #4f46e5);
    flex-shrink: 0;
}

.hub-nav-head span {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Groups */
.hub-nav-groups {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hub-nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hub-nav-group-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    padding: 4px 12px;
}

/* Items */
.hub-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background .16s ease, color .16s ease;
}

.hub-nav-item i {
    font-size: 18px;
    flex-shrink: 0;
}

.hub-nav-item:hover {
    background: var(--secondary-color);
    color: var(--primary-color);
}

.hub-nav-item.active {
    background: var(--primary-color);
    color: var(--white);
}

[data-theme="dark"] .hub-nav {
    box-shadow: 1px 0 8px rgba(0, 0, 0, .25);
}

/* ── Host-page offset ────────────────────────────────
   Reserve the hub-nav width on pages that show it. Keyed
   off body[data-page] (set on initial load by header.php
   and kept in sync by spa-router.js). */
body[data-page="settings"] .settings-page,
body[data-page="agents"] .agents-page,
body[data-page="ai-chatbot"] .ai-chatbot-page,
body[data-page="chatbot-flow"] .chatbot-flow-page,
body[data-page="comment-automation"] .comment-automation-page,
body[data-page="apps"] .apps-page,
body[data-page="add-ons"] .add-ons-page,
body[data-page="api-access"] .api-access-page,
body[data-page="billing"] .billing-page,
body[data-page="satisfaction-survey"] .satisfaction-survey-page,
body[data-page="sales-pipeline-report"] .spb-page {
    /* hub-nav width (248px) + a gap so content doesn't butt against it */
    padding-left: calc(248px + 24px);
}

/* ── Responsive: collapse to a horizontal strip ────── */
@media (max-width: 992px) {
    .hub-nav {
        left: 0;
        width: 100%;
        bottom: auto;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        overflow-x: auto;
        overflow-y: hidden;
    }

    .hub-nav-head,
    .hub-nav-group-label {
        display: none;
    }

    .hub-nav-groups,
    .hub-nav-group {
        flex-direction: row;
        gap: 8px;
    }

    .hub-nav-item {
        white-space: nowrap;
        padding: 8px 12px;
    }

    body[data-page="settings"] .settings-page,
    body[data-page="agents"] .agents-page,
    body[data-page="ai-chatbot"] .ai-chatbot-page,
    body[data-page="chatbot-flow"] .chatbot-flow-page,
    body[data-page="comment-automation"] .comment-automation-page,
    body[data-page="apps"] .apps-page,
    body[data-page="add-ons"] .add-ons-page,
    body[data-page="api-access"] .api-access-page,
    body[data-page="billing"] .billing-page,
    body[data-page="satisfaction-survey"] .satisfaction-survey-page,
    body[data-page="sales-pipeline-report"] .spb-page {
        padding-left: 0;
        padding-top: 56px;
    }
}
