/* 
   --------------------------------------------------------------------------
   ASISTENTE VIRTUAL VIP - CSS INDEPENDIENTE
   Diseño: Premium Glassmorphism & High-End UX
   --------------------------------------------------------------------------
*/

:root {
    --agent-primary: #1e375a;
    --agent-accent: #d4af37;
    --agent-text: #ffffff;
    --agent-glass: rgba(30, 55, 90, 0.85);
    --agent-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --agent-transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Burbuja Flotante Principal */
.vip-agent-launcher {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    /* Un poco más grande para mejor visibilidad */
    height: 70px;
    background: var(--agent-primary);
    border: 3px solid var(--agent-accent);
    border-radius: 50%;
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    transition: var(--agent-transition);
    animation: vibra-agente 5s infinite;
}

.vip-agent-launcher:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 40px rgba(212, 175, 55, 0.4);
}

.vip-agent-launcher img {
    width: 38px;
    height: 38px;
    object-fit: contain;
    /* Evita que se aplaste o estire */
    filter: brightness(0) invert(1);
}

/* Indicador de Notificación */
.vip-agent-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    background: var(--agent-accent);
    color: #1e375a;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--agent-primary);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Ventana de Chat */
.vip-chat-window {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 380px;
    height: 550px;
    background: var(--agent-glass);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    box-shadow: var(--agent-shadow);
    transform-origin: bottom right;
    transform: scale(0) translateY(100px);
    opacity: 0;
    pointer-events: none;
    transition: var(--agent-transition);
}

.vip-chat-window.active {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Cabecera del Chat */
.vip-chat-header {
    background: rgba(0, 0, 0, 0.25);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.vip-chat-agent-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vip-chat-agent-icon {
    width: 48px;
    height: 48px;
    background: transparent;
    /* Eliminamos el fondo para que luzca mejor la imagen */
    border-radius: 50%;
    overflow: hidden;
    /* Importante para redondear la imagen */
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--agent-accent);
}

.vip-chat-agent-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Esto evita que se aplaste o desfigure */
}

.vip-chat-agent-text h4 {
    margin: 0;
    color: var(--agent-text);
    font-size: 16px;
    font-weight: 600;
}

.vip-chat-agent-text div {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #4caf50;
    font-weight: bold;
}

.vip-chat-agent-text .pulse-dot {
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    box-shadow: 0 0 10px #4caf50;
    animation: pulse-online 1.5s infinite;
}

.vip-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.7;
    transition: 0.3s;
}

.vip-chat-close:hover {
    opacity: 1;
    transform: rotate(90deg);
}

.vip-chat-reset {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    margin-right: 15px;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vip-chat-reset:hover {
    opacity: 1;
    color: var(--agent-accent);
    transform: rotate(-180deg);
}

.vip-chat-reset svg {
    width: 20px;
    height: 20px;
}

/* Burbuja de Confirmación personalizada (Viky v4.8) */
.vip-chat-reset-container {
    position: relative;
    display: flex;
    align-items: center;
}

.vip-chat-reset-confirm {
    position: absolute;
    top: 50%;
    right: 40px;
    transform: translateY(-50%) translateX(20px);
    background: #1e375a;
    border: 1px solid var(--agent-accent);
    padding: 8px 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5), 0 0 10px rgba(212, 175, 55, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 100;
    white-space: nowrap;
}

.vip-chat-reset-confirm.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(-50%) translateX(0);
}

.vip-chat-reset-confirm span {
    color: white;
    font-size: 13px;
    font-weight: 500;
}

.vip-confirm-actions {
    display: flex;
    gap: 6px;
}

.vip-confirm-actions button {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid transparent;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.vip-confirm-actions button:hover {
    background: var(--agent-accent);
    color: #1e375a;
    transform: scale(1.1);
}

.vip-confirm-actions button#vipChatResetConfirmNo:hover {
    background: #ff5252;
    color: white;
}

/* Área de Mensajes */
.vip-chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--agent-accent) rgba(255, 255, 255, 0.1);
}

.vip-chat-body::-webkit-scrollbar {
    width: 5px;
}

.vip-chat-body::-webkit-scrollbar-thumb {
    background: var(--agent-accent);
    border-radius: 10px;
}

/* Burbujas de Mensaje */
.msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    /* Respetar saltos de línea de la IA */
    animation: msg-appear 0.3s forwards;
}

.msg-agent {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-bottom-left-radius: 2px;
}

.msg-user {
    align-self: flex-end;
    background: var(--agent-accent);
    color: #000;
    font-weight: 500;
    border-bottom-right-radius: 2px;
}

.msg-time {
    font-size: 10px;
    margin-top: 5px;
    opacity: 0.6;
    display: block;
}

/* Área de Input */
.vip-chat-footer {
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.vip-chat-input-container {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    padding: 5px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: 0.3s;
}

.vip-chat-input-container:focus-within {
    border-color: var(--agent-accent);
    background: rgba(255, 255, 255, 0.15);
}

.vip-chat-input-container input {
    flex: 1;
    background: none;
    border: none;
    padding: 10px 0;
    color: white;
    outline: none;
    font-size: 14px;
}

.vip-chat-input-container input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.vip-chat-send {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--agent-accent);
    transition: 0.3s;
}

.vip-chat-send:hover {
    transform: scale(1.2);
}

/* Animaciones */
@keyframes vibra-agente {

    0%,
    90%,
    100% {
        transform: scale(1);
    }

    92% {
        transform: scale(1.05) rotate(2deg);
    }

    94% {
        transform: scale(1.05) rotate(-2deg);
    }

    96% {
        transform: scale(1.05) rotate(2deg);
    }
}

@keyframes pulse-online {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes msg-appear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .vip-chat-window {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
}