/**
 * Responsive smartphone — app Leadnist
 * Ne touche pas le desktop (>768px). Recharge après design-system.
 */

/* Aligné maquette : jaune texte, pas fond jaune plein */
.path-user .sidebar-nav a.sidebar-link.is-active,
.path-user .sidebar-nav a.sidebar-link.is-active:visited,
.path-user .sidebar-nav a.sidebar-link.is-active:hover,
.path-user .sidebar-link.is-active,
.path-user .sidebar-link.is-active:visited {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #eab308 !important;
    border-color: transparent !important;
    box-shadow: none !important;
    font-weight: 600 !important;
}
.path-user .sidebar-link.is-active .nav-ico,
.path-user .sidebar-link.is-active .nav-ico svg,
.path-user .sidebar-nav a.sidebar-link.is-active .nav-ico,
.path-user .sidebar-nav a.sidebar-link.is-active .nav-ico svg {
    color: #eab308 !important;
    opacity: 1 !important;
}
.path-user .sidebar-link.is-active .hexa-unread-badge {
    background: #eab308 !important;
    color: #0a0a0b !important;
}

.path-user .sidebar-group__summary.is-open-active {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #eab308 !important;
    border: 1px solid transparent !important;
    border-radius: 11px !important;
    font-weight: 600 !important;
}
.path-user .sidebar-group__summary.is-open-active .nav-ico,
.path-user .sidebar-group__summary.is-open-active .nav-ico svg {
    color: #eab308 !important;
    opacity: 1 !important;
}

.path-user .sidebar-sublink.is-active,
.path-user .sidebar-sublink.is-active:visited,
.path-user .sidebar-sublink.is-active:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    color: #eab308 !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}

.body-hexa .hexa-artifact {
    max-width: 820px;
    margin: 12px auto 0;
    padding: 14px 16px;
    border-radius: 14px;
    background: #18181b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #e4e4e7;
}
.body-hexa .hexa-artifact__type {
    font-size: 0.75rem;
    font-weight: 650;
    color: #a1a1aa;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Hexa : jamais de boîte vide */
.body-hexa #hexa-stage-artifacts:empty,
.body-hexa #hexa-briefing-artifacts:empty,
.body-hexa #hexa-stage-artifacts:not(:has(.hexa-artifact)),
.body-hexa #hexa-briefing-artifacts:not(:has(.hexa-artifact)),
.body-hexa .hexa-messages:empty,
.body-hexa .hexa-messages.is-empty,
.body-hexa .hexa-work:not(.is-on),
.body-hexa .hexa-work[hidden],
.body-hexa .hexa-artifact:empty {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    min-height: 0 !important;
    overflow: hidden !important;
}

@media (max-width: 768px) {
    /* Drawer sidebar — écrase sticky du design-system */
    .sidebar-toggle {
        display: flex !important;
    }

    .layout {
        display: block;
        min-height: 100vh;
        width: 100%;
        overflow-x: hidden;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: min(280px, 86vw) !important;
        max-width: 280px !important;
        height: 100vh !important;
        height: 100dvh !important;
        z-index: 1001 !important;
        transform: translateX(-105%) !important;
        transition: transform 0.25s ease !important;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.45);
        border-right: 1px solid rgba(255, 255, 255, 0.06);
    }

    .sidebar.is-open {
        transform: translateX(0) !important;
    }

    .sidebar-overlay {
        display: block !important;
        pointer-events: none;
    }

    .sidebar-overlay.is-open {
        pointer-events: auto;
        opacity: 1;
    }

    .main {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        padding-left: 0 !important;
        margin-left: 0 !important;
        overflow-x: hidden;
    }

    body:has(#sidebar-toggle) .header {
        padding: 0.85rem 1rem 0.85rem calc(0.85rem + 44px + 0.55rem) !important;
        gap: 0.5rem;
        flex-wrap: nowrap;
    }

    .header h1 {
        font-size: 1.05rem !important;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1 1 auto;
    }

    .header-actions {
        flex-shrink: 0;
        gap: 0.4rem;
    }

    .locale-switcher--admin .locale-switcher-label {
        display: none !important;
    }

    /* visible = laisse les wraps de tableaux scroller (overflow:hidden coupe le touch scroll iOS) */
    .content {
        padding: 0.85rem 0.85rem 1.25rem !important;
        max-width: 100%;
        min-width: 0;
        overflow-x: visible;
    }

    /* Surfaces / tableaux */
    .comp-page,
    .comp-panel,
    .card,
    .seo-lib,
    .post-lib,
    .stats-cockpit,
    .media-lib,
    .profil-lib {
        max-width: 100%;
        min-width: 0;
    }

    .comp-page__head,
    .seo-lib__head,
    .post-lib__head,
    .media-lib__head,
    .profil-lib__head {
        flex-direction: column;
        align-items: stretch !important;
    }

    .comp-page__actions,
    .seo-lib__head-actions,
    .post-lib__head-actions,
    .media-lib__head-actions {
        width: 100%;
    }

    .comp-page__cta,
    .media-lib__btn-upload,
    .post-lib__btn-primary {
        width: 100%;
        justify-content: center;
    }

    .comp-table-wrap,
    .scraping-results-wrap,
    .table-responsive,
    .seo-pages-table-wrap,
    .seo-overview-table-wrap,
    .seo-table-scroll,
    .veille-models-table-wrap,
    .seo-lib .seo-graph-card > div[style*="overflow"],
    .seo-lib div[style*="overflow:auto"],
    .seo-lib div[style*="overflow: auto"] {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
    }

    .comp-table,
    .scraping-results-table,
    .table,
    .seo-overview-table-wrap .table {
        min-width: 640px;
    }

    .seo-pages-table-wrap .table {
        min-width: 920px;
    }

    .ln-tabs,
    .comp-page__tabs,
    .seo-lib__tabs,
    .post-lib__tabs,
    .media-lib__tabs {
        display: flex;
        flex-wrap: nowrap;
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        gap: 4px;
        padding-bottom: 0.2rem;
    }

    .ln-tabs a,
    .ln-tab {
        flex: 0 0 auto;
        padding: 7px 10px;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    /* Forms */
    .meta-form-grid,
    .comp-create .meta-form-grid {
        grid-template-columns: 1fr !important;
    }

    /* Stats / charts */
    .chart-row,
    .stats-grid,
    .sn-grid {
        grid-template-columns: 1fr !important;
    }

    /* Hexa */
    .body-hexa .hexa-page-wrap {
        height: calc(100dvh - 56px);
        min-height: 0;
    }

    .body-hexa .hexa-composer {
        width: calc(100% - 16px) !important;
        max-width: calc(100% - 16px) !important;
    }

    .body-hexa .hexa-stage__head {
        padding: 10px 12px;
        gap: 0.5rem;
    }

    .body-hexa .hexa-stage__new kbd {
        display: none;
    }

    .body-hexa .hexa-stage__scroll {
        padding: 12px !important;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 0.95rem !important;
    }

    .comp-identity__handle {
        max-width: 120px;
    }

    .btn-sm {
        font-size: 0.75rem;
        padding: 0.35rem 0.55rem;
    }
}
