/* Animation SVG Logo */
@keyframes svg-stroke-draw {
    0%   { stroke-dashoffset: 1; }
    40%  { stroke-dashoffset: 0; }
    70%  { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 1; }
}

.logo-svg-animated {
    width: 40px;
    height: 40px;
    overflow: visible;
}

.logo-svg-animated path {
    fill: none;
    stroke: #ededed;
    stroke-width: 8;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: svg-stroke-draw 6s ease-in-out infinite;
}

/* Styles globaux */
#center-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
}

/* Bouton du chat - Optimisé pour TOUS les mobiles */
#chat-circle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-secondary-color) 100%);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    /* Accélération matérielle pour tous mobiles */
    -webkit-transform: translate3d(0, 0, 0);
    -moz-transform: translate3d(0, 0, 0);
    -ms-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    backface-visibility: hidden;
}

#chat-circle:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

#chat-circle img {
    width: 40px;
    height: 40px;
    filter: brightness(0) invert(1);
}

/* Conteneur principal du chat */
.chat-box {
    display: none;
    position: fixed;
    right: 30px;
    bottom: 120px;
    width: 415px;
    max-width: 90vw;
    height: 600px;
    max-height: 80vh;
    background: var(--bg-color);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    overflow: hidden;
    transform-origin: bottom right;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

/* En-tête du chat */
.chat-box-header {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-secondary-color) 100%);
    height: 80px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: relative;
}

.chat-box-header img.bot-avatar {
    width: 50px;
    height: 50px;
    position: relative;
    top: 10% !important;
    object-fit: cover;
}

.chat-box-header .header-text {
    flex: 1;
    margin-left: 15px;
    display: flex;
    align-items: center;
}

.chat-box-header .header-text h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chat-box-header .header-text p {
    margin: 0;
    font-size: 13px;
    opacity: 0.8;
}

/* Status indicator - Online dot */
.online-status {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #4CAF50;
    border-radius: 50%;
    margin-right: 6px;
    animation: blink 1.5s infinite;
    flex-shrink: 0;
    box-shadow: 0 0 10px #4CAF50;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 10px #4CAF50;
    }
    50% {
        opacity: 0.3;
        box-shadow: 0 0 2px #4CAF50;
    }
}

.chat-box-toggle {
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.2s ease;
}

.chat-box-toggle:hover {
    opacity: 1;
    transform: rotate(90deg);
}

/* Corps du chat */
.chat-box-body {
    height: calc(100% - 150px);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.chat-logs {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    scroll-behavior: smooth;
    padding-bottom: 150px; /* Espace pour la zone de saisie */
    /* Masquer la barre de défilement */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.chat-logs::-webkit-scrollbar {
    display: none; /* Chrome/Safari/Opera */
}

/* Messages */
.chat-msg {
    clear: both;
    margin: 25px 0;
    animation: messageIn 0.3s ease;
}

/* Message BOT (gauche) */
.chat-msg.user {
    margin: 25px 0;
}

/* Message UTILISATEUR (droite) */
.chat-msg.self {
    margin: 25px 0;
}

/* Clearfix pour les messages avec float */
.chat-msg::after {
    content: "";
    display: table;
    clear: both;
}

@keyframes messageIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cm-msg-text {
    padding: 12px 45px 12px 15px;
    max-width: 75%;
    word-wrap: break-word;
    line-height: 1.5;
    position: relative;
    border-radius: 18px;
    font-size: 14px;
}

.chat-msg.user > .cm-msg-text {
    background: linear-gradient(228deg, var(--accent-color) 0%, var(--accent-secondary-color) 100%);
    color: white;
    float: left;
    margin-left: 5px;
    border-bottom-left-radius: 5px;
}

.chat-msg.self > .cm-msg-text {
    background: var(--divider-color);
    color: var(--text-color);
    float: right;
    margin-right: 5px;
    border-bottom-right-radius: 5px;
}

/* Bouton de lecture vocale par message */
.msg-speak-btn {
    position: absolute;
    right: 8px;
    bottom: 8px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 5px;
    transition: all 0.2s ease;
    opacity: 0.5;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.msg-speak-btn svg {
    width: 18px;
    height: 18px;
    fill: #ffffff;
}

.msg-speak-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.msg-speak-btn.speaking {
    opacity: 1;
    animation: pulse 1s infinite;
}

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

/* Zone de saisie */
.chat-input {
    position: absolute;
    bottom: 0;
    width: 100%;
    padding: 15px;
    background: var(--secondary-color);
    border-top: 1px solid var(--divider-color);
    display: flex;
    align-items: center;
}

#chat-input {
    flex: 1;
    border: 1px solid var(--divider-color);
    border-radius: 25px;
    padding: 12px 50px 12px 20px;
    outline: none;
    font-size: 14px;
    background: var(--secondary-color);
    color: var(--primary-color);
    transition: all 0.3s ease;
}

#chat-input:focus {
    border-color: var(--accent-secondary-color);
    box-shadow: 0 0 0 2px rgba(21, 57, 154, 0.1);
}

#chat-submit {
    position: absolute;
    right: 0px;
    width: 36px;
    bottom: 10%;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-secondary-color) 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

#chat-submit:disabled,
#chat-submit[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    background: #666;
}



#mic-button {
    position: absolute;
    right: 50px;
    width: 36px;
    bottom: 10%;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-secondary-color) 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

#chat-submit:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(169, 62, 23, 0.3);
}

#chat-submit img {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
}

/* Contrôles vocaux */
.voice-controls {
    display: flex;
    gap: 10px;
    margin-right: 15px;
}

.voice-controls svg {
    width: 24px;
    height: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.voice-controls svg:hover {
    transform: scale(1.1);
}

/* Responsive */
@media screen and (max-width: 768px) {
    .chat-box {
        width: 90vw;
        right: 5vw;
        bottom: 100px;
        height: 70vh;
    }
    
    #chat-circle {
        bottom: 20px;
        right: 20px;
    }
    
    .chat-logs {
        padding-bottom: 70px;
    }
}

/* Typing Indicator Animation */
.typing-indicator .cm-msg-text {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 15px;
    min-width: 60px;
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    background: #ffffff;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-indicator .dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator .dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}



