/* =========================================================
   ESTILOS CHATBOT MLIA 5.3 (MOBILE FIX)
   ========================================================= */

/* --- 1. CONTENEDOR MAESTRO --- */
#oac-plugin-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 2147483647; display: none;
    
    /* ESCRITORIO: Chat a la izquierda */
    justify-content: flex-start; 
    align-items: flex-end; 
    padding-left: 5vw; padding-bottom: 30px; 
    
    pointer-events: none; font-family: 'Segoe UI', Roboto, sans-serif;
}
#oac-plugin-wrapper.oac-active { display: flex !important; }

/* --- 2. MENÚ SUPERIOR (SOLO ESCRITORIO) --- */
#oac-internal-nav {
    position: fixed; top: 60px; right: 50px;
    display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 20px;
    max-width: 60vw; z-index: 2147483650; pointer-events: auto;
    padding: 10px 20px;
}

/* ENLACES */
.oac-nav-link {
    text-decoration: none; letter-spacing: 1px; transition: all 0.3s;
    text-shadow: 0 0 10px rgba(255,255,255,0.5); border-bottom: 2px solid transparent;
}
.oac-nav-link:hover { opacity: 0.8; border-bottom-color: currentColor; }

/* --- 3. CAJA CHAT --- */
#oac-main-container {
    width: 700px; max-width: 85vw; height: 85vh; max-height: 820px;
    z-index: 10; pointer-events: auto; background: #fff; border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; overflow: hidden;
    animation: slideUpBox 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes slideUpBox { from { transform: translateY(50px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* --- 4. LOGO DOCTOR (SOLO ESCRITORIO) --- */
#oac-doctor-logo {
    position: absolute; top: 200px; left: 800px; 
    width: 300px; height: auto; z-index: 20; display: none;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3)); pointer-events: auto;
}
#oac-plugin-wrapper.oac-active #oac-doctor-logo { display: block; animation: fadeInLogo 1s 0.3s both; }
@keyframes fadeInLogo { from{opacity:0;transform:translateX(-30px);} to{opacity:1;transform:translateX(0);} }

/* FONDO */
#oac-bg-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; background: #000; pointer-events: auto; }
#oac-bg-layer video { width: 100%; height: 100%; object-fit: cover; opacity: 0.6; }
.oac-bg-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); }

/* INTERNOS */
#oac-chat-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 30px; background: #fff; flex-shrink: 0; }
.oac-header-title { font-weight: 800; color: #0b7dda; font-size: 15px; }
#oac-close-button { width: 40px; height: 40px; background: black; border-radius: 50%; /*display: flex; align-items: center; justify-content: center;*/ cursor: pointer; font-size: 30px; color: #fff; transition: all 0.2s; border: 1px solid #e1e4e8; font-weight: bold; text-align: center; line-height:1;}
#oac-close-button:hover { background: #ff4d4f; color: #fff; border-color: #ff4d4f; transform: rotate(90deg); }
#oac-messages-container { flex: 1; overflow-y: auto; padding: 30px; background: #f8f9fa; scroll-behavior: smooth; }
#oac-input-container { padding: 20px 30px; background: #fff; border-top: 1px solid #eee; display: flex; align-items: center; gap: 15px; flex-shrink: 0; }
#openai-chatbot-input { flex: 1; border: 2px solid #e9ecef; border-radius: 50px; padding: 14px 25px; font-size: 16px; outline: none; color: #333; transition: border-color 0.3s; background: #f8f9fa; height:50px }
#openai-chatbot-input:focus { border-color: #0b7dda; background: #fff; }
#openai-chatbot-send { width: 50px; height: 50px; background: #0b7dda; color: #fff; border: none; border-radius: 50%; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; transition: transform 0.2s; }
#oac-triggers-container { display: none; padding: 0 30px 20px; background: #f8f9fa; flex-shrink: 0; flex-wrap: wrap; gap: 10px; }
.openai-chatbot-trigger-bubble { display: inline-block; background: #fff; padding: 10px 20px; border-radius: 25px; border: 1px solid #e0e0e0; cursor: pointer; color: #0b7dda; font-size: 14px; font-weight: 700; transition: all 0.2s; }
.chat-message { max-width: 85%; padding: 16px 22px; border-radius: 22px; font-size: 18px; line-height: 1.5; margin-bottom: 20px; position: relative; }
.chat-message.user { background: #0b7dda; color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.chat-message.bot { background: #fff; color: #444; border: 1px solid #e9ecef; margin-right: auto; border-bottom-left-radius: 4px; margin-left: 45px; }
.chat-message.bot::before { content: '✨'; position: absolute; left: -45px; bottom: 5px; width: 36px; height: 36px; background: #fff; border: 2px solid #f0f0f0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.chat-message.bot.typing-indicator span { display: block; width: 8px; height: 8px; background-color: #0b7dda; border-radius: 50%; animation: typingBounce 1.4s infinite ease-in-out both; margin: 0 2px; }
.chat-message.bot.typing-indicator { display: flex; width: fit-content; padding: 15px 25px; }
@keyframes typingBounce { 0%, 80%, 100% { transform: scale(0); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }
@keyframes mliaInputPulse { 0% { transform: scale(1); box-shadow: 0 10px 30px rgba(0,0,0,0.1); } 50% { transform: scale(1.02); box-shadow: 0 15px 40px rgba(11, 125, 218, 0.25); } 100% { transform: scale(1); box-shadow: 0 10px 30px rgba(0,0,0,0.1); } }
.mlia-static-input-wrapper { position: relative; width: 100%; max-width: 600px; margin: 20px auto; cursor: pointer; animation: mliaInputPulse 3s infinite ease-in-out; }
.mlia-static-input-wrapper:hover { animation-play-state: paused; transform: scale(1.03); }
.mlia-fake-input { width: 100%; padding: 18px 60px 18px 30px; border-radius: 60px !important; border: 3px solid #fff; background: rgba(255,255,255,0.92); font-size: 17px; font-weight: 600; color: #555; outline: none; box-shadow: 0 10px 30px rgba(0,0,0,0.1); cursor: pointer; text-align: left; height: 50px !important}
.mlia-search-icon { position: absolute; right: 25px; top: 50%; transform: translateY(-50%); color: #0b7dda; font-size: 24px; }
#mlia-popup-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999999999; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
#mlia-popup-card { background: #fff; padding: 30px; width: 350px; max-width: 90%; border: 3px double #333; box-shadow: 10px 10px 0px rgba(0,0,0,0.2); font-family: 'Courier New', monospace; animation: popupEnter 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes popupEnter { from { transform: scale(0.8) translateY(20px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }
.mlia-popup-lines { border-left: 2px solid #333; border-right: 2px solid #333; padding: 0 15px; margin-bottom: 20px; }
.mlia-popup-lines p { margin: 5px 0; color: #333; font-size: 16px; line-height: 1.4; font-weight: 600; }
#mlia-popup-btn { display: block; width: 100%; padding: 12px; background: transparent; border: 2px solid #333; font-weight: bold; text-transform: uppercase; cursor: pointer; transition: all 0.2s; }
#mlia-popup-btn:hover { background: #333; color: #fff; }
body.oac-body-lock { overflow: hidden !important; }
.mlia-static-btn { display: inline-block; padding: 12px 25px; border-radius: 50px; font-weight: 700; text-transform: uppercase; font-size: 14px; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; border: none; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.mlia-static-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
.mlia-btn-primary { background: #0b7dda; color: #fff; }

/* =========================================================
   REGLAS PARA MÓVIL (PANTALLAS < 768px)
   ========================================================= */
@media (max-width: 768px) {
    /* 1. OCULTAR MENÚ Y LOGO */
    #oac-internal-nav, 
    #oac-doctor-logo { 
        display: none !important; 
    }

    /* 2. CHAT A PANTALLA COMPLETA */
    #oac-plugin-wrapper {
        padding: 0 !important;
        justify-content: center !important;
        align-items: flex-end !important;
    }

    #oac-main-container {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important; /* Llenar todo el alto */
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    /* 3. AJUSTE DE ÁREA SEGURA (IPHONE BAR) */
    #oac-plugin-wrapper.oac-active #oac-input-container {
        padding-bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    }
}