/* Esther Avatar - Frontend CSS */

#esther-container {
    max-width: 350px;
    margin: 20px auto;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-align: center;
}

/* Avatar */
#esther-avatar {
    position: relative;
    width: 300px;
    height: 400px;
    margin: 0 auto 20px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.3s ease;
}

#esther-avatar:hover {
    transform: scale(1.02);
}

#esther-avatar video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 15px;
}

/* Overlay de bienvenue */
.esther-overlay {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    backdrop-filter: blur(10px);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Loader */
#esther-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Contrôles */
#esther-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.esther-btn {
    background: linear-gradient(45deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79,172,254,0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.esther-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79,172,254,0.4);
}

.esther-btn:active {
    transform: translateY(0);
}

/* Bouton micro */
.esther-mic-btn {
    background: linear-gradient(45deg, #ff6b6b 0%, #ee5a24 100%);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255,107,107,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.esther-mic-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255,107,107,0.4);
}

.esther-mic-btn.listening {
    background: linear-gradient(45deg, #00b894 0%, #00a085 100%);
    animation: pulse-mic 1s infinite;
}

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

/* Bouton stop */
.esther-stop-btn {
    background: linear-gradient(45deg, #e17055 0%, #d63031 100%);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(225,112,85,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.esther-stop-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(225,112,85,0.4);
}

/* Toggle chat */
#esther-chat-toggle {
    margin-bottom: 15px;
}

#toggle-chat {
    background: none;
    border: none;
    color: #636e72;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 20px;
    transition: all 0.3s ease;
}

#toggle-chat:hover {
    background: rgba(99,110,114,0.1);
    color: #2d3436;
}

/* Chat */
#esther-chat {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: left;
}

#esther-messages {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 10px;
}

#esther-messages::-webkit-scrollbar {
    width: 6px;
}

#esther-messages::-webkit-scrollbar-track {
    background: #f1f3f4;
    border-radius: 10px;
}

#esther-messages::-webkit-scrollbar-thumb {
    background: #c1c8cd;
    border-radius: 10px;
}

#esther-messages::-webkit-scrollbar-thumb:hover {
    background: #a4acb3;
}

.esther-message {
    margin-bottom: 12px;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 80%;
    word-wrap: break-word;
    font-size: 14px;
    line-height: 1.4;
    animation: fadeInUp 0.3s ease;
}

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

.user-message {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.bot-message {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #2d3436;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border: 1px solid #dee2e6;
}

/* Input chat */
.esther-input-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

#esther-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

#esther-input:focus {
    border-color: #4facfe;
    background: white;
    box-shadow: 0 0 0 3px rgba(79,172,254,0.1);
}

#esther-send {
    background: linear-gradient(45deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79,172,254,0.3);
}

#esther-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79,172,254,0.4);
}

/* Formulaire rendez-vous */
#esther-appointment-form {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    text-align: left;
}

#esther-appointment-form h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2d3436;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}

#esther-appointment-form input,
#esther-appointment-form textarea {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #f8f9fa;
    box-sizing: border-box;
}

#esther-appointment-form input:focus,
#esther-appointment-form textarea:focus {
    outline: none;
    border-color: #4facfe;
    background: white;
    box-shadow: 0 0 0 3px rgba(79,172,254,0.1);
}

#esther-appointment-form textarea {
    resize: vertical;
    min-height: 80px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

.form-actions button {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-actions button[type="submit"] {
    background: linear-gradient(45deg, #00b894 0%, #00a085 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(0,184,148,0.3);
}

.form-actions button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,184,148,0.4);
}

#cancel-appointment {
    background: linear-gradient(45deg, #636e72 0%, #2d3436 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99,110,114,0.3);
}

#cancel-appointment:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99,110,114,0.4);
}

/* Responsive */
@media (max-width: 480px) {
    #esther-container {
        max-width: 100%;
        margin: 10px;
        padding: 15px;
    }
    
    #esther-avatar {
        width: 100%;
        max-width: 280px;
        height: 350px;
    }
    
    #esther-controls {
        gap: 8px;
    }
    
    .esther-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
    
    .esther-mic-btn,
    .esther-stop-btn {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }
    
    .esther-message {
        max-width: 90%;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions button {
        width: 100%;
    }
}

@media (max-width: 320px) {
    #esther-avatar {
        height: 300px;
    }
    
    #esther-controls {
        flex-direction: column;
        gap: 10px;
    }
    
    .esther-btn {
        width: 100%;
        max-width: 200px;
    }
}

/* Animations d'entrée */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#esther-container {
    animation: slideInUp 0.6s ease-out;
}

/* États actifs */
.esther-btn.active {
    background: linear-gradient(45deg, #00b894 0%, #00a085 100%);
    box-shadow: 0 6px 20px rgba(0,184,148,0.4);
}

/* Améliorations visuelles */
.esther-btn,
.esther-mic-btn,
.esther-stop-btn,
#esther-send {
    position: relative;
    overflow: hidden;
}

.esther-btn::before,
.esther-mic-btn::before,
.esther-stop-btn::before,
#esther-send::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    transition: all 0.3s ease;
    transform: translate(-50%, -50%);
}

.esther-btn:active::before,
.esther-mic-btn:active::before,
.esther-stop-btn:active::before,
#esther-send:active::before {
    width: 100px;
    height: 100px;
}