/* Avision Embed CSS — Mode Drawer Sprint 44 */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    background: #f1f5f9;
    font-family: "Inter", system-ui, sans-serif;
}

.avi-embed-loading {
    position: fixed; inset: 0;
    display: flex; align-items: center; justify-content: center;
    background: #f9fafb; z-index: 99999;
}

.avi-embed-spinner {
    width: 36px; height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #6d28d9;
    border-radius: 50%;
    animation: avi-spin .7s linear infinite;
}
@keyframes avi-spin { to { transform: rotate(360deg); } }

#avision-dashboard-root {
    width: 100vw; height: 100vh;
    overflow: hidden; display: flex; flex-direction: column;
}

.avi-embed-wrap { flex: 1; overflow: hidden; }

/* Drawer toujours visible — forcer l'attribut hidden */
#avision-dashboard-root .avi-heatmap-drawer:not([hidden]) {
    display: flex !important;
}

#avision-dashboard-root .avi-heatmap-drawer {
    height: 100vh !important;
    overflow: hidden !important;
    border: none !important; border-radius: 0 !important; margin: 0 !important;
    display: flex !important; flex-direction: column !important;
}

/* Grille drawer : keywords 320px + carte (preview occupe tout le reste) */
#avision-dashboard-root .avi-heatmap-drawer-grid {
    display: grid !important;
    grid-template-columns: minmax(0,1fr) minmax(260px,.9fr) minmax(240px,.8fr) !important;
    grid-template-rows: 1fr !important;
    flex: 1 !important; overflow: hidden !important;
    height: calc(100vh - 60px) !important;
}

/* Panel keywords — sidebar gauche */
#avision-dashboard-root .avi-heatmap-panel--keywords {
    overflow-y: auto !important; height: 100% !important;
    border-right: 1px solid #e2e8f0 !important;
}

/* Panel preview — zone carte, prend tout l'espace restant */
#avision-dashboard-root .avi-heatmap-panel--preview {
    display: flex !important; flex-direction: column !important;
    height: 100% !important; overflow: hidden !important;
}

/* Leaflet map */
#avision-dashboard-root .avi-hm-map-wrapper {
    flex: 1 !important; min-height: 0 !important;
    display: flex !important; flex-direction: column !important;
}

#avision-dashboard-root .avi-heatmap-leaflet,
#avision-dashboard-root [data-avi-heatmap-leaflet] {
    flex: 1 !important; min-height: 300px !important;
}

/* Modal accessible via bouton expand — ne pas bloquer le layout */
#avision-dashboard-root .avi-heatmap-modal {
    z-index: 99999 !important;
}

/* Overlay pédago concurrent */
#avision-dashboard-root .avi-hm-pedago-overlay {
    position: fixed !important; inset: 0 !important;
    z-index: 200000 !important;
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }

/* Override media query 980px — forcer 3 colonnes en iframe */
@media (max-width: 980px) {
    #avision-dashboard-root .avi-heatmap-drawer-grid {
        grid-template-columns: 260px minmax(0, 1fr) 220px !important;
        grid-template-rows: 1fr !important;
    }
    #avision-dashboard-root .avi-heatmap-keyword-list {
        max-height: none !important;
    }
}

/* Override mobile — maintenir 3 colonnes jusqu'à 480px */
@media (max-width: 600px) {
    #avision-dashboard-root .avi-heatmap-drawer-grid {
        grid-template-columns: 200px minmax(0, 1fr) 180px !important;
    }
}
