/* ============================================
   CHATBOT FITRESERV IA — DISEÑO LIMPIO
   Paleta azul marino oscuro, minimalista y elegante
   ============================================ */

/* ============================================
   BOTÓN FLOTANTE
   ============================================ */
.chatbot-trigger {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background: #1e3a8a;
    border-radius: 50%;
    border: none;
    box-shadow:
        0 8px 24px rgba(30, 58, 138, 0.4),
        0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.chatbot-trigger:hover {
    background: #1e40af;
    transform: translateY(-3px);
    box-shadow:
        0 12px 32px rgba(30, 58, 138, 0.5),
        0 4px 10px rgba(0, 0, 0, 0.25);
}

.chatbot-trigger:active {
    transform: translateY(-1px);
}

.chatbot-trigger svg {
    width: 28px;
    height: 28px;
    color: white;
}

.chatbot-trigger::after {
    content: 'IA';
    position: absolute;
    top: -2px;
    right: -2px;
    background: #3b82f6;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: 10px;
    letter-spacing: 0.5px;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* ============================================
   VENTANA DEL CHAT
   ============================================ */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 380px;
    max-width: 92vw;
    height: 580px;
    max-height: 82vh;
    background: #0f1f4d;
    border-radius: 16px;
    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    opacity: 0;
    transform: scale(0.95) translateY(15px);
    pointer-events: none;
}

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

/* ============================================
   HEADER
   ============================================ */
.chat-header {
    background: #0a1747;
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bot-avatar {
    width: 40px;
    height: 40px;
    background: #1e3a8a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.bot-avatar svg {
    width: 22px;
    height: 22px;
    color: white;
}

.bot-avatar::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    background: #22c55e;
    border: 2px solid #0a1747;
    border-radius: 50%;
}

.bot-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.bot-name {
    color: #ffffff;
    font-weight: 600;
    font-size: 0.98rem;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.1px;
}

.bot-badge {
    background: #3b82f6;
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 4px;
    letter-spacing: 0.8px;
}

.bot-status {
    color: rgba(255, 255, 255, 0.65);
    font-size: 11.5px;
    font-weight: 400;
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #22c55e;
    border-radius: 50%;
}

.chat-header-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.close-chat {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-chat:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

/* ============================================
   ÁREA DE MENSAJES
   ============================================ */
.chat-messages {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #0f1f4d;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}
.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.92rem;
    line-height: 1.5;
    word-wrap: break-word;
    animation: msgIn 0.25s ease;
}

@keyframes msgIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.message.bot {
    background: #1a2d6e;
    color: #e8edff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.message.bot strong {
    color: #93c5fd;
    font-weight: 600;
}

.message.bot a {
    color: #93c5fd;
    text-decoration: underline;
}

.message.user {
    background: #3b82f6;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

/* ============================================
   ÁREA DE INPUT
   ============================================ */
.chat-input-area {
    padding: 14px 16px 16px;
    background: #0a1747;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-input-area p {
    color: rgba(255, 255, 255, 0.45);
    margin: 0 0 8px 0;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.chat-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chat-option-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cdd5e0;
    padding: 7px 12px;
    border-radius: 18px;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-option-btn:hover {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
}

/* ============================================
   FORMULARIO INPUT TEXTO
   ============================================ */
.chat-form {
    display: flex !important;
    gap: 8px !important;
    margin-top: 12px !important;
    align-items: center;
}

#chatInput {
    flex: 1;
    padding: 11px 16px !important;
    border-radius: 22px !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    background: rgba(255, 255, 255, 0.06) !important;
    color: #ffffff !important;
    outline: none !important;
    font-size: 14px !important;
    transition: border-color 0.2s, background 0.2s;
}

#chatInput::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#chatInput:focus {
    border-color: #3b82f6 !important;
    background: rgba(255, 255, 255, 0.1) !important;
}

#chatInput:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#chatSend {
    width: 40px;
    height: 40px;
    border-radius: 50% !important;
    background: #1e3a8a !important;
    color: white !important;
    border: none !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    padding: 0 !important;
    flex-shrink: 0;
}

#chatSend:hover:not(:disabled) {
    background: #1e40af !important;
    transform: scale(1.05);
}

#chatSend:active:not(:disabled) {
    transform: scale(0.95);
}

#chatSend:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   INDICADOR "ESCRIBIENDO..."
   ============================================ */
.message.bot em {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-style: normal;
    color: rgba(255, 255, 255, 0.6);
}

.message.bot em::after {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #93c5fd;
    box-shadow:
        9px 0 0 #93c5fd,
        18px 0 0 #93c5fd;
    animation: typingDots 1.3s infinite;
}

@keyframes typingDots {
    0%, 60%, 100% { opacity: 0.3; }
    30%           { opacity: 1; }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 90px;
        height: 75vh;
    }

    .chatbot-trigger {
        right: 15px;
        bottom: 15px;
        width: 56px;
        height: 56px;
    }
}
