/* Modale Glassmorphism (Thème Blanc) */
.webpy-glass-panel {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    max-width: 90vw;
    box-sizing: border-box;
    height: 550px;
    background: rgba(255, 255, 255, 0.90);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    z-index: 9999;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    transition: opacity 0.3s ease, transform 0.3s ease;
    overflow: hidden;
    color: #333;
}

.webpy-glass-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
}

/* En-tête */
.webpy-header {
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.webpy-header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}
#webpy-tts-toggle, #webpy-close {
    background: transparent;
    border: none;
    color: #555;
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}
#webpy-tts-toggle:hover, #webpy-close:hover { color: #000; }

/* Zone de discussion */
#webpy-chat-box {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Messages */
.webpy-msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}
.webpy-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #fff;
    border-bottom-right-radius: 2px;
}
.webpy-msg.model {
    align-self: flex-start;
    background: #f1f1f1;
    color: #333;
    border-bottom-left-radius: 2px;
}

/* Zone de saisie */
.webpy-input-area {
    padding: 15px;
    display: flex;
    gap: 10px;
    background: rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
#webpy-user-input {
    flex: 1;
    background: #f9f9f9;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 10px 15px;
    border-radius: 20px;
    color: #333;
    outline: none;
    transition: border 0.3s ease;
}
#webpy-user-input:focus { border-color: #4facfe; }
#webpy-send {
    background: #4facfe;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
}

/* Bouton Reset et Micro */
#webpy-reset-btn {
    width: 100%;
    background: transparent;
    color: #888;
    border: none;
    padding: 10px;
    font-size: 11px;
    text-transform: uppercase;
    cursor: pointer;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}
#webpy-reset-btn:hover { color: #ff4d4d; }

#webpy-mic {
    background: transparent;
    border: 1px solid rgba(0, 0, 0, 0.15);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #555;
    cursor: pointer;
}
#webpy-mic:hover { background: rgba(0, 0, 0, 0.05); }

/* Boutons En-tête (Audio & Close) */
.webpy-header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}
#webpy-tts-toggle {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    transition: opacity 0.2s;
    /* Suppression du carré bleu par défaut, icône native (🔊/🔇) conservée */
    opacity: 0.6; 
}
#webpy-tts-toggle:hover { opacity: 1; }
#webpy-tts-toggle.active { opacity: 1; }

#webpy-close {
    background: transparent;
    border: none;
    color: #555;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}
#webpy-close:hover { color: #000; }

/* Mini-Bulle (Notification rotative) */
#webpy-mini-bubble {
    position: fixed;
    bottom: 110px;
    right: 30px; /* Aligné avec l'orbe */
    max-width: 250px;
    background: #fff;
    color: #333;
    padding: 12px 18px;
    border-radius: 18px;
    border-bottom-right-radius: 4px; /* Flèche visuelle vers l'orbe */
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
    z-index: 9998;
    transition: opacity 0.4s ease, transform 0.4s ease;
    border: 1px solid rgba(0,0,0,0.05);
}
#webpy-mini-bubble.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(15px) scale(0.95);
}

/* Mobile Responsive */
@media (max-width: 680px) {
    .webpy-glass-panel { width: 90vw; right: 5vw; bottom: 90px; }
    .webpy-orb { right: 5vw; bottom: 20px; }
    #webpy-mini-bubble { right: 10vw; bottom: 90px; }
}

/* Déclencheur holographique (Orb) avec Icône */
.webpy-orb {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, #00f2fe, #4facfe);
    box-shadow: 0 0 20px rgba(79, 172, 254, 0.6), inset 0 0 10px rgba(255,255,255,0.8);
    cursor: pointer;
    z-index: 10000; /* Force le passage au-dessus de tout le site */
    animation: webpy-pulse 2.5s infinite;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
.webpy-orb.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0); /* Animation de rétractation */
}
.webpy-orb:hover {
    transform: scale(1.15);
}

@keyframes webpy-pulse {
    0% { box-shadow: 0 0 0 0 rgba(79, 172, 254, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(79, 172, 254, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 172, 254, 0); }
}