/* ============================================================
   CHATBOX - REYES IT
   Estilos para el chat flotante
   ============================================================ */

/* ---------- BOTÓN FLOTANTE ---------- */
.chatbot-toggle {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1f5ebb, #2e7fd6);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    box-shadow: 0 8px 30px rgba(31, 94, 187, 0.4);
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-toggle:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 12px 45px rgba(31, 94, 187, 0.5);
}

.chatbot-toggle .icon-close {
    display: none;
}

.chatbot-toggle.active .icon-close {
    display: block;
}

.chatbot-toggle.active .icon-chat {
    display: none;
}

/* ---------- NOTIFICACIÓN ---------- */
.chatbot-notification {
    position: fixed;
    bottom: 100px;
    right: 30px;
    background: white;
    padding: 12px 20px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    font-size: 0.9rem;
    color: #1a1a2e;
    z-index: 9998;
    max-width: 260px;
    border: 1px solid rgba(31, 94, 187, 0.1);
    animation: chatNotification 1s ease forwards;
    display: none;
}

.chatbot-notification.show {
    display: block;
}

.chatbot-notification::after {
    content: '';
    position: absolute;
    bottom: -12px;
    right: 24px;
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid white;
}

.chatbot-notification .dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    background: #28a745;
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.5; }
}

@keyframes chatNotification {
    0% { opacity: 0; transform: translateY(20px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- VENTANA DEL CHAT ---------- */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 380px;
    max-width: calc(100vw - 60px);
    height: 520px;
    background: white;
    border-radius: 24px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.15);
    z-index: 9997;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(31, 94, 187, 0.08);
    animation: chatOpen 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chatbot-window.open {
    display: flex;
}

@keyframes chatOpen {
    0% { opacity: 0; transform: translateY(30px) scale(0.9); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- HEADER ---------- */
.chatbot-header {
    background: linear-gradient(135deg, #1f5ebb, #2e7fd6);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
}

.chatbot-header-info h4 {
    color: white;
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
}

.chatbot-header-info p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.75rem;
    margin: 0;
}

.chatbot-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ---------- MENSAJES ---------- */
.chatbot-messages {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
    background: #f8faff;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}
.chatbot-messages::-webkit-scrollbar-track {
    background: #f0f4ff;
}
.chatbot-messages::-webkit-scrollbar-thumb {
    background: #1f5ebb;
    border-radius: 4px;
}

.chatbot-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    animation: messageIn 0.3s ease forwards;
    word-wrap: break-word;
}

@keyframes messageIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

.chatbot-message.bot {
    background: white;
    color: #1a1a2e;
    align-self: flex-start;
    border: 1px solid #f0f4ff;
    border-bottom-left-radius: 4px;
}

.chatbot-message.bot .typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.chatbot-message.bot .typing-indicator span {
    width: 8px;
    height: 8px;
    background: #1f5ebb;
    border-radius: 50%;
    animation: typing 1.2s ease-in-out infinite;
}

.chatbot-message.bot .typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}
.chatbot-message.bot .typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-8px); opacity: 1; }
}

.chatbot-message.user {
    background: linear-gradient(135deg, #1f5ebb, #2e7fd6);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chatbot-message .message-time {
    font-size: 0.65rem;
    color: #8888a8;
    margin-top: 4px;
    display: block;
}

.chatbot-message.user .message-time {
    color: rgba(255, 255, 255, 0.6);
}

/* ---------- FOOTER ---------- */
.chatbot-footer {
    padding: 12px 16px 16px;
    background: white;
    border-top: 1px solid #f0f4ff;
    flex-shrink: 0;
    display: flex;
    gap: 10px;
}

.chatbot-footer input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e8ecf0;
    border-radius: 12px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    background: #f8faff;
}

.chatbot-footer input:focus {
    outline: none;
    border-color: #1f5ebb;
    box-shadow: 0 0 0 4px rgba(31, 94, 187, 0.08);
}

.chatbot-footer input::placeholder {
    color: #b0b0c8;
}

.chatbot-footer button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #1f5ebb, #2e7fd6);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
}

.chatbot-footer button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(31, 94, 187, 0.3);
}

.chatbot-footer button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ---------- PREGUNTAS RÁPIDAS ---------- */
.chatbot-quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0 4px;
    justify-content: center;
}

.chatbot-quick-questions button {
    background: #f0f4ff;
    border: 1px solid #e0e8f0;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-family: 'Inter', sans-serif;
    color: #1a1a2e;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chatbot-quick-questions button:hover {
    background: #1f5ebb;
    color: white;
    border-color: #1f5ebb;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(31, 94, 187, 0.2);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 576px) {
    .chatbot-window {
        bottom: 80px;
        right: 10px;
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        height: 70vh;
        border-radius: 16px;
    }
    .chatbot-toggle {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
    .chatbot-notification {
        bottom: 85px;
        right: 20px;
        max-width: 200px;
        font-size: 0.8rem;
        padding: 10px 16px;
    }
}