/* ============================================
   Tableau de bord animé du haut de page
   4 écrans qui défilent, effet « capture d'écran » avec curseur
   ============================================ */

.dash-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-soft); border: 1px solid var(--border); }
.dash-tab {
    position: relative; flex: 1; overflow: hidden;
    padding: 7px 6px; border: 0; border-radius: 9px; background: transparent;
    font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
    transition: background .25s, color .25s, box-shadow .25s;
}
.dash-tab:hover { color: var(--navy); }
.dash-tab.is-active { background: #fff; color: var(--navy); box-shadow: var(--shadow-sm); }
/* Barre de progression sous l'onglet actif */
.dash-tab::after { content: ""; position: absolute; left: 10%; bottom: 3px; height: 2px; width: 0; border-radius: 2px; background: var(--blue); }
.hero-dash.is-playing .dash-tab.is-active::after { animation: dashProgress var(--dash-delay, 5600ms) linear forwards; }
@keyframes dashProgress { to { width: 80%; } }

/* Écrans empilés : la hauteur suit le plus grand, seul l'actif est visible */
.dash-screens { display: grid; }
.dash-screen {
    grid-area: 1 / 1; display: grid; gap: 14px; align-content: start;
    opacity: 0; visibility: hidden; transform: translateX(18px);
    transition: opacity .45s ease, transform .45s ease, visibility .45s;
}
.dash-screen.is-active { opacity: 1; visibility: visible; transform: none; }
.scr-title { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 700; color: var(--navy); }
.scr-title .ic { width: 16px; height: 16px; color: var(--blue); }
.scr-status { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--green-50); color: var(--green); font-size: 13px; font-weight: 600; }
.scr-status .ic { width: 15px; height: 15px; stroke-width: 2.6; }

/* Animations rejouées à chaque affichage d'un écran */
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes tagIn { 0% { opacity: 0; transform: scale(.6); } 70% { transform: scale(1.08); } 100% { opacity: 1; transform: none; } }
@keyframes drawLine { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-24px) scale(.9); } to { opacity: 1; transform: none; } }
.chart-line { stroke-dasharray: 1; stroke-dashoffset: 0; }
.dash-screen.is-active .chart-line { animation: drawLine 1.6s ease-out both; }
.dash-screen.is-active .feed-row { animation: popIn .5s ease both; }
.dash-screen.is-active .feed-row:nth-child(1) { animation-delay: .5s; }
.dash-screen.is-active .feed-row:nth-child(2) { animation-delay: 1s; }
.dash-screen.is-active .feed-row:nth-child(3) { animation-delay: 1.5s; }
.dash-screen.is-active .scr-status { animation: popIn .5s ease both; animation-delay: 2.6s; }

/* --- Écran Emails --- */
.mail-list { display: grid; gap: 8px; }
.mail-list li { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.mail-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; flex-shrink: 0; }
.av-a { background: #2563eb; }
.av-b { background: #c2410c; }
.av-c { background: #047857; }
.av-d { background: #7c3aed; }
.mail-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 12.5px; color: var(--text-2); }
.mail-txt b { color: var(--navy); font-size: 13px; }
.mail-txt > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-tag { padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.t-blue { background: var(--blue-50); color: var(--blue-600); }
.t-orange { background: var(--amber-50); color: var(--amber); }
.t-green { background: var(--green-50); color: var(--green); }
.t-violet { background: var(--violet-50); color: var(--violet); }
.dash-screen.is-active .mail-list li { animation: popIn .45s ease both; }
.dash-screen.is-active .mail-list li:nth-child(2) { animation-delay: .25s; }
.dash-screen.is-active .mail-list li:nth-child(3) { animation-delay: .5s; }
.dash-screen.is-active .mail-list li:nth-child(4) { animation-delay: .75s; }
.dash-screen.is-active .mail-tag { animation: tagIn .4s ease both; }
.dash-screen.is-active li:nth-child(1) .mail-tag { animation-delay: 1.1s; }
.dash-screen.is-active li:nth-child(2) .mail-tag { animation-delay: 1.4s; }
.dash-screen.is-active li:nth-child(3) .mail-tag { animation-delay: 1.7s; }
.dash-screen.is-active li:nth-child(4) .mail-tag { animation-delay: 2s; }

/* --- Écran Agenda --- */
.cal-grid {
    position: relative; display: grid; grid-template-columns: repeat(5, 1fr);
    grid-template-rows: auto repeat(4, 40px); gap: 6px; padding: 10px;
    border: 1px solid var(--border); border-radius: 12px; background: #fff;
}
.cal-day { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.cal-ev { display: flex; align-items: center; padding: 0 8px; border-radius: 8px; font-size: 11.5px; font-weight: 600; overflow: hidden; white-space: nowrap; }
.ev-1 { grid-column: 1; grid-row: 2; background: var(--blue-50); color: var(--blue-600); }
.ev-2 { grid-column: 2 / span 2; grid-row: 4; background: var(--violet-50); color: var(--violet); }
.ev-3 { grid-column: 5; grid-row: 3 / span 2; background: var(--amber-50); color: var(--amber); }
.ev-new {
    grid-column: 4; grid-row: 2 / span 2; flex-direction: column; align-items: flex-start; justify-content: center;
    gap: 2px; padding: 6px 8px; white-space: normal; background: var(--green); color: #fff;
    box-shadow: 0 10px 20px -8px rgba(4, 120, 87, .6);
}
.ev-new b { font-size: 11.5px; line-height: 1.25; }
.ev-new small { opacity: .85; font-size: 10.5px; }
.dash-screen.is-active .ev-new { animation: dropIn .7s cubic-bezier(.3, 1.4, .5, 1) both; animation-delay: 1s; }

/* --- Écran Appel vocal --- */
.call-timer { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--green); font-size: 12.5px; }
.call-wave { display: flex; align-items: center; justify-content: center; gap: 4px; height: 56px; padding: 0 10px; border-radius: 12px; background: var(--navy); }
.call-wave i { width: 4px; height: 20%; border-radius: 4px; background: #8fb3ff; animation: wave 1.1s ease-in-out infinite; animation-delay: calc(var(--i) * -0.07s); }
@keyframes wave { 0%, 100% { height: 18%; } 50% { height: 85%; } }
.call-lines { display: grid; gap: 8px; }
.call-lines p { display: flex; flex-direction: column; gap: 2px; max-width: 88%; padding: 8px 12px; border-radius: 12px; font-size: 12.5px; }
.call-lines b { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.ln-client { background: var(--bg-soft); color: var(--navy); }
.ln-client b { color: var(--muted); }
.ln-agent { justify-self: end; background: var(--blue); color: #fff; }
.ln-agent b { color: #dbe3f5; }
.dash-screen.is-active .call-lines p { animation: popIn .45s ease both; }
.dash-screen.is-active .call-lines p:nth-child(1) { animation-delay: .4s; }
.dash-screen.is-active .call-lines p:nth-child(2) { animation-delay: 1.2s; }
.dash-screen.is-active .call-lines p:nth-child(3) { animation-delay: 2s; }

/* --- Curseur de souris qui va cliquer sur l'onglet suivant --- */
.dash-cursor {
    position: absolute; z-index: 5; left: 0; top: 0; width: 22px; height: 22px;
    pointer-events: none; opacity: 0;
    transition: transform .9s cubic-bezier(.45, .05, .25, 1), opacity .3s;
    filter: drop-shadow(0 3px 6px rgba(11, 27, 63, .3));
}
.dash-cursor svg { width: 100%; height: 100%; }
.dash-cursor.is-visible { opacity: 1; }
.dash-cursor.is-clicking::after {
    content: ""; position: absolute; left: -8px; top: -8px; width: 22px; height: 22px;
    border-radius: 50%; border: 2px solid var(--blue); animation: clickRing .5s ease-out forwards;
}
@keyframes clickRing { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }

/* Le haut de page posé sur le carrousel : mêmes couleurs que la carte blanche */
.car-hero .dash-tab { color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
    .dash-cursor { display: none; }
    .dash-screen, .dash-screen.is-active * { animation: none !important; transition: none !important; }
}
@media (max-width: 720px) {
    .dash-tab { font-size: 11.5px; padding: 7px 4px; }
}

/* La carte flottante se pose sous le tableau de bord (elle ne cache plus les écrans) */
.hero-dash { margin-bottom: 40px; }
.dash-float { top: auto !important; bottom: -44px; left: 26px; right: auto; }
@media (max-width: 720px) { .hero-dash { margin-bottom: 0; } }

/* La grille des écrans ne doit jamais dépasser la largeur du tableau */
.dash-screens { grid-template-columns: minmax(0, 1fr); }
.dash-screen { min-width: 0; }
@media (max-width: 720px) {
    .dash-tab { white-space: normal; line-height: 1.2; font-size: 11px; padding: 6px 3px; }
}
.dash-screen, .mail-list, .call-lines { grid-template-columns: minmax(0, 1fr); }
