/**
 * Responsive mobile — Pioveri
 * Uniquement des @media queries (≤768px / ≤480px).
 * Aucun impact sur desktop (> 768px).
 */

/* ── Hamburger button (caché sur desktop) ───────────────────────── */
#hamburger-btn {
    display: none;
}

/* ── Tables : scroll horizontal sur mobile ──────────────────────── */
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 8px;
}

/* ════════════════════════════════════════════════════════════════
   BREAKPOINT 768px
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

    /* ── Navigation hamburger ─────────────────────────────────── */
    #hamburger-btn {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 40px;
        height: 40px;
        padding: 8px;
        background: rgba(255, 255, 255, 0.1);
        border: none;
        border-radius: 6px;
        cursor: pointer;
        flex-shrink: 0;
        align-self: center;
    }

    #hamburger-btn span {
        display: block;
        width: 100%;
        height: 2px;
        background: var(--pv-white);
        border-radius: 2px;
        transition: all 0.25s ease;
    }

    #hamburger-btn.open span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    #hamburger-btn.open span:nth-child(2) {
        opacity: 0;
        transform: scaleX(0);
    }
    #hamburger-btn.open span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* Header : passe en colonne sur mobile */
    .header {
        padding: 0.75rem 1rem;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        text-align: left;
    }

    .header-inner {
        flex-direction: column;
        gap: 0;
        align-items: stretch;
    }

    .header-top-row {
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    /* Nav cachée par défaut sur mobile, visible quand ouverte */
    #main-nav {
        display: none;
        flex-direction: column;
        width: 100%;
        gap: 0.375rem;
        padding: 0.75rem 0;
        border-top: 1px solid rgba(201, 168, 76, 0.2);
        margin-top: 0.75rem;
    }

    #main-nav.nav-open {
        display: flex;
    }

    /* Boutons nav full-width sur mobile */
    #main-nav .nav-btn {
        width: 100%;
        justify-content: flex-start;
        min-height: 44px;
        padding: 0.625rem 1rem;
    }

    /* Dropdown sur mobile : position static */
    #main-nav .nav-dropdown {
        width: 100%;
    }

    #main-nav .nav-dropdown-trigger {
        width: 100%;
        justify-content: space-between;
    }

    #main-nav .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border-radius: 0 0 6px 6px;
        min-width: 0;
        background: rgba(0, 0, 0, 0.18);
        padding: 0.25rem 0 0.25rem 1rem;
        margin-top: 0.25rem;
    }

    /* Bouton déconnexion */
    #logout-btn {
        margin-left: 0 !important;
        width: 100%;
        justify-content: flex-start;
    }

    /* ── Container & card ──────────────────────────────────────── */
    .container {
        margin: 1rem auto;
    }

    /* ── Boutons d'action : taille de tap minimale ─────────────── */
    .button {
        min-height: 44px;
    }

    .button.small {
        min-height: 36px;
        font-size: 0.8rem;
    }

    /* ── Tables : scroll horizontal ────────────────────────────── */
    .data-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }

    /* ── Dashboard : boutons d'action empilés ───────────────────── */
    .dashboard-actions {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .dashboard-actions .button {
        width: 100%;
    }

    /* ── Watch-veille : flux en colonne unique ──────────────────── */
    .watch-feeds-grid {
        grid-template-columns: 1fr !important;
    }

    /* ── Filtres catégorie watch-veille ─────────────────────────── */
    .watch-cat-filters {
        flex-wrap: wrap;
        gap: 0.375rem;
    }

    .watch-cat-filters .button.small {
        flex: 0 0 auto;
    }

    /* ── Sources table watch-veille ─────────────────────────────── */
    .watch-sources-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ── Technical analysis : heatmap scroll ────────────────────── */
    .heatmap-container,
    .heatmap-grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ── Login box ──────────────────────────────────────────────── */
    .login-box {
        padding: 1.5rem 1.25rem;
        margin: 0 1rem;
        max-width: 100%;
    }

    /* ── Modals ─────────────────────────────────────────────────── */
    .modal-content {
        margin: 0.5rem;
        max-height: 95vh;
    }
}

/* ════════════════════════════════════════════════════════════════
   BREAKPOINT 480px — très petits écrans
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

    .header h1 {
        font-size: 1.1rem;
    }

    .card {
        padding: 0.875rem;
    }

    /* Boutons tab watch-veille : pleine largeur */
    #watch-tab-btn-flux,
    #watch-tab-btn-sources {
        flex: 1;
        justify-content: center;
    }

    /* Actions dans les tables : icônes seulement */
    .button.small.icon-only {
        padding: 0.25rem 0.5rem;
    }

    /* Badges : taille réduite */
    .badge {
        font-size: 0.7rem;
        padding: 0.15rem 0.4rem;
    }
}
