/**
 * Estilos del Botón Flotante de WhatsApp y Panel de Bienvenida
 * Plugin: global-expeditions-whatsapp
 *
 * Paleta de colores:
 * - Verde WhatsApp: #25D366
 * - Verde WhatsApp hover: #1EBE5D
 * - Naranja principal: #F58220
 * - Naranja hover: #FF7900
 * - Azul oscuro institucional: #102A43
 * - Azul cielo: #55BFEA
 * - Azul claro: #DDF3FC
 * - Blanco: #FFFFFF
 */

/* ==========================================================================
   1. CONTENEDOR FLOTANTE PRINCIPAL
   ========================================================================== */
.gew-widget {
    position: fixed;
    z-index: 99998;
    bottom: 24px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none; /* Permitir clics a través del espacio vacío */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

.gew-widget * {
    box-sizing: border-box;
}

/* Posicionamiento en pantalla */
.gew-widget--right {
    right: 24px;
    align-items: flex-end;
}

.gew-widget--left {
    left: 24px;
    align-items: flex-start;
}

/* ==========================================================================
   2. BOTÓN FLOTANTE DISPARADOR
   ========================================================================== */
.gew-btn {
    position: relative;
    pointer-events: auto;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #25D366;
    color: #FFFFFF !important;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(37, 211, 102, 0.42), 0 2px 8px rgba(0, 0, 0, 0.16);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.28s ease, 
                background-color 0.25s ease;
    outline: none;
    user-select: none;
}

.gew-btn:hover {
    background-color: #1EBE5D;
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 8px 24px rgba(37, 211, 102, 0.52), 0 4px 12px rgba(0, 0, 0, 0.2);
    color: #FFFFFF !important;
}

.gew-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.gew-btn:focus-visible {
    outline: 3px solid #55BFEA;
    outline-offset: 3px;
}

/* Estado activo cuando el panel está abierto */
.gew-btn.gew-btn--active {
    background-color: #102A43;
    box-shadow: 0 6px 20px rgba(16, 42, 67, 0.45);
    transform: rotate(90deg);
}

.gew-btn.gew-btn--active:hover {
    background-color: #F58220;
    color: #FFFFFF !important;
}

/* Iconos dentro del botón */
.gew-btn__icon-wa {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.gew-btn__icon-close {
    display: none;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    transform: rotate(-90deg);
    transition: opacity 0.2s ease;
}

.gew-btn.gew-btn--active .gew-btn__icon-wa {
    display: none;
}

.gew-btn.gew-btn--active .gew-btn__icon-close {
    display: flex;
}

/* Indicador sutil de disponibilidad (pulso) */
.gew-btn__pulse {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #25D366;
    border: 2.5px solid #FFFFFF;
}

.gew-btn__pulse::after {
    content: '';
    position: absolute;
    top: -2.5px;
    left: -2.5px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #25D366;
    opacity: 0.7;
    animation: gew-ripple 2.2s infinite ease-out;
}

.gew-btn.gew-btn--active .gew-btn__pulse {
    display: none;
}

@keyframes gew-ripple {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    70% {
        transform: scale(2.2);
        opacity: 0;
    }
    100% {
        transform: scale(2.2);
        opacity: 0;
    }
}

/* Tooltip informativo al pasar el cursor en computadoras */
.gew-tooltip {
    position: absolute;
    right: calc(100% + 14px);
    background-color: #102A43;
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: 8px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateX(8px);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    pointer-events: none;
}

.gew-widget--left .gew-tooltip {
    right: auto;
    left: calc(100% + 14px);
    transform: translateX(-8px);
}

.gew-tooltip::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -6px;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-style: solid;
    border-color: transparent transparent transparent #102A43;
}

.gew-widget--left .gew-tooltip::after {
    right: auto;
    left: -6px;
    border-width: 6px 6px 6px 0;
    border-color: transparent #102A43 transparent transparent;
}

.gew-btn:hover .gew-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.gew-btn.gew-btn--active .gew-tooltip {
    display: none !important;
}

/* ==========================================================================
   3. PANEL DE BIENVENIDA (TARJETA MODERNA)
   ========================================================================== */
.gew-card {
    position: absolute;
    bottom: 76px;
    width: 360px;
    max-width: calc(100vw - 32px);
    background-color: #FFFFFF;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 14px 44px rgba(16, 42, 67, 0.24), 0 4px 14px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(85, 191, 234, 0.2);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(16px) scale(0.96);
    transform-origin: bottom right;
    transition: opacity 0.28s ease, 
                transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
                visibility 0.28s;
}

.gew-widget--left .gew-card {
    transform-origin: bottom left;
}

.gew-card.gew-card--open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

/* Cabecera del Panel */
.gew-card__header {
    background: linear-gradient(135deg, #102A43 0%, #173859 100%);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 3px solid #F58220;
}

.gew-card__brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gew-card__avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.12);
    border: 2px solid #55BFEA;
    color: #55BFEA;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.gew-card__online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #25D366;
    border: 2px solid #102A43;
}

.gew-card__brand-text {
    display: flex;
    flex-direction: column;
}

.gew-card__brand-name {
    font-size: 15.5px;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: 0.2px;
}

.gew-card__status {
    font-size: 12px;
    color: #CBD5E1;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
}

.gew-card__status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: #25D366;
    display: inline-block;
}

/* Botón de cierre dentro del panel */
.gew-card__close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    padding: 0;
    outline: none;
}

.gew-card__close-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
}

.gew-card__close-btn:focus-visible {
    outline: 2px solid #55BFEA;
}

/* Cuerpo del Panel */
.gew-card__body {
    background-color: #F8FAFC;
    padding: 22px 20px 18px 20px;
}

.gew-card__title {
    font-size: 16.5px !important;
    font-weight: 700 !important;
    color: #102A43 !important;
    margin: 0 0 12px 0 !important;
    line-height: 1.35 !important;
}

/* Burbuja de mensaje simulada */
.gew-card__message-bubble {
    background-color: #FFFFFF;
    border-radius: 14px;
    border-top-left-radius: 4px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(16, 42, 67, 0.06);
    border: 1px solid rgba(221, 243, 252, 0.8);
    position: relative;
    margin-bottom: 12px;
}

.gew-card__message-text {
    font-size: 14px !important;
    color: #334155 !important;
    margin: 0 !important;
    line-height: 1.5 !important;
}

.gew-card__message-time {
    display: block;
    text-align: right;
    font-size: 11px;
    color: #94A3B8;
    margin-top: 6px;
    font-weight: 500;
}

/* Insignia de contexto del tour */
.gew-card__context-badge {
    background-color: #DDF3FC;
    border: 1px solid rgba(85, 191, 234, 0.4);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #102A43;
    font-weight: 600;
    margin-top: 8px;
}

.gew-card__context-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.gew-card__context-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Pie del Panel con Botón CTA Principal */
.gew-card__footer {
    background-color: #FFFFFF;
    padding: 16px 20px 20px 20px;
    border-top: 1px solid rgba(226, 232, 240, 0.8);
}

.gew-card__cta-btn {
    background-color: #25D366;
    color: #FFFFFF !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 20px;
    border-radius: 12px;
    text-decoration: none !important;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
    transition: background-color 0.25s ease, 
                transform 0.25s ease, 
                box-shadow 0.25s ease;
    width: 100%;
    outline: none;
}

.gew-card__cta-btn:hover {
    background-color: #1EBE5D;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37, 211, 102, 0.45);
    color: #FFFFFF !important;
}

.gew-card__cta-btn:active {
    transform: translateY(0);
}

.gew-card__cta-btn:focus-visible {
    outline: 3px solid #55BFEA;
    outline-offset: 2px;
}

.gew-card__cta-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ==========================================================================
   4. ADAPTABILIDAD / RESPONSIVE
   ========================================================================== */
@media (max-width: 480px) {
    .gew-widget--right {
        bottom: 16px;
        right: 16px;
    }

    .gew-widget--left {
        bottom: 16px;
        left: 16px;
    }

    .gew-btn {
        width: 56px;
        height: 56px;
    }

    .gew-btn__icon-wa svg {
        width: 30px;
        height: 30px;
    }

    .gew-tooltip {
        display: none !important; /* Ocultar tooltips en pantallas táctiles */
    }

    .gew-card {
        width: calc(100vw - 32px);
        bottom: 72px;
        border-radius: 16px;
        max-height: 80vh;
        overflow-y: auto;
    }

    .gew-card__header {
        padding: 15px 16px;
    }

    .gew-card__body {
        padding: 18px 16px 14px 16px;
    }

    .gew-card__footer {
        padding: 14px 16px 16px 16px;
    }
}

/* ==========================================================================
   5. PREFERS-REDUCED-MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .gew-btn,
    .gew-btn:hover,
    .gew-card,
    .gew-card__cta-btn {
        transition: none !important;
        transform: none !important;
    }

    .gew-btn__pulse::after {
        animation: none !important;
    }
}
