/* ============================================================
   CHATBOT SELVA VIVA PARK — Solo visible en desktop
   ============================================================ */

/* Ocultar completamente en móvil y tablet */
@media (max-width: 1024px) {
    #svp-chatbot-wrapper { display: none !important; }
}

/* ── Botón flotante WhatsApp (reemplazado en desktop) ──────── */
#svp-chat-trigger {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 9999;
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(37,211,102,0.4);
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    animation: svpPulse 2s infinite;
}

#svp-chat-trigger:hover {
    box-shadow: 0 6px 25px rgba(37,211,102,0.6);
}

#svp-chat-trigger i {
    color: white;
    font-size: 1.8rem;
    transition: all 0.3s ease;
}

#svp-chat-trigger.open i.fa-whatsapp { display: none; }
#svp-chat-trigger.open i.fa-xmark    { display: block !important; }
#svp-chat-trigger i.fa-xmark         { display: none; }

@keyframes svpPulse {
    0%   { box-shadow: 0 4px 15px rgba(37,211,102,0.4); }
    50%  { box-shadow: 0 4px 25px rgba(37,211,102,0.7); }
    100% { box-shadow: 0 4px 15px rgba(37,211,102,0.4); }
}

/* ── Tooltip ───────────────────────────────────────────────── */
#svp-chat-trigger .svp-tooltip {
    position: absolute;
    right: 70px;
    background: #ffffff;
    color: #1e3b2f;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    pointer-events: none;
}

#svp-chat-trigger .svp-tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #ffffff;
}

#svp-chat-trigger:hover .svp-tooltip {
    opacity: 1;
    visibility: visible;
}

body.dark-theme #svp-chat-trigger .svp-tooltip {
    background: #112240;
    color: #e2e8f0;
}

body.dark-theme #svp-chat-trigger .svp-tooltip::after {
    border-left-color: #112240;
}

/* ── Ventana del chat ──────────────────────────────────────── */
#svp-chatbot {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 310px;
    max-height: 500px;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: 'Montserrat', sans-serif;
}

#svp-chatbot.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Modo oscuro */
body.dark-theme #svp-chatbot {
    background: #112240;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* ── Header del chat ───────────────────────────────────────── */
#svp-chatbot .svp-header {
    background: linear-gradient(135deg, #1A4331, #2D5A3F);
    padding: 0.7rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-shrink: 0;
}

.svp-header-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.3);
}

.svp-header-info { flex: 1; }

.svp-header-name {
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1.2;
}

.svp-header-status {
    color: rgba(255,255,255,0.8);
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.svp-status-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    animation: svpBlink 2s infinite;
}

@keyframes svpBlink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* ── Mensajes ──────────────────────────────────────────────── */
#svp-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    background: #f0f4f0;
    min-height: 0;
}

body.dark-theme #svp-messages {
    background: #0A192F;
}

#svp-messages::-webkit-scrollbar { width: 4px; }
#svp-messages::-webkit-scrollbar-track { background: transparent; }
#svp-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 4px; }

/* Burbuja bot */
.svp-msg-bot {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 88%;
    align-self: flex-start;
    animation: svpFadeIn 0.3s ease;
}

.svp-msg-bot-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1A4331, #2D5A3F);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
    color: white;
}

.svp-msg-bot-text {
    background: #ffffff;
    color: #2C2416;
    padding: 0.7rem 1rem;
    border-radius: 18px 18px 18px 4px;
    font-size: 0.85rem;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    white-space: pre-line;
}

body.dark-theme .svp-msg-bot-text {
    background: #1e3a5f;
    color: #e2e8f0;
}

/* Burbuja usuario */
.svp-msg-user {
    align-self: flex-end;
    max-width: 80%;
    animation: svpFadeIn 0.3s ease;
}

.svp-msg-user-text {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
    padding: 0.7rem 1rem;
    border-radius: 18px 18px 4px 18px;
    font-size: 0.85rem;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(37,211,102,0.3);
}

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

/* Typing indicator */
.svp-typing {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    align-self: flex-start;
    animation: svpFadeIn 0.3s ease;
}

.svp-typing-bubbles {
    background: #ffffff;
    padding: 0.7rem 1rem;
    border-radius: 18px 18px 18px 4px;
    display: flex;
    gap: 4px;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

body.dark-theme .svp-typing-bubbles {
    background: #1e3a5f;
}

.svp-typing-dot {
    width: 7px;
    height: 7px;
    background: #1A4331;
    border-radius: 50%;
    animation: svpTyping 1.2s infinite;
}

body.dark-theme .svp-typing-dot { background: #4ade80; }

.svp-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.svp-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes svpTyping {
    0%, 60%, 100% { transform: translateY(0); }
    30%            { transform: translateY(-6px); }
}

/* Botón hablar con agente */
.svp-agent-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    background: #25D366;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.2s;
    text-decoration: none;
}

.svp-agent-btn:hover {
    background: #1ebe5d;
    transform: translateY(-1px);
}

/* ── Input área ────────────────────────────────────────────── */
#svp-input-area {
    padding: 0.8rem 1rem;
    background: #ffffff;
    border-top: 1px solid rgba(0,0,0,0.08);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

body.dark-theme #svp-input-area {
    background: #112240;
    border-top-color: rgba(255,255,255,0.1);
}

#svp-input {
    flex: 1;
    border: 1.5px solid #e2e8f0;
    border-radius: 25px;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-family: 'Montserrat', sans-serif;
    outline: none;
    resize: none;
    background: #f8fafc;
    color: #2C2416;
    transition: border-color 0.2s;
    max-height: 80px;
    min-height: 38px;
}

#svp-input:focus {
    border-color: #1A4331;
}

body.dark-theme #svp-input {
    background: #0A192F;
    border-color: rgba(255,255,255,0.15);
    color: #e2e8f0;
}

body.dark-theme #svp-input:focus {
    border-color: #4ade80;
}

#svp-send {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #1A4331, #2D5A3F);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

#svp-send:hover {
    background: linear-gradient(135deg, #25D366, #128C7E);
    transform: scale(1.08);
}

#svp-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ── Footer del chat ───────────────────────────────────────── */
.svp-footer {
    text-align: center;
    padding: 0.4rem;
    font-size: 0.7rem;
    color: #94a3b8;
    background: #ffffff;
    border-top: 1px solid rgba(0,0,0,0.05);
    flex-shrink: 0;
}

body.dark-theme .svp-footer {
    background: #112240;
    border-top-color: rgba(255,255,255,0.05);
}
