@charset "UTF-8";

/* ================================================
   CHATBOT ASSISTAIR - ESTILOS
   ================================================ */

.chatbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

.chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(14, 165, 233, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    transition: all 0.3s ease;
    position: relative;
}

.chatbot-button .material-icons {
    font-size: 28px;
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(14, 165, 233, 0.6);
}

.chatbot-button:hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chatbot-button::before {
    content: '¿Necesitas ayuda?';
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%) translateY(-4px) translateX(10px);
    background: linear-gradient(135deg, #0369A1 0%, #075985 100%);
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(3, 105, 161, 0.3);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.chatbot-button::after {
    content: '';
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%) translateY(-4px) translateX(10px);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 8px solid #075985;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.chatbot-button:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateY(-4px) translateX(0);
}

.chatbot-button.active {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

.chatbot-button.active::before {
    display: none;
}

.chatbot-button.active::after {
    display: none;
}

.chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chatbot-window.active {
    display: flex;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-header {
    background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.chatbot-header-avatar .material-icons {
    font-size: 24px;
    color: white;
}

.chatbot-header-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-header-info p {
    margin: 0;
    font-size: 12px;
    opacity: 0.9;
}

.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #F8FAFC;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #F1F5F9;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 3px;
}

.chatbot-message {
    display: flex;
    gap: 8px;
    animation: fadeIn 0.3s ease;
    width: 100%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message.bot {
    justify-content: flex-start;
}

.chatbot-message.bot > div:not(.chatbot-message-avatar) {
    align-items: flex-start;
}

.chatbot-message.user {
    justify-content: flex-end;
}

.chatbot-message.user > div {
    align-items: flex-end;
}

/* Wrapper de contenido (burbuja + hora) */
.chatbot-message > div:not(.chatbot-message-avatar) {
    max-width: 80%;
    display: flex;
    flex-direction: column;
}

.chatbot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

.chatbot-message-avatar .material-icons {
    font-size: 20px;
}

.chatbot-message-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
}

.chatbot-message.bot .chatbot-message-bubble {
    background: white;
    color: #1E293B;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chatbot-message.user .chatbot-message-bubble {
    background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chatbot-message-time {
    font-size: 11px;
    color: #94A3B8;
    margin-top: 4px;
    text-align: right;
}

.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 8px;
}

.chatbot-typing span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #94A3B8;
    animation: typing 1.4s infinite;
}

.chatbot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.chatbot-input-area {
    padding: 16px;
    background: white;
    border-top: 1px solid #E2E8F0;
    display: flex;
    gap: 8px;
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #E2E8F0;
    border-radius: 24px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.3s ease;
}

.chatbot-input:focus {
    border-color: #0EA5E9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.chatbot-send-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
}

.chatbot-send-button .material-icons {
    font-size: 20px;
}

.chatbot-send-button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.4);
}

.chatbot-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-welcome {
    text-align: center;
    padding: 20px;
}

.chatbot-welcome-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #0EA5E9 0%, #0284C7 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
}

.chatbot-welcome-icon .material-icons {
    font-size: 32px;
}

.chatbot-welcome h4 {
    margin: 0 0 8px;
    color: #1E293B;
    font-size: 18px;
}

.chatbot-welcome p {
    margin: 0;
    color: #64748B;
    font-size: 14px;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
    .chatbot-window {
        width: 380px;
        height: 600px;
        max-height: calc(100vh - 120px);
        right: 20px;
        bottom: 90px;
    }
}

@media (max-width: 480px) {
    .chatbot-widget {
        bottom: 15px;
        right: 15px;
        z-index: 10000;
    }

    .chatbot-button {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .chatbot-button .material-icons {
        font-size: 24px;
    }

    /* Ocultar tooltip en móvil */
    .chatbot-button::before,
    .chatbot-button::after {
        display: none !important;
    }

    /* Ventana full screen en móvil */
    .chatbot-window {
        position: fixed;
        top: 0;
        left: 0;
        width: 100% !important;
        height: 100% !important;
        height: 100dvh !important; /* Fix para barras de navegación móviles */
        border-radius: 0;
        bottom: 0 !important;
        right: 0 !important;
        z-index: 10001; /* Asegurar que esté sobre todo */
        display: none;
        flex-direction: column;
        overscroll-behavior: contain; /* Evita scroll del body detrás */
    }

    /* Evitar zoom automático en iOS al escribir (min 16px) */
    .chatbot-input {
        font-size: 16px !important; 
    }

    .chatbot-window.active {
        display: flex;
    }

    .chatbot-header {
        padding: 15px;
        padding-top: max(15px, env(safe-area-inset-top)); /* Safe area notch */
        padding-right: 60px; /* Espacio para botón cerrar */
    }

    .chatbot-messages {
        padding: 15px;
        padding-bottom: 20px;
    }
    
    .chatbot-input-area {
        padding: 10px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    /* Mover botón de cerrar arriba a la derecha cuando esté activo */
    .chatbot-button.active {
        position: fixed;
        top: 15px;
        right: 15px;
        bottom: auto;
        width: 40px;
        height: 40px;
        background: rgba(255, 255, 255, 0.2); /* Sutil sobre el header azul */
        box-shadow: none;
        z-index: 10002;
        border: 1px solid rgba(255,255,255,0.3);
    }

    .chatbot-button.active .material-icons {
        font-size: 20px;
    }
}
