/* ═══════════════════════════════════════════════════════
   CONTENEUR GLOBAL DU CHATBOT
   ═══════════════════════════════════════════════════════ */
#agent-widget {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 10000;
    font-family: 'Segoe UI', sans-serif;
}

/* ═══════════════════════════════════════════════════════
   BULLE D’ACCUEIL
   ═══════════════════════════════════════════════════════ */
#agent-widget .bubble {
    background: #2563eb;
    color: #fff;
    padding: 12px 20px;
    border-radius: 14px;

    max-width: 300px;
    min-width: 240px;

    font-size: 0.95rem;
    text-align: center;

    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.34);

    position: absolute;
    bottom: 17px;
    right: 178px;

    display: none;

    animation: bubble-pop 0.35s ease-out forwards,
        bubble-wiggle 2s ease-in-out 0.5s infinite;
}

/* Pop d'apparition */
@keyframes bubble-pop {
    0% {
        transform: scale(0.6) rotate(-4deg);
        opacity: 0;
    }

    60% {
        transform: scale(1.05) rotate(2deg);
        opacity: 1;
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Secousse légère / wiggle vivant */
@keyframes bubble-wiggle {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-2px) rotate(-1.5deg);
    }

    50% {
        transform: translateY(1px) rotate(1.5deg);
    }

    75% {
        transform: translateY(-1px) rotate(-0.8deg);
    }
}



#agent-widget .bubble::after {
    border-left: 10px solid #2563eb;
    /* flèche plus horizontale */
}


#agent-widget:not(.open) .bubble {
    display: block;
}

#agent-widget .bubble::after {
    content: '';
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid #2563eb;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

/* Animations */
@keyframes bubble-slide-in {
    0% {
        opacity: 0;
        transform: translateX(-20px) scale(0.95);
    }

    60% {
        opacity: 1;
        transform: translateX(4px) scale(1.03);
    }

    100% {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes bubble-float {

    0%,
    100% {
        transform: translateY(0);
    }

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

/* Responsive bulle */
@media (max-width: 480px) {
    #agent-widget .bubble {
        max-width: 200px;
        font-size: 0.85rem;
        padding: 8px 12px;
        right: calc(56px + 14px);
        bottom: 8px;
    }

    #agent-widget .bubble::after {
        right: -6px;
    }
}

@media (max-width: 360px) {
    #agent-widget .bubble {
        max-width: 160px;
        font-size: 0.8rem;
    }
}

/* ═══════════════════════════════════════════════════════
   BOUTON FLOTTANT
   ═══════════════════════════════════════════════════════ */
#agent-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 72px;
    /* ← plus grand */
    height: 72px;
    /* ← plus grand */
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 32px;
    /* ← icône plus grande */
    background: #3a86ff;
    color: #fff;
    box-shadow: 0 12px 35px rgba(0, 0, 0, .35);
    transition: transform .25s ease;
}

#agent-toggle:hover {
    transform: scale(1.08);
    /* petit zoom élégant */
}



/* ═══════════════════════════════════════════════════════
   PANEL PRINCIPAL
   ═══════════════════════════════════════════════════════ */
#agent-panel {
    display: none;
    flex-direction: column;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 360px;
    height: 500px;
    max-height: 500px;
    background: #1e1e1e;
    border-radius: 16px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    z-index: 10000;
    transition: all 0.3s ease;
}

#agent-widget.open #agent-panel {
    display: flex;
}

/* Header */
#agent-header {
    position: relative;
    z-index: 10002;
    background: #111;
    color: #fff;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 1rem;
}

#agent-controls {
    display: flex;
    gap: 6px;
}

#agent-controls button {
    background: none;
    color: #fff;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 6px;
    transition: transform 0.2s ease, color 0.2s ease;
}

#agent-controls button:hover {
    color: #3b82f6;
    transform: scale(1.15);
}

/* Zone de messages */
#agent-log {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    font-size: 0.95rem;
    color: #eee;
}

.msg {
    margin: 6px 0;
}

.msg.bot {
    text-align: left;
}

.msg.you,
.msg.user {
    text-align: right;
}

.msg span {
    display: inline-flex;
    background: #333;
    padding: 6px 10px;
    border-radius: 10px;
    max-width: 100%;
    white-space: normal;
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
}


/* Formulaire */
#agent-form {
    display: flex;
    padding: 10px;
    border-top: 1px solid #333;
    background: #1e1e1e;
}

#agent-input {
    flex: 1;
    border: none;
    padding: 10px;
    border-radius: 8px;
    margin-right: 6px;
    background: #2a2a2a;
    color: #fff;
}

#agent-input::placeholder {
    color: #888;
}

#agent-form button[type="submit"] {
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    cursor: pointer;
}

/* Toolbar */
#agent-toolbar {
    display: flex;
    gap: 8px;
    padding: 8px;
    border-top: 1px solid #333;
    justify-content: flex-end;
    background: #1e1e1e;
}

#agent-toolbar button {
    background: none;
    color: #ccc;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

/* Micro */
#agent-mic {
    background: #2a2a2a;
    color: #eee;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

#agent-mic:hover {
    background: #3a86ff;
    color: #fff;
    transform: scale(1.1);
}

#agent-mic.recording {
    background: #ff4b4b;
    color: #fff;
    animation: pulse 1.2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 75, 75, 0.6);
    }

    70% {
        box-shadow: 0 0 0 8px rgba(255, 75, 75, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 75, 75, 0);
    }
}

/* Mentions légales */
.legal-panel {
    background: #111;
    color: #eee;
    padding: 1.5em;
    border-top: 1px solid #333;
    max-width: 700px;
    margin: 1em auto;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

.legal-btn-close {
    background: #2563eb;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}

.legal-btn-close:hover {
    background: #1d4ed8;
}

/* États : agrandi / réduit */
#agent-widget.max #agent-panel {
    width: 90vw;
    height: 80vh;
    right: 5vw;
    bottom: 5vh;
    max-height: none;
    border-radius: 20px;
}

#agent-widget.min #agent-panel {
    width: 360px;
    height: 500px;
    border-radius: 16px;
    overflow: hidden;
}

/* Adaptation mobile */
@media (max-width: 600px) {
    #agent-widget.max #agent-panel {
        width: 95vw;
        height: 85vh;
        right: 2.5vw;
        bottom: 2.5vh;
    }

    #agent-widget.min #agent-panel {
        width: 340px;
        height: 460px;
    }
}

/* ════════════════════════════════════════════
   FAQ INTERNE
   ════════════════════════════════════════════ */
.faq-box {
    position: absolute;
    bottom: 80px;
    right: 12px;
    width: 320px;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 12px;
    padding: 16px;
    z-index: 20000 !important;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
    display: none;
    animation: faqFadeIn 0.2s ease-out;
}

@keyframes faqFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.faq-content {
    color: #e5e7eb;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.faq-content strong {
    color: #4ade80;
    cursor: pointer;
    font-size: 1rem;
    margin-bottom: 6px;
    display: inline-block;
}

.faq-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
}

.faq-btn,
.faq-btn-close {
    background: #374151;
    color: #fff;
    border: none;
    padding: 6px 12px;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.faq-btn:hover {
    background: #4b5563;
}

.faq-btn-close {
    background: #ef4444;
}

.faq-btn-close:hover {
    background: #dc2626;
}

#faq-open {
    background: #374151 !important;
    color: #fff !important;
    border-radius: 6px !important;
}

/* Carousel accueil */
.capabilities-carousel {
    margin-top: 10px;
    overflow: hidden;
    height: 40px;
    position: relative;
}

/* =========================================================
   CAROUSEL : VERTICAL
========================================================= */
.capabilities-carousel {
    margin-top: 10px;
    height: 40px;
    overflow: hidden;
    position: relative;
}

.carousel-track {
    display: block;
    /* <-- Vertical */
    animation: carouselVertical 20s linear infinite;
}

.carousel-item {
    height: 40px;
    display: flex;
    align-items: center;
    color: #9ca3af;
    font-size: 0.85rem;
    padding-left: 6px;
}

/* 6 items = translation de -240px */
@keyframes carouselVertical {
    0% {
        transform: translateY(0);
    }

    15% {
        transform: translateY(-40px);
    }

    30% {
        transform: translateY(-80px);
    }

    45% {
        transform: translateY(-120px);
    }

    60% {
        transform: translateY(-160px);
    }

    75% {
        transform: translateY(-200px);
    }

    100% {
        transform: translateY(0);
    }
}


/* ════════════════════════════════════════════
   FIX EDGE (VERSION FINALE SANS DOUBLON)
   ════════════════════════════════════════════ */

/* Empêche Edge de couper le panel */
#agent-panel {
    overflow: visible !important;
}

/* Bande inférieure non compressée dans Edge */
#agent-toolbar,
#agent-form {
    min-width: 100% !important;
    flex-shrink: 0 !important;
    display: flex !important;
    position: relative !important;
    z-index: 99999 !important;
}

/* Boutons toujours cliquables dans Edge */
#agent-toolbar button,
#faq-open,
#agent-clear {
    position: relative !important;
    z-index: 100000 !important;
    display: inline-flex !important;
}

/* Bouton envoyer non coupé */
#agent-form button[type="submit"] {
    position: relative !important;
    z-index: 100000 !important;
}

#agent-log {
    overflow-y: auto;
    overflow-x: auto;
    max-width: 100%;
    word-wrap: break-word;
    white-space: normal;
}

#agent-panel.max #agent-log {
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    overflow-x: auto;
}

@media (max-width: 480px) {
    #agent-toggle {
        width: 64px;
        height: 64px;
        font-size: 28px;
        right: 18px;
        bottom: 18px;
    }

    #agent-panel {
        right: 8px;
        left: 8px;
        width: auto;
    }
}

/* Carousel — version mobile */
@media (max-width: 480px) {
    .capabilities-carousel {
        height: 32px;
        margin-top: 6px;
    }

    .carousel-item {
        font-size: 0.78rem;
        padding-left: 4px;
    }

    .carousel-track {
        animation-duration: 14s;
        /* un peu plus rapide */
    }
}

@media (max-width: 360px) {
    .carousel-item {
        font-size: 0.72rem;
    }
}

/* =========================================================
   CHATBOT — Responsive Mobile (fix complet)
========================================================= */
@media (max-width: 600px) {

    /* Panneau principal */
    .agent-panel {
        width: 92vw !important;
        left: 4vw !important;
        right: 4vw !important;
        bottom: 90px !important;
        max-height: 78vh !important;
        border-radius: 16px !important;
    }

    /* Zone messages : occupe bien l’espace */
    .agent-log {
        max-height: calc(78vh - 120px) !important;
        padding-bottom: 24px;
    }

    /* Bouton */
    #agent-toggle {
        width: 64px;
        height: 64px;
        font-size: 28px;
        right: 12px;
        bottom: 12px;
    }
}

/* === FIX RESPONSIVE (600px) === */
@media (max-width: 600px) {}

/* === PLEIN ÉCRAN PETITS TÉLÉPHONES (480px) === */
@media (max-width: 480px) {
    .agent-panel {
        width: 100vw !important;
        height: 88vh !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        border-radius: 0 !important;
    }

    .agent-log {
        max-height: calc(88vh - 130px) !important;
    }

    #agent-toggle {
        width: 60px;
        height: 60px;
        font-size: 26px;
        bottom: 16px;
        right: 16px;
    }
}