/* Chatbot Floating Action Button */
.chatbot-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: var(--ubuntu-orange-light);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 10000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chatbot-fab:hover {
    transform: scale(1.1);
}

.chatbot-fab i {
    font-size: 24px;
}

/* Chatbot Window */
.chatbot-window {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px;
    height: 500px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    z-index: 10000;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s ease;
    overflow: hidden;
}

.chatbot-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chatbot-header {
    background-color: var(--ubuntu-orange);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.chatbot-title {
    font-weight: 600;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.chatbot-close:hover {
    opacity: 1;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.4;
    animation: fadeIn 0.3s ease;
}

.chat-message.bot {
    background-color: white;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.chat-message.user {
    background-color: var(--ubuntu-orange-light);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

/* Options / Questions List */
.chatbot-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.chat-option-btn {
    background-color: white;
    border: 1px solid var(--ubuntu-orange-light);
    color: var(--ubuntu-orange-light);
    padding: 8px 12px;
    border-radius: 20px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.chat-option-btn:hover {
    background-color: var(--ubuntu-orange-light);
    color: white;
}

/* Input Area (Optional, mostly for future search) */
.chatbot-input-area {
    padding: 10px;
    border-top: 1px solid #eee;
    background-color: white;
}

.chatbot-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: var(--ubuntu-orange-light);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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

/* ========== VERSIÓN RESPONSIVE MEJORADA ========== */
@media (max-width: 768px) {
    /* FAB más pequeño en móvil */
    .chatbot-fab {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }

    .chatbot-fab i {
        font-size: 20px;
    }

    /* Window ocupa casi toda la pantalla en móvil */
    .chatbot-window {
        width: calc(100% - 30px) !important; /* Ancho completo con márgenes */
        height: calc(100% - 100px) !important; /* Alto casi completo */
        bottom: 75px;
        right: 15px;
        left: 15px; /* Para centrar */
        max-width: 400px; /* Límite para tablets pequeñas */
        margin: 0 auto; /* Centrado */
    }

    /* Header más compacto */
    .chatbot-header {
        padding: 12px;
    }

    .chatbot-title {
        font-size: 1rem;
    }

    .chatbot-title i {
        font-size: 1.1rem;
    }

    .chatbot-close {
        font-size: 1.1rem;
    }

    /* Messages con padding reducido */
    .chatbot-messages {
        padding: 12px;
    }

    /* Mensajes más compactos */
    .chat-message {
        max-width: 90%;
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    /* Opciones más táctiles */
    .chat-option-btn {
        padding: 12px 15px; /* Más grande para fácil toque */
        font-size: 0.95rem;
        border-radius: 25px;
    }

    /* Input area más compacto */
    .chatbot-input-area {
        padding: 8px;
    }

    .chatbot-input {
        padding: 10px 15px;
        font-size: 0.95rem;
    }
}

/* Ajustes para pantallas muy pequeñas */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100% - 20px) !important;
        height: calc(100% - 90px) !important;
        bottom: 70px;
        right: 10px;
        left: 10px;
    }

    .chatbot-fab {
        width: 45px;
        height: 45px;
        bottom: 10px;
        right: 10px;
    }

    .chatbot-fab i {
        font-size: 18px;
    }

    .chatbot-header {
        padding: 10px;
    }

    .chatbot-title {
        font-size: 0.95rem;
        gap: 5px;
    }

    .chat-message {
        max-width: 95%;
        padding: 7px 10px;
        font-size: 0.85rem;
    }
}

/* Ajuste para dispositivos con notch o áreas seguras */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        .chatbot-fab {
            bottom: max(15px, env(safe-area-inset-bottom));
            right: max(15px, env(safe-area-inset-right));
        }

        .chatbot-window {
            bottom: max(75px, calc(env(safe-area-inset-bottom) + 60px));
            right: max(15px, env(safe-area-inset-right));
            left: max(15px, env(safe-area-inset-left));
        }
    }
}