/**
 * CHATBOT DECIDAUTO - Design Cocorico Français Ultra-Pro
 * Couleurs officielles tricolore : #0055A4 (bleu), #FFFFFF (blanc), #EF4135 (rouge)
 */

/* ===========================
   BOUTON FLOTTANT TRICOLORE
   =========================== */
#chatbot-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0055A4 0%, #0055A4 33%, #FFFFFF 33%, #FFFFFF 66%, #EF4135 66%, #EF4135 100%);
    box-shadow: 0 8px 24px rgba(0, 85, 164, 0.4);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    border: 3px solid white;
}

#chatbot-btn:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 32px rgba(0, 85, 164, 0.6);
}

#chatbot-btn-icon {
    width: 45px;
    height: 45px;
    position: relative;
    z-index: 10;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

#chatbot-btn.open i::before {
    content: "\f00d"; /* X icon */
}

/* Badge notification */
#chatbot-btn .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #EF4135;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ===========================
   FENÊTRE DE CHAT
   =========================== */
#chatbot-window {
    position: fixed;
    bottom: 110px;
    right: 24px;
    width: 420px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 140px);
    background: white;
    border-radius: 24px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid #0055A4;
}

#chatbot-window.open {
    display: flex;
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* HEADER TRICOLORE */
#chatbot-header {
    background: linear-gradient(135deg, #0055A4 0%, #003875 100%);
    padding: 20px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid #EF4135;
    position: relative;
}

#chatbot-header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0055A4 33%, #FFFFFF 33%, #FFFFFF 66%, #EF4135 66%);
}

#chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

#chatbot-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #EF4135;
    padding: 4px;
}

#chatbot-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#chatbot-title {
    font-size: 18px;
    font-weight: bold;
    margin: 0;
}

#chatbot-subtitle {
    font-size: 12px;
    opacity: 0.9;
    margin: 0;
}

#chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#chatbot-close:hover {
    background: #EF4135;
    transform: rotate(90deg);
}

/* BODY DU CHAT */
#chatbot-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: linear-gradient(180deg, #f8f9fa 0%, white 100%);
}

#chatbot-body::-webkit-scrollbar {
    width: 8px;
}

#chatbot-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#chatbot-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #0055A4, #EF4135);
    border-radius: 4px;
}

#chatbot-body::-webkit-scrollbar-thumb:hover {
    background: #003875;
}

/* MESSAGES */
.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    animation: message-slide-in 0.3s ease-out;
}

@keyframes message-slide-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.bot {
    flex-direction: row;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.chat-message.bot .message-avatar {
    background: linear-gradient(135deg, #0055A4, #003875);
    color: white;
    border: 2px solid #EF4135;
}

.chat-message.user .message-avatar {
    background: linear-gradient(135deg, #EF4135, #C22E2A);
    color: white;
    border: 2px solid #0055A4;
}

.message-content {
    flex: 1;
    max-width: 75%;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    word-wrap: break-word;
}

.chat-message.bot .message-bubble {
    background: white;
    color: #333;
    border: 2px solid #0055A4;
    border-bottom-left-radius: 4px;
}

.chat-message.user .message-bubble {
    background: linear-gradient(135deg, #0055A4, #003875);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 4px;
}

.chat-message.bot .message-time {
    text-align: left;
}

.chat-message.user .message-time {
    text-align: right;
}

/* SUGGESTIONS */
.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.suggestion-chip {
    background: linear-gradient(135deg, #0055A4, #003875);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.suggestion-chip:hover {
    background: linear-gradient(135deg, #EF4135, #C22E2A);
    border-color: #0055A4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 65, 53, 0.3);
}

/* TYPING INDICATOR */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border: 2px solid #0055A4;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0055A4;
    animation: typing-bounce 1.4s infinite;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
    background: #FFFFFF;
    border: 2px solid #0055A4;
}
.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
    background: #EF4135;
}

@keyframes typing-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-8px); }
}

/* FOOTER */
#chatbot-footer {
    padding: 16px;
    background: white;
    border-top: 3px solid #0055A4;
}

#chatbot-input-wrapper {
    display: flex;
    gap: 8px;
}

#chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #0055A4;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

#chatbot-input:focus {
    border-color: #EF4135;
    box-shadow: 0 0 0 3px rgba(0, 85, 164, 0.1);
}

#chatbot-send {
    background: linear-gradient(135deg, #0055A4, #003875);
    color: white;
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
    border: 2px solid #EF4135;
}

#chatbot-send:hover:not(:disabled) {
    background: linear-gradient(135deg, #EF4135, #C22E2A);
    border-color: #0055A4;
    transform: scale(1.1) rotate(15deg);
}

#chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    #chatbot-window {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    #chatbot-btn {
        bottom: 16px;
        right: 16px;
        width: 60px;
        height: 60px;
    }

    #chatbot-btn i {
        font-size: 28px;
    }
}

/* ACCESSIBILITY */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

*:focus-visible {
    outline: 3px solid #0055A4;
    outline-offset: 2px;
}

/* ===========================
   ANIMATION COQ SPECTACULAIRE
   Compatible Firefox, Chrome, Safari, Edge
   =========================== */

/* Container pour l'animation du coq - PLEIN ÉCRAN */
#coq-animation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9997;
    overflow: hidden;
    display: none;
}

#coq-animation-container.active {
    display: block;
}

/* Sol virtuel au centre de la page */
#coq-animation-container::after {
    content: '';
    position: absolute;
    bottom: 50px;
    left: 20%;
    right: 20%;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(0, 85, 164, 0.15) 20%,
        rgba(0, 85, 164, 0.25) 50%,
        rgba(0, 85, 164, 0.15) 80%,
        transparent 100%);
    border-radius: 1px;
    opacity: 0;
    -webkit-transition: opacity 0.5s ease;
    -moz-transition: opacity 0.5s ease;
    transition: opacity 0.5s ease;
}

#coq-animation-container.active::after {
    opacity: 1;
}

/* Le coq animé - Position initiale en bas à droite
   Utilise left/bottom fixes + transform pour compatibilité Firefox */
#coq-animated {
    position: absolute;
    left: auto;
    right: 36px;
    bottom: 36px;
    width: 70px;
    height: 70px;
    opacity: 0;
    pointer-events: none;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.4));
    z-index: 10001;
    -webkit-transform-origin: center center;
    -moz-transform-origin: center center;
    transform-origin: center center;
    /* will-change pour optimisation GPU */
    will-change: transform, opacity;
}

/* Bulle de dialogue - À côté du coq (près du bouton) */
#coq-speech-bubble {
    position: absolute;
    bottom: 110px;
    right: 100px;
    -webkit-transform: scale(0);
    -moz-transform: scale(0);
    transform: scale(0);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 14px 20px;
    border-radius: 20px;
    border: 2px solid #0055A4;
    font-size: 14px;
    font-weight: 600;
    color: #0055A4;
    white-space: nowrap;
    opacity: 0;
    box-shadow:
        0 10px 30px rgba(0, 85, 164, 0.25),
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    z-index: 10002;
    font-family: 'DM Sans', sans-serif;
    will-change: transform, opacity;
}

/* Flèche de la bulle pointant vers le bas-droite (vers le coq) */
#coq-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -12px;
    right: 30px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 12px solid #0055A4;
}

#coq-speech-bubble::before {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 32px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 9px solid white;
    z-index: 1;
}

/* ===================================
   ANIMATIONS FIREFOX-COMPATIBLE
   Utilise UNIQUEMENT transform (pas right/bottom animés)
   =================================== */

/* Phase 1: Le coq sort du bouton et s'élève (petit saut) */
@-webkit-keyframes coq-emerge {
    0% {
        opacity: 0;
        -webkit-transform: translate(0, 0) scale(0.5);
        transform: translate(0, 0) scale(0.5);
    }
    50% {
        opacity: 1;
        -webkit-transform: translate(-20px, -40px) scale(1.05) rotate(-10deg);
        transform: translate(-20px, -40px) scale(1.05) rotate(-10deg);
    }
    100% {
        opacity: 1;
        -webkit-transform: translate(-20px, -40px) scale(1.05) rotate(-10deg);
        transform: translate(-20px, -40px) scale(1.05) rotate(-10deg);
    }
}
@-moz-keyframes coq-emerge {
    0% {
        opacity: 0;
        -moz-transform: translate(0, 0) scale(0.5);
        transform: translate(0, 0) scale(0.5);
    }
    50% {
        opacity: 1;
        -moz-transform: translate(-20px, -40px) scale(1.05) rotate(-10deg);
        transform: translate(-20px, -40px) scale(1.05) rotate(-10deg);
    }
    100% {
        opacity: 1;
        -moz-transform: translate(-20px, -40px) scale(1.05) rotate(-10deg);
        transform: translate(-20px, -40px) scale(1.05) rotate(-10deg);
    }
}
@keyframes coq-emerge {
    0% {
        opacity: 0;
        transform: translate(0, 0) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translate(-20px, -40px) scale(1.05) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: translate(-20px, -40px) scale(1.05) rotate(-10deg);
    }
}

/* Phase 2: Petit vol/saut vers la gauche (juste à côté du bouton) */
@-webkit-keyframes coq-fly {
    0% {
        -webkit-transform: translate(-20px, -40px) rotate(-10deg) scale(1.05);
        transform: translate(-20px, -40px) rotate(-10deg) scale(1.05);
    }
    50% {
        -webkit-transform: translate(-60px, -60px) rotate(-5deg) scale(1);
        transform: translate(-60px, -60px) rotate(-5deg) scale(1);
    }
    100% {
        -webkit-transform: translate(-100px, -20px) rotate(0deg) scale(1);
        transform: translate(-100px, -20px) rotate(0deg) scale(1);
    }
}
@-moz-keyframes coq-fly {
    0% {
        -moz-transform: translate(-20px, -40px) rotate(-10deg) scale(1.05);
        transform: translate(-20px, -40px) rotate(-10deg) scale(1.05);
    }
    50% {
        -moz-transform: translate(-60px, -60px) rotate(-5deg) scale(1);
        transform: translate(-60px, -60px) rotate(-5deg) scale(1);
    }
    100% {
        -moz-transform: translate(-100px, -20px) rotate(0deg) scale(1);
        transform: translate(-100px, -20px) rotate(0deg) scale(1);
    }
}
@keyframes coq-fly {
    0% {
        transform: translate(-20px, -40px) rotate(-10deg) scale(1.05);
    }
    50% {
        transform: translate(-60px, -60px) rotate(-5deg) scale(1);
    }
    100% {
        transform: translate(-100px, -20px) rotate(0deg) scale(1);
    }
}

/* Phase 3: Petite marche vers la gauche (~4cm / 40px de plus) */
@-webkit-keyframes coq-walk {
    0% {
        -webkit-transform: translate(-100px, -20px) rotate(0deg) scaleX(-1);
        transform: translate(-100px, -20px) rotate(0deg) scaleX(-1);
    }
    25% {
        -webkit-transform: translate(-115px, -24px) rotate(4deg) scaleX(-1);
        transform: translate(-115px, -24px) rotate(4deg) scaleX(-1);
    }
    50% {
        -webkit-transform: translate(-130px, -20px) rotate(-4deg) scaleX(-1);
        transform: translate(-130px, -20px) rotate(-4deg) scaleX(-1);
    }
    75% {
        -webkit-transform: translate(-140px, -24px) rotate(3deg) scaleX(-1);
        transform: translate(-140px, -24px) rotate(3deg) scaleX(-1);
    }
    100% {
        -webkit-transform: translate(-150px, -20px) rotate(0deg) scaleX(-1);
        transform: translate(-150px, -20px) rotate(0deg) scaleX(-1);
    }
}
@-moz-keyframes coq-walk {
    0% {
        -moz-transform: translate(-100px, -20px) rotate(0deg) scaleX(-1);
        transform: translate(-100px, -20px) rotate(0deg) scaleX(-1);
    }
    25% {
        -moz-transform: translate(-115px, -24px) rotate(4deg) scaleX(-1);
        transform: translate(-115px, -24px) rotate(4deg) scaleX(-1);
    }
    50% {
        -moz-transform: translate(-130px, -20px) rotate(-4deg) scaleX(-1);
        transform: translate(-130px, -20px) rotate(-4deg) scaleX(-1);
    }
    75% {
        -moz-transform: translate(-140px, -24px) rotate(3deg) scaleX(-1);
        transform: translate(-140px, -24px) rotate(3deg) scaleX(-1);
    }
    100% {
        -moz-transform: translate(-150px, -20px) rotate(0deg) scaleX(-1);
        transform: translate(-150px, -20px) rotate(0deg) scaleX(-1);
    }
}
@keyframes coq-walk {
    0% {
        transform: translate(-100px, -20px) rotate(0deg) scaleX(-1);
    }
    25% {
        transform: translate(-115px, -24px) rotate(4deg) scaleX(-1);
    }
    50% {
        transform: translate(-130px, -20px) rotate(-4deg) scaleX(-1);
    }
    75% {
        transform: translate(-140px, -24px) rotate(3deg) scaleX(-1);
    }
    100% {
        transform: translate(-150px, -20px) rotate(0deg) scaleX(-1);
    }
}

/* Phase 4: Le coq s'arrête et parle (petit balancement) */
@-webkit-keyframes coq-talk {
    0%, 100% {
        -webkit-transform: translate(-150px, -20px) rotate(0deg) scaleX(-1) scale(1);
        transform: translate(-150px, -20px) rotate(0deg) scaleX(-1) scale(1);
    }
    25% {
        -webkit-transform: translate(-150px, -20px) rotate(2deg) scaleX(-1) scale(1.01);
        transform: translate(-150px, -20px) rotate(2deg) scaleX(-1) scale(1.01);
    }
    50% {
        -webkit-transform: translate(-150px, -20px) rotate(-2deg) scaleX(-1) scale(1);
        transform: translate(-150px, -20px) rotate(-2deg) scaleX(-1) scale(1);
    }
    75% {
        -webkit-transform: translate(-150px, -20px) rotate(2deg) scaleX(-1) scale(1.01);
        transform: translate(-150px, -20px) rotate(2deg) scaleX(-1) scale(1.01);
    }
}
@-moz-keyframes coq-talk {
    0%, 100% {
        -moz-transform: translate(-150px, -20px) rotate(0deg) scaleX(-1) scale(1);
        transform: translate(-150px, -20px) rotate(0deg) scaleX(-1) scale(1);
    }
    25% {
        -moz-transform: translate(-150px, -20px) rotate(2deg) scaleX(-1) scale(1.01);
        transform: translate(-150px, -20px) rotate(2deg) scaleX(-1) scale(1.01);
    }
    50% {
        -moz-transform: translate(-150px, -20px) rotate(-2deg) scaleX(-1) scale(1);
        transform: translate(-150px, -20px) rotate(-2deg) scaleX(-1) scale(1);
    }
    75% {
        -moz-transform: translate(-150px, -20px) rotate(2deg) scaleX(-1) scale(1.01);
        transform: translate(-150px, -20px) rotate(2deg) scaleX(-1) scale(1.01);
    }
}
@keyframes coq-talk {
    0%, 100% {
        transform: translate(-150px, -20px) rotate(0deg) scaleX(-1) scale(1);
    }
    25% {
        transform: translate(-150px, -20px) rotate(2deg) scaleX(-1) scale(1.01);
    }
    50% {
        transform: translate(-150px, -20px) rotate(-2deg) scaleX(-1) scale(1);
    }
    75% {
        transform: translate(-150px, -20px) rotate(2deg) scaleX(-1) scale(1.01);
    }
}

/* Phase 5: Le coq retourne vers le bouton (petit saut retour) */
@-webkit-keyframes coq-return-fly {
    0% {
        -webkit-transform: translate(-150px, -20px) rotate(0deg) scaleX(1);
        transform: translate(-150px, -20px) rotate(0deg) scaleX(1);
        opacity: 1;
    }
    30% {
        -webkit-transform: translate(-100px, -50px) rotate(-10deg) scaleX(1);
        transform: translate(-100px, -50px) rotate(-10deg) scaleX(1);
        opacity: 1;
    }
    60% {
        -webkit-transform: translate(-50px, -40px) rotate(-5deg) scaleX(1);
        transform: translate(-50px, -40px) rotate(-5deg) scaleX(1);
        opacity: 1;
    }
    85% {
        -webkit-transform: translate(-15px, -20px) rotate(5deg) scaleX(1);
        transform: translate(-15px, -20px) rotate(5deg) scaleX(1);
        opacity: 0.9;
    }
    100% {
        -webkit-transform: translate(0, 0) rotate(0deg) scaleX(1) scale(0.8);
        transform: translate(0, 0) rotate(0deg) scaleX(1) scale(0.8);
        opacity: 0;
    }
}
@-moz-keyframes coq-return-fly {
    0% {
        -moz-transform: translate(-150px, -20px) rotate(0deg) scaleX(1);
        transform: translate(-150px, -20px) rotate(0deg) scaleX(1);
        opacity: 1;
    }
    30% {
        -moz-transform: translate(-100px, -50px) rotate(-10deg) scaleX(1);
        transform: translate(-100px, -50px) rotate(-10deg) scaleX(1);
        opacity: 1;
    }
    60% {
        -moz-transform: translate(-50px, -40px) rotate(-5deg) scaleX(1);
        transform: translate(-50px, -40px) rotate(-5deg) scaleX(1);
        opacity: 1;
    }
    85% {
        -moz-transform: translate(-15px, -20px) rotate(5deg) scaleX(1);
        transform: translate(-15px, -20px) rotate(5deg) scaleX(1);
        opacity: 0.9;
    }
    100% {
        -moz-transform: translate(0, 0) rotate(0deg) scaleX(1) scale(0.8);
        transform: translate(0, 0) rotate(0deg) scaleX(1) scale(0.8);
        opacity: 0;
    }
}
@keyframes coq-return-fly {
    0% {
        transform: translate(-150px, -20px) rotate(0deg) scaleX(1);
        opacity: 1;
    }
    30% {
        transform: translate(-100px, -50px) rotate(-10deg) scaleX(1);
        opacity: 1;
    }
    60% {
        transform: translate(-50px, -40px) rotate(-5deg) scaleX(1);
        opacity: 1;
    }
    85% {
        transform: translate(-15px, -20px) rotate(5deg) scaleX(1);
        opacity: 0.9;
    }
    100% {
        transform: translate(0, 0) rotate(0deg) scaleX(1) scale(0.8);
        opacity: 0;
    }
}

/* Animations de la bulle de dialogue - fluides */
@-webkit-keyframes speech-bubble-appear {
    0% {
        opacity: 0;
        -webkit-transform: scale(0) translateY(15px);
        transform: scale(0) translateY(15px);
    }
    70% {
        -webkit-transform: scale(1.05) translateY(-2px);
        transform: scale(1.05) translateY(-2px);
    }
    100% {
        opacity: 1;
        -webkit-transform: scale(1) translateY(0);
        transform: scale(1) translateY(0);
    }
}
@-moz-keyframes speech-bubble-appear {
    0% {
        opacity: 0;
        -moz-transform: scale(0) translateY(15px);
        transform: scale(0) translateY(15px);
    }
    70% {
        -moz-transform: scale(1.05) translateY(-2px);
        transform: scale(1.05) translateY(-2px);
    }
    100% {
        opacity: 1;
        -moz-transform: scale(1) translateY(0);
        transform: scale(1) translateY(0);
    }
}
@keyframes speech-bubble-appear {
    0% {
        opacity: 0;
        transform: scale(0) translateY(15px);
    }
    70% {
        transform: scale(1.05) translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@-webkit-keyframes speech-bubble-disappear {
    0% {
        opacity: 1;
        -webkit-transform: scale(1);
        transform: scale(1);
    }
    100% {
        opacity: 0;
        -webkit-transform: scale(0.8) translateY(10px);
        transform: scale(0.8) translateY(10px);
    }
}
@-moz-keyframes speech-bubble-disappear {
    0% {
        opacity: 1;
        -moz-transform: scale(1);
        transform: scale(1);
    }
    100% {
        opacity: 0;
        -moz-transform: scale(0.8) translateY(10px);
        transform: scale(0.8) translateY(10px);
    }
}
@keyframes speech-bubble-disappear {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(10px);
    }
}

/* Classes d'animation - timing fluide avec cubic-bezier */
#coq-animated.emerge {
    -webkit-animation: coq-emerge 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    -moz-animation: coq-emerge 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation: coq-emerge 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#coq-animated.fly {
    -webkit-animation: coq-fly 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    -moz-animation: coq-fly 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    animation: coq-fly 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

#coq-animated.walk {
    -webkit-animation: coq-walk 1.2s cubic-bezier(0.37, 0, 0.63, 1) forwards;
    -moz-animation: coq-walk 1.2s cubic-bezier(0.37, 0, 0.63, 1) forwards;
    animation: coq-walk 1.2s cubic-bezier(0.37, 0, 0.63, 1) forwards;
}

#coq-animated.talk {
    -webkit-animation: coq-talk 0.8s ease-in-out infinite;
    -moz-animation: coq-talk 0.8s ease-in-out infinite;
    animation: coq-talk 0.8s ease-in-out infinite;
}

#coq-animated.return {
    -webkit-animation: coq-return-fly 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    -moz-animation: coq-return-fly 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    animation: coq-return-fly 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

#coq-speech-bubble.show {
    -webkit-animation: speech-bubble-appear 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    -moz-animation: speech-bubble-appear 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation: speech-bubble-appear 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

#coq-speech-bubble.hide {
    -webkit-animation: speech-bubble-disappear 0.25s ease-out forwards;
    -moz-animation: speech-bubble-disappear 0.25s ease-out forwards;
    animation: speech-bubble-disappear 0.25s ease-out forwards;
}

/* Masquer le coq du bouton pendant l'animation */
#chatbot-btn.coq-animating #chatbot-btn-icon {
    opacity: 0;
    -webkit-transition: opacity 0.2s ease;
    -moz-transition: opacity 0.2s ease;
    transition: opacity 0.2s ease;
}

/* Effet de brillance pendant le vol */
#coq-animated.fly::after,
#coq-animated.return::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    border-radius: 50%;
    -webkit-animation: sparkle 0.3s ease-in-out infinite;
    -moz-animation: sparkle 0.3s ease-in-out infinite;
    animation: sparkle 0.3s ease-in-out infinite;
    pointer-events: none;
}

@-webkit-keyframes sparkle {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
@-moz-keyframes sparkle {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
@keyframes sparkle {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}
