:root {
    --primary-red: #d90f1e; 
    --text-dark: #1e293b;
    --bg-light: #f8fafc;
}

body { font-family: 'Segoe UI', Roboto, sans-serif; margin: 0; background: transparent; }

#delfos-bubble {
    position: fixed; bottom: 20px; right: 20px; width: 60px; height: 60px;
    background: var(--primary-red); border-radius: 50%; display: none;
    align-items: center; justify-content: center; color: white; font-size: 24px;
    cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.15); z-index: 9999;
    /* overflow: hidden; -- Eliminado para que las notificaciones no se recorten en media luna */
    transition: transform 0.2s ease-in-out; /* Animación burbuja */
}

#delfos-bubble:hover {
    transform: scale(1.1); /* Efecto agrandar al pasar el ratón */
}

#bubble-icon-container { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; }

#delfos-chat-window {
    position: fixed; bottom: 90px; right: 20px; width: 360px; height: 550px;
    background: white; border-radius: 12px; display: flex; flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); overflow: hidden; z-index: 9998;
    /* --- ANIMACIONES DE APERTURA --- */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

#delfos-chat-window.open { 
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

/* --- MODO MAXIMIZADO --- */
#delfos-chat-window.maximized {
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    max-width: 100vw !important;
    bottom: 0 !important;
    right: 0 !important;
    border-radius: 0 !important;
}

.chat-header {
    background: var(--primary-red); color: white; padding: 12px 15px;
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 600;
}

#header-icon-container { display: flex; justify-content: center; align-items: center; }

.header-actions button { background: none; border: none; color: white; cursor: pointer; font-size: 16px; margin-left: 8px; opacity: 0.8; }
.header-actions button:hover { opacity: 1; }

#welcome-options {
    flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 25px;
}

.profile-btn {
    width: 100%; padding: 14px; margin-bottom: 15px; border-radius: 8px; border: 1px solid #e2e8f0;
    background: white; color: #475569; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 10px; transition: 0.2s;
}

.btn-comercial { color: var(--primary-red); border-color: var(--primary-red); }
.btn-comercial:hover { background: var(--primary-red); color: white; }

.btn-tecnico { color: #64748b; border-color: #cbd5e1; }
.btn-tecnico:hover { background: #f1f5f9; color: #1e293b; border-color: #94a3b8; }

#chat-messages { flex: 1; padding: 15px; overflow-y: auto; background: var(--bg-light); display: flex; flex-direction: column; gap: 10px; position: relative; z-index: 1;}

.message { max-width: 85%; padding: 10px 14px; border-radius: 10px; font-size: 14px; line-height: 1.4; position: relative; z-index: 2; }
.message.bot { align-self: flex-start; background: white; border: 1px solid #e2e8f0; color: #333; }
.message.user { align-self: flex-end; background: var(--primary-red); color: white; }

/* === MAGIA DE LOS PUNTITOS RECUPERADA === */
.typing-indicator {
    display: none; align-self: flex-start; background: white; border: 1px solid #e2e8f0; 
    padding: 12px 15px; border-radius: 10px; gap: 5px; width: fit-content; 
    margin-bottom: 10px; position: relative; z-index: 2;
}
.typing-indicator.active { display: flex; }
.dot { width: 8px; height: 8px; background: #94a3b8; border-radius: 50%; animation: blink 1.4s infinite both; }
.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }
/* ======================================== */

#chat-input-container { padding: 12px; border-top: 1px solid #e2e8f0; display: flex; gap: 8px; background: white; position: relative; z-index: 2;}
#user-input { flex: 1; border: 1px solid #e2e8f0; padding: 10px 12px; border-radius: 6px; outline: none; }
#send-btn { background: var(--primary-red); color: white; border: none; padding: 10px 15px; border-radius: 6px; cursor: pointer; }
#mic-btn { background: transparent; color: #64748b; border: none; font-size: 18px; cursor: pointer; padding: 0 5px; }

/* === NOTIFICACIONES EN LA BURBUJA MINIMIZADA === */
.bubble-notification {
    position: absolute;
    top: -4px;
    left: -4px;
    background: white;
    color: var(--primary-red);
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    border: 1px solid #e2e8f0;
    z-index: 10000;
}

#bubble-unread i { font-size: 12px; }

#bubble-thinking { gap: 2px; }

.dot-small {
    width: 4px;
    height: 4px;
    background: var(--primary-red);
    border-radius: 50%;
    animation: blink 1.4s infinite both;
}
.dot-small:nth-child(1) { animation-delay: -0.32s; }
.dot-small:nth-child(2) { animation-delay: -0.16s; }
/* ============================================== */