/* Modals */
.agent-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.agent-modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: #FFFFFF;
    width: 90%;
    max-width: 500px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.agent-modal.active .modal-content {
    transform: translateY(0);
}

.chat-header {
    background: #00A3E0;
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-body {
    height: 300px;
    padding: 1.5rem;
    background: #F3F4F6;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    max-width: 80%;
    font-size: 0.9rem;
}

.message.bot {
    background: white;
    color: #111827;
    border: 1px solid #E5E7EB;
    align-self: flex-start;
    border-top-left-radius: 2px;
}

.message.user {
    background: #00A3E0;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 0.5rem;
    background: white;
}

.chat-input input {
    flex: 1;
    padding: 0.8rem;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    outline: none;
    background: #F9FAFB;
    color: #111827;
}

.chat-input button {
    background: #00A3E0;
    color: white;
    border: none;
    padding: 0 1.2rem;
    border-radius: 8px;
    cursor: pointer;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Admin Modal */
.admin-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.admin-modal.active {
    display: flex;
}

.admin-modal-content {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 20px;
    padding: 2.5rem;
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

.close-admin-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: #6B7280;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-admin-modal:hover {
    color: #00A3E0;
}

.admin-login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.admin-login-header i {
    font-size: 3rem;
    color: #00A3E0;
    margin-bottom: 1rem;
    display: block;
}

.admin-login-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0;
    color: #111827;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #6B7280;
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.9rem 1rem;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    color: #111827;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #00A3E0;
}

.btn-admin-login {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, #00A3E0, #0077A3);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-admin-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(0, 163, 224, 0.4);
}

.admin-hint {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: #6B7280;
}

/* =====================================================
   CHATBOT ENHANCEMENTS v2.0
   ===================================================== */

/* Extended chat body for better readability */
.chat-body {
    height: 400px;
}

/* Rich text support in bot messages */
.message.bot strong {
    font-weight: 700;
    color: #0077A3;
}

.message.bot em {
    font-style: italic;
    color: #6B7280;
    font-size: 0.8rem;
}

.message.bot hr {
    border: none;
    border-top: 1px solid rgba(0, 163, 224, 0.2);
    margin: 8px 0;
}

/* Typing indicator */
.typing-indicator {
    display: flex !important;
    align-items: center;
    gap: 4px;
    padding: 12px 20px !important;
    min-width: 60px;
}

.typing-indicator .dot {
    width: 8px;
    height: 8px;
    background: #00A3E0;
    border-radius: 50%;
    animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-indicator .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    50% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Dark mode for chat */
.dark .modal-content {
    background: #1e293b;
}

.dark .chat-body {
    background: #0f172a;
}

.dark .message.bot {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #334155;
}

.dark .message.bot strong {
    color: #7DD3FC;
}

.dark .chat-input {
    background: #1e293b;
    border-color: #334155;
}

.dark .chat-input input {
    background: #0f172a;
    color: #f1f5f9;
    border-color: #334155;
}

/* Dark mode for admin modal */
.dark .admin-modal-content {
    background: #1e293b;
    border-color: #334155;
}

.dark .admin-login-header h2 {
    color: #f1f5f9;
}

.dark .form-group input {
    background: #0f172a;
    color: #f1f5f9;
    border-color: #334155;
}

/* Floating button pulse */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.3);
        opacity: 0.5;
    }
}

/* FIX: Mobile Menu Fixed Position */
@media (max-width: 1024px) {
    /* Header is already fixed via Tailwind, DO NOT touch it. */

    #mobileMenu {
        position: fixed !important;
        top: 72px;
        /* Pusimos 'pt-[72px]' en el body, así que el header mide aprox eso */
        left: 0;
        width: 100%;
        z-index: 40;
        /* Debajo del header (z-50) */
        background: white;
        border-bottom: 1px solid #e5e7eb;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
        max-height: calc(100vh - 72px);
        overflow-y: auto;
    }

    /* Dark mode support for the menu bg */
    .dark #mobileMenu {
        background: #101922;
        /* match background-dark */
        border-color: #1f2937;
    }
}