﻿/* =========================================================
   DASHBOARD DEMO (scopé sous .dashboard-demo)
   ========================================================= */

.dashboard-demo {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}

    /* =========================================================
   Cartes neutres (aucun effet hover)
   ========================================================= */
    .dashboard-demo .dash-card {
        position: relative;
        background: color-mix(in oklab,var(--card) 96%, transparent);
        border: 1px solid var(--border);
        border-radius: 16px;
        padding: 22px 20px 24px;
        box-shadow: 0 6px 18px rgba(0,0,0,.18);
        display: flex;
        flex-direction: column;
        gap: 1rem;
        transition: none;
    }

        .dashboard-demo .dash-card.flat {
            box-shadow: 0 2px 6px rgba(0,0,0,.14);
        }

        .dashboard-demo .dash-card:hover,
        .dashboard-demo .dash-card:focus-within {
            transform: none !important;
            box-shadow: 0 6px 18px rgba(0,0,0,.18) !important;
            filter: none !important;
        }

        .dashboard-demo .dash-card::after {
            display: none !important;
        }

        .dashboard-demo .dash-card > h2,
        .dashboard-demo .dash-card > h3 {
            margin: 0;
            font-size: 1.05rem;
            font-weight: 700;
            color: var(--text);
        }

        .dashboard-demo .dash-card p {
            margin: 0;
            color: var(--muted);
        }

    .dashboard-demo .dash-sep {
        height: 1px;
        background: linear-gradient(90deg,transparent,var(--border),transparent);
        margin: .2rem 0 .4rem;
    }

    /* =========================================================
   Hero / aperçu "Excel"
   ========================================================= */
    .dashboard-demo .excel-hero {
        display: grid;
        gap: 1rem;
        grid-template-columns: 70px 1fr auto;
        align-items: start;
    }

    .dashboard-demo .excel-hero-icon {
        width: 70px;
        height: 70px;
        border-radius: 1rem;
        font-size: 2.3rem;
        display: grid;
        place-items: center;
        background: linear-gradient(135deg,#6366f1,#9333ea);
        color: #fff;
        box-shadow: 0 8px 20px rgba(0,0,0,.25);
    }

    .dashboard-demo .excel-hero-actions {
        display: flex;
        flex-direction: column;
        gap: .6rem;
        align-items: flex-end;
    }

    /* =========================================================
   Pipeline (si réutilisé plus tard)
   ========================================================= */
    .dashboard-demo .pipeline-list {
        list-style: none;
        margin: 0;
        padding: 0;
        font-size: .72rem;
    }

        .dashboard-demo .pipeline-list li {
            display: flex;
            gap: .55rem;
            margin-bottom: .45rem;
            align-items: flex-start;
            position: relative;
        }

            .dashboard-demo .pipeline-list li:last-child {
                margin-bottom: 0;
            }

    .dashboard-demo .pl-bullet {
        width: 12px;
        height: 12px;
        border-radius: 50%;
        border: 2px solid var(--border);
        margin-top: 2px;
        background: var(--card);
        box-sizing: border-box;
    }

    .dashboard-demo .pipeline-list li.running .pl-bullet {
        border-color: #6366f1;
        background: linear-gradient(135deg,#6366f1,#9333ea);
    }

    .dashboard-demo .pipeline-list li.done .pl-bullet {
        background: linear-gradient(135deg,#22c55e,#16a34a);
        border-color: #16a34a;
    }

    .dashboard-demo .pipeline-list li.error .pl-bullet {
        background: #dc2626;
        border-color: #dc2626;
    }

    .dashboard-demo .pl-title {
        font-weight: 600;
        font-size: .68rem;
    }

    .dashboard-demo .pl-status {
        color: var(--muted);
        line-height: 1.1;
    }

    .dashboard-demo .pl-body {
        flex: 1;
    }

    /* =========================================================
   Metrics
   ========================================================= */
    .dashboard-demo .dash-metrics {
        display: grid;
        gap: .75rem;
        grid-template-columns: repeat(auto-fit,minmax(135px,1fr));
    }

    .dashboard-demo .metric-box {
        background: color-mix(in oklab,var(--card) 95%, transparent);
        border: 1px solid var(--border);
        border-radius: .7rem;
        padding: .55rem .6rem;
        display: flex;
        flex-direction: column;
        gap: .15rem;
    }

    .dashboard-demo .metric-label {
        font-size: .6rem;
        font-weight: 600;
        letter-spacing: .5px;
        text-transform: uppercase;
        color: var(--muted);
    }

    .dashboard-demo .metric-value {
        font-size: 1rem;
        font-weight: 700;
        color: var(--text);
    }

    /* =========================================================
   Charts
   ========================================================= */
    .dashboard-demo .chart-card {
        background: color-mix(in oklab,var(--card) 95%, transparent);
        border: 1px solid var(--border);
        border-radius: .75rem;
        padding: .55rem .6rem .9rem;
        box-shadow: 0 4px 12px rgba(0,0,0,.15);
        position: relative;
        display: flex;
        flex-direction: column;
        gap: .4rem;
    }

    .dashboard-demo .chart-title {
        font-size: .68rem;
        font-weight: 600;
        letter-spacing: .5px;
        text-transform: uppercase;
        color: var(--muted);
        margin: 0 0 .25rem;
    }

    /* =========================================================
   Tables
   ========================================================= */
    .dashboard-demo .bb-table table {
        font-size: .78rem;
        margin: 0;
    }

        .dashboard-demo .bb-table table thead th {
            font-size: .68rem;
            text-transform: uppercase;
            letter-spacing: .5px;
            font-weight: 600;
            white-space: nowrap;
        }

        .dashboard-demo .bb-table table tbody td {
            font-size: .75rem;
        }

:root[data-theme="dark"] .dashboard-demo .bb-table table tbody tr:nth-child(odd) {
    background: rgba(255,255,255,.05);
}

:root[data-theme="dark"] .dashboard-demo .bb-table table tbody tr:nth-child(even) {
    background: rgba(255,255,255,.025);
}

:root[data-theme="dark"] .dashboard-demo .bb-table table tbody tr:hover {
    background: rgba(255,255,255,.10);
}

/* =========================================================
   CSV Preview (si conservé)
   ========================================================= */
.dashboard-demo .csv-preview-table {
    width: 100%;
    border-collapse: collapse;
}

    .dashboard-demo .csv-preview-table th,
    .dashboard-demo .csv-preview-table td {
        font-size: .7rem;
        padding: .35rem .5rem;
        vertical-align: middle;
    }

    .dashboard-demo .csv-preview-table thead th {
        background: #111;
        color: #eee;
    }

:root[data-theme="light"] .dashboard-demo .csv-preview-table thead th {
    background: color-mix(in oklab,var(--card) 90%, transparent);
    color: var(--text);
}

/* =========================================================
   Helper text (contraste dark)
   ========================================================= */
.dashboard-demo .helper-text {
    color: var(--muted);
    line-height: 1.35;
}

:root[data-theme="dark"] .dashboard-demo .helper-text {
    color: #cbd5e1;
}

/* =========================================================
   Progress Bars (si réutilisés)
   ========================================================= */
.dashboard-demo .progress {
    background: color-mix(in oklab,var(--card) 82%, transparent);
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
}

.dashboard-demo .progress-bar {
    background: linear-gradient(90deg,#6366f1,#9333ea);
}

/* =========================================================
   Responsive petits écrans
   ========================================================= */
@media (max-width: 640px) {
    .dashboard-demo .excel-hero {
        grid-template-columns: 54px 1fr;
        grid-template-areas:
            "icon head"
            "icon actions";
    }

    .dashboard-demo .excel-hero-icon {
        width: 54px;
        height: 54px;
        font-size: 1.6rem;
    }

    .dashboard-demo .excel-hero-actions {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: .5rem;
    }

    .dashboard-demo .dash-card {
        padding: 18px 16px 20px;
    }
}

.dash-card {
    background: var(--card); /* fallback */
    background: color-mix(in srgb,var(--card) 96%, transparent);
    /* si tu veux garder la version oklab pour navigateurs récents :
     background: color-mix(in oklab,var(--card) 96%, transparent);
  */
    ...
}

.metric-box, .chart-card {
    background: var(--card);
    background: color-mix(in srgb,var(--card) 95%, transparent);
}
.mini-flow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .55rem;
    margin-top: .75rem;
    padding: .65rem .85rem;
    background: color-mix(in srgb,var(--card) 94%, transparent);
    border: 1px solid var(--border);
    border-radius: .9rem;
    font-size: .7rem;
}

    .mini-flow .mf-step {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: .3rem;
        min-width: 62px;
        text-align: center;
    }

.mf-ico {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    font-size: 1.15rem;
    border-radius: 11px;
    background: linear-gradient(135deg,#6366f1,#9333ea);
    color: #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,.25);
}

    .mf-ico.excel {
        background: linear-gradient(135deg,#16a34a,#22c55e);
    }

    .mf-ico.cleanse {
        background: linear-gradient(135deg,#f59e0b,#ef4444);
    }

    .mf-ico.db {
        background: linear-gradient(135deg,#0ea5e9,#6366f1);
    }

    .mf-ico.app {
        background: linear-gradient(135deg,#6366f1,#9333ea);
    }

.mf-arrow {
    font-size: 1.2rem;
    opacity: .55;
    flex: 0 0 auto;
}

.mf-label {
    line-height: 1.1;
    font-weight: 600;
    letter-spacing: .3px;
}

@media (max-width:560px) {
    .mini-flow {
        justify-content: center;
        row-gap: .9rem;
    }

        .mini-flow .mf-arrow {
            display: none;
        }

        .mini-flow .mf-step {
            min-width: 54px;
        }
}

.import-toast {
    position: fixed;
    top: 68px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4000;
    display: flex;
    gap: .75rem;
    align-items: center;
    background: linear-gradient(135deg, #6366f1, #9333ea);
    color: #fff;
    padding: .75rem 1.1rem .85rem;
    border-radius: 1rem;
    box-shadow: 0 12px 32px rgba(0,0,0,.35);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    animation: toastIn .45s cubic-bezier(.2,.8,.2,1);
}

.import-toast__icon {
    font-size: 1.6rem;
    line-height: 1;
    animation: arrowBounce 1s ease-in-out infinite;
    filter: drop-shadow(0 0 4px rgba(255,255,255,.4));
}

.import-toast__text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.import-toast__hint {
    font-size: .65rem;
    font-weight: 500;
    letter-spacing: .5px;
    opacity: .85;
    text-transform: uppercase;
    margin-top: 2px;
}

@keyframes arrowBounce {
    0%,100% {
        transform: translateY(-2px);
    }

    50% {
        transform: translateY(3px);
    }
}

@keyframes toastIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -6px) scale(.96);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

 
.import-toast.hide { animation: toastOut .35s ease forwards; }
@keyframes toastOut {
    to { opacity:0; transform: translate(-50%, -6px) scale(.96); }
}

/* === Responsive layout for dashboard demo === */

/* 1. Crée une grille flexible pour les cartes de niveau supérieur du dashboard si tu en mets plusieurs horizontales */
.dashboard-demo-root {
    display: grid;
    gap: 1.4rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* Si tu n'as pas .dashboard-demo-root, tu peux appliquer directement à .dashboard-demo
   MAIS seulement si l'ordre actuel (colonne) n'est pas intentionnel. */
.dashboard-demo {
    /* on laisse column pour l'enchaînement vertical principal */
}

    /* 2. Assure que chaque dash-card se contracte correctement */
    .dashboard-demo .dash-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    /* 3. Grille des charts (si tu as un wrapper .charts-row ou équivalent) */
    .dashboard-demo .charts-row {
        display: grid;
        gap: 1rem;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

/* 4. Metrics: déjà en auto-fit -> OK. Juste réduire minmax sur mobile si besoin */
@media (max-width: 480px) {
    .dashboard-demo .dash-metrics {
        grid-template-columns: repeat(auto-fit, minmax(140px,1fr));
    }
}

/* 5. Mobile force single column (sécurité) */
@media (max-width: 640px) {

    /* Empêche tout conteneur flex horizontal héritant de Bootstrap (row) de conserver plusieurs colonnes */
    .dashboard-demo .row,
    .dashboard-demo .charts-row {
        display: block !important;
    }

        .dashboard-demo .row > [class*="col-"],
        .dashboard-demo .charts-row > * {
            width: 100% !important;
            max-width: 100% !important;
        }

    .dashboard-demo .dash-card,
    .dashboard-demo .chart-card {
        margin-inline: 0 !important;
    }
}

/* 6. Tables: permettre rétrécissement / scroll doux si nécessaire */
.dashboard-demo .bb-table,
.dashboard-demo .bb-table table {
    width: 100%;
    max-width: 100%;
}

.dashboard-demo .table-responsive {
    overflow-x: auto;
}

/* 7. Canvas charts: limite la largeur pour ne pas figer */
.dashboard-demo canvas {
    max-width: 100% !important;
    height: auto !important; /* si Chart.js responsive */
}

/* 8. Evite overflow horizontal global */
.dashboard-demo {
    overflow-x: hidden;
}
