/* Estilos del Chatbot - VERSIÓN MEJORADA */
.chatbot-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #0ea5e9 0%, #1d4ed8 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(14, 165, 233, 0.4);
    z-index: 10000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 3px solid white;
}

.chatbot-button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 30px rgba(14, 165, 233, 0.6);
    background: linear-gradient(135deg, #1d4ed8 0%, #0ea5e9 100%);
}

.chatbot-button__pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #3b82f6;
    animation: pulse-ring 2s infinite;
    z-index: -1;
    opacity: 0.6;
}

@keyframes pulse-ring {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    70% {
        transform: scale(1.3);
        opacity: 0;
    }
    100% {
        transform: scale(0.8);
        opacity: 0;
    }
}

/* Ventana del chatbot */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-width: 90vw;
    height: 550px;
    max-height: 70vh;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    z-index: 10001;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.chatbot-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.chatbot-header {
    background: linear-gradient(135deg, #0ea5e9 0%, #1d4ed8 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-header h3 i {
    font-size: 18px;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

/* Personalización de scrollbar */
.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    font-size: 14px;
    position: relative;
    animation: messageAppear 0.3s ease-out;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
    color: white;
    border-bottom-right-radius: 5px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.message.bot {
    align-self: flex-start;
    background: white;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Tipos especiales de mensajes */
.message.bot.diagnostico {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-left: 4px solid #0ea5e9;
    border-radius: 15px;
    margin: 8px 0;
}

.message.bot.emergencia {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-left: 4px solid #ef4444;
    animation: pulse-emergency 1.5s infinite;
    border-radius: 15px;
    margin: 8px 0;
}

.message.bot.presupuesto {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left: 4px solid #22c55e;
    border-radius: 15px;
    margin: 8px 0;
}

@keyframes pulse-emergency {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Indicador de "escribiendo" */
.message.bot.typing {
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px dashed #cbd5e1;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #64748b;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out both;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.6; }
    40% { transform: scale(1); opacity: 1; }
}

.typing-text {
    color: #64748b;
    font-size: 13px;
    font-style: italic;
}

/* Botones rápidos */
.chatbot-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 16px;
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
}

.quick-action-btn {
    background: white;
    border: 1px solid #3b82f6;
    color: #3b82f6;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    font-weight: 500;
}

.quick-action-btn:hover {
    background: #3b82f6;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Input del chatbot */
.chatbot-input {
    padding: 16px;
    border-top: 1px solid #e2e8f0;
    background: white;
    display: flex;
    gap: 10px;
    align-items: center;
}

.chatbot-input input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #cbd5e1;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: #f8fafc;
}

.chatbot-input input:focus {
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.chatbot-input button {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-input button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
    background: linear-gradient(135deg, #3b82f6 0%, #0ea5e9 100%);
}

.chatbot-input button:active {
    transform: scale(0.95);
}

/* Mejoras en el texto */
.message strong {
    color: #1e293b;
    font-weight: 600;
}

.message em {
    color: #64748b;
    font-style: italic;
}

.emoji-number {
    display: inline-block;
    margin-right: 5px;
}

/* Indicador de paso */
.diagnostico-step {
    display: inline-block;
    background: #0ea5e9;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Opciones de respuesta */
.respuesta-opciones {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.opcion-btn {
    background: #e0f2fe;
    border: 1px solid #0ea5e9;
    color: #0369a1;
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.opcion-btn:hover {
    background: #0ea5e9;
    color: white;
    transform: translateY(-1px);
}

/* Responsive */
@media (max-width: 768px) {
    .chatbot-button {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
    
    .chatbot-window {
        bottom: 85px;
        right: 20px;
        width: calc(100vw - 40px);
        max-width: none;
        height: 450px;
        border-radius: 16px;
    }
    
    .chatbot-quick-actions {
        justify-content: center;
        padding: 12px;
    }
    
    .quick-action-btn {
        font-size: 12px;
        padding: 7px 12px;
    }
    
    .message {
        max-width: 90%;
        font-size: 13.5px;
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    .chatbot-button {
        bottom: 15px;
        right: 15px;
        width: 52px;
        height: 52px;
        font-size: 20px;
    }
    
    .chatbot-window {
        bottom: 75px;
        right: 10px;
        width: calc(100vw - 20px);
        height: 400px;
    }
    
    .quick-action-btn {
        font-size: 11px;
        padding: 6px 10px;
    }
    
    .chatbot-input {
        padding: 12px;
    }
    
    .chatbot-input input {
        padding: 10px 16px;
        font-size: 13.5px;
    }
    
    .chatbot-input button {
        width: 44px;
        height: 44px;
    }
}

/* Estado inactivo del chatbot */
.chatbot-window:not(.active) {
    display: none;
}

