/* ============================================
   SEISA - Chatbot Styles
   Sistema de chat inteligente con Knowledge Base
   ============================================ */

/* Contenedor del chatbot */
#chatbot-container {
    position: fixed;
    bottom: 120px;
    right: 40px;
    z-index: 999;
    font-family: var(--font-secondary, 'Montserrat', sans-serif);
}

/* Botón flotante del chatbot */
.chatbot-toggle {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: var(--gradient-primary, linear-gradient(135deg, #1e3a8a, #0ea5e9));
    color: #fff;
    border: 4px solid #fff;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    transition: all 0.3s ease;
    position: relative;
    animation: pulse 2s infinite;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 4px 15px rgba(30, 58, 138, 0.3);
    }

    50% {
        box-shadow: 0 4px 25px rgba(30, 58, 138, 0.6);
    }
}

.notification-dot {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ef4444;
    border: 2px solid #fff;
    animation: notif-pulse 1.5s infinite;
}

@keyframes notif-pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

/* Ventana del chatbot */
.chatbot-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 580px;
    max-height: 85vh;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    z-index: 1000;
}

.chatbot-window.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header del chatbot */
.chatbot-header {
    background: linear-gradient(135deg, #1e3a8a, #0369a1);
    color: #fff;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chatbot-header .header-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.chatbot-header .header-info strong {
    font-size: 1rem;
    font-weight: 700;
}

.chatbot-header .header-info span {
    font-size: 0.75rem;
    opacity: 0.85;
}

.chatbot-header .header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.chatbot-header .header-actions button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.chatbot-header .header-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.close-chat:hover {
    transform: rotate(90deg) scale(1.1) !important;
}

/* Área de mensajes */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Scroll personalizado */
.chatbot-messages::-webkit-scrollbar {
    width: 5px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Mensajes */
.message {
    display: flex;
    flex-direction: column;
    animation: fadeInMsg 0.3s ease;
    max-width: 100%;
}

@keyframes fadeInMsg {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-items: flex-end;
}

.message.bot {
    align-items: flex-start;
}

/* Burbujas de mensaje */
.message .bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    line-height: 1.55;
    font-size: 0.9rem;
    word-wrap: break-word;
}

.message.bot .bubble {
    background: #fff;
    color: #334155;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    border-bottom-left-radius: 4px;
    border: 1px solid #e2e8f0;
}

.message.user .bubble {
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* Opciones clickeables */
.options-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
    max-width: 85%;
}

.chat-option {
    background: #fff;
    border: 1.5px solid #1e3a8a;
    color: #1e3a8a;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-family: inherit;
}

.chat-option:hover {
    background: #1e3a8a;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(30, 58, 138, 0.3);
}

.chat-option:active {
    transform: scale(0.97);
}

/* Indicador de escritura */
.typing-indicator .bubble {
    display: flex;
    gap: 4px;
    padding: 0.75rem 1.25rem;
    align-items: center;
}

.typing-indicator .bubble span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94a3b8;
    display: inline-block;
    animation: typingBounce 1.4s infinite;
}

.typing-indicator .bubble span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator .bubble span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

/* Input del chatbot */
.chatbot-input {
    padding: 0.75rem 1rem;
    background: #fff;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.chatbot-input input {
    flex: 1;
    padding: 0.7rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 25px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    font-family: inherit;
    outline: none;
    background: #f8fafc;
}

.chatbot-input input:focus {
    border-color: #1e3a8a;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.1);
}

.chatbot-input input::placeholder {
    color: #94a3b8;
    font-size: 0.85rem;
}

#send-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

#send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 10px rgba(30, 58, 138, 0.4);
}

#send-btn:active {
    transform: scale(0.95);
}

/* Contact success message */
.contact-success {
    background: linear-gradient(135deg, #ecfdf5, #d1fae5);
    border: 1px solid #6ee7b7;
    border-radius: 12px;
    padding: 1rem;
    color: #065f46;
}

/* Strong text in bot messages */
.message.bot .bubble strong {
    color: #1e3a8a;
}

/* Responsive */
@media (max-width: 480px) {
    #chatbot-container {
        right: 15px;
        bottom: 80px;
    }

    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        max-height: none;
        right: 10px;
        bottom: 10px;
        border-radius: 16px;
    }

    .chatbot-toggle {
        width: 60px;
        height: 60px;
        font-size: 1.8rem;
    }

    .message .bubble {
        max-width: 90%;
        font-size: 0.85rem;
    }

    .options-grid {
        max-width: 90%;
    }

    .chat-option {
        font-size: 0.75rem;
        padding: 0.35rem 0.6rem;
    }
}

@media (max-width: 360px) {
    .chatbot-window {
        width: calc(100vw - 10px);
        right: 5px;
    }
}