/**
 * Estilos del Asistente Virtual en Frontend (Burbuja Flotante y Chat)
 * Mundo Sostenible - 100% Touch & Responsive - Zero Glows
 */

:root {
    --asistente-primary: #c3d600;
    --asistente-primary-dark: #a2b200;
    --asistente-bg-dark: #111827;
    --asistente-bg-card: #1f2937;
    --asistente-text: #f8fafc;
    --asistente-text-muted: #94a3b8;
    --asistente-border: #374151;
}

/* Contenedor Flotante de la Burbuja (por encima de modales con z-index 10000) */
.burbuja-flotante-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Área Táctil Mínima de 48px para Móvil */
.burbuja-hit-area {
    min-width: 48px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

/* Botón Circular de la Burbuja */
.burbuja-btn-trigger {
    width: var(--burbuja-tamano, 60px);
    height: var(--burbuja-tamano, 60px);
    border-radius: 50%;
    background: var(--asistente-bg-dark);
    border: 2px solid var(--asistente-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: transform 0.2s ease, border-color 0.2s ease;
    user-select: none;
}

.burbuja-btn-trigger:hover {
    transform: scale(1.06);
    border-color: #d6e800;
}

.burbuja-btn-trigger:active {
    transform: scale(0.95);
}

.burbuja-icono-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: block;
    pointer-events: none;
}

/* Indicador de Estado Activo / Conectado (4px de separación libre respecto al borde) */
.burbuja-status-dot {
    position: absolute;
    bottom: calc(var(--burbuja-tamano, 60px) * 0.14 + 3px);
    right: calc(var(--burbuja-tamano, 60px) * 0.14 + 3px);
    width: clamp(8px, calc(var(--burbuja-tamano, 60px) * 0.18), 12px);
    height: clamp(8px, calc(var(--burbuja-tamano, 60px) * 0.18), 12px);
    border-radius: 50%;
    background: #10b981;
    border: 1.5px solid var(--asistente-bg-dark, #0f172a);
    box-sizing: border-box;
    pointer-events: none;
    z-index: 2;
}

/* ==========================================================================
   VENTANA DEL CHAT DEL ASISTENTE (DESKTOP & MÓVIL)
   ========================================================================== */

.asistente-modal-container {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 12005;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.96);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
}

.asistente-modal-container.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Cabecera del Chat */
.asistente-header {
    background: var(--asistente-bg-dark);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--asistente-primary);
    color: var(--asistente-text);
}

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

.asistente-avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: transparent;
    border: none;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.asistente-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.asistente-header-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
    line-height: 1.2;
}

.asistente-header-status {
    font-size: 0.75rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
}

.asistente-header-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
}

.asistente-btn-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.2rem;
    transition: background 0.15s, color 0.15s;
    outline: none;
}

.asistente-btn-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Cuerpo de Mensajes */
.asistente-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

/* Burbujas de Mensaje */
.asistente-msg {
    max-width: 85%;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.5;
    word-break: break-word;
}

.asistente-msg.bot {
    align-self: flex-start;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-top-left-radius: 4px;
}

.asistente-msg.user {
    align-self: flex-end;
    background: #111827;
    color: #ffffff;
    border: 1px solid #111827;
    border-top-right-radius: 4px;
}

/* Sugerencias Rápidas (Chips) */
.asistente-chips-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.asistente-chip-btn {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    min-height: 38px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.asistente-chip-btn:hover {
    background: #f1f5f9;
    border-color: #4d5700;
}

/* Pie y Formulario de Envío */
.asistente-footer {
    background: #ffffff;
    padding: 12px 14px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.asistente-input {
    flex: 1;
    height: 48px;
    border: 1.5px solid #cbd5e1;
    border-radius: 24px;
    padding: 0 16px;
    font-size: 0.88rem;
    color: #0f172a;
    background: #f8fafc;
    outline: none;
    transition: border-color 0.15s;
}

.asistente-input:focus {
    border-color: #4d5700;
    background: #ffffff;
}

.asistente-btn-send {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--asistente-bg-dark);
    border: 1.5px solid var(--asistente-primary);
    color: var(--asistente-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    flex-shrink: 0;
}

.asistente-btn-send:hover {
    background: #1f2937;
    transform: scale(1.05);
}

.asistente-btn-send:active {
    transform: scale(0.95);
}

/* ==========================================================================
   COMPORTAMIENTO RESPONSIVE EN MÓVILES (< 768px)
   ========================================================================== */

@media (max-width: 768px) {
    .burbuja-flotante-wrapper {
        bottom: 16px;
        right: 16px;
    }

    .asistente-modal-container {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    .asistente-header {
        padding: 14px 16px;
    }
}
