/*
 * FloatClient Public Widget Styles
 * Temas: classic, bubble, card, minimal
 * =====================================================
 */

/* ── Variables y base ───────────────────────────────── */
#floatclient-widget,
#floatchat-widget {
    --fc-mx: 20px;
    --fc-my: 75px;
    --fc-btn: #25D366;
    --fc-btn-size: 60px;
    --fc-radius: 50%;
    --fc-shadow: 0 4px 20px rgba(0, 0, 0, 0.22);
    --fc-transition: 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    --fc-z: 999999;

    position: fixed;
    z-index: var(--fc-z);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
    opacity: 1;
    pointer-events: all;
}

/* Solo box-sizing global sin pisar paddings ni márgenes de componentes */
#floatclient-widget,
#floatchat-widget,
#floatclient-widget *,
#floatchat-widget *,
#floatclient-widget *::before,
#floatchat-widget *::before,
#floatclient-widget *::after,
#floatchat-widget *::after {
    box-sizing: border-box;
}

/* Reseteo defensivo solo de etiquetas nativas para evitar herencias agresivas de temas */
#floatclient-widget p,
#floatchat-widget p,
#floatclient-widget h1,
#floatchat-widget h1,
#floatclient-widget h2,
#floatchat-widget h2,
#floatclient-widget h3,
#floatchat-widget h3,
#floatclient-widget h4,
#floatchat-widget h4,
#floatclient-widget ul,
#floatchat-widget ul,
#floatclient-widget ol,
#floatchat-widget ol,
#floatclient-widget li,
#floatchat-widget li {
    margin: 0;
    padding: 0;
}

/* ── Posiciones ───────────────────────────────────── */
#floatclient-widget.fc-pos-bottom-right,
#floatchat-widget.fc-pos-bottom-right {
    right: var(--fc-mx);
    bottom: var(--fc-my);
    left: auto;
    top: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#floatclient-widget.fc-pos-bottom-left,
#floatchat-widget.fc-pos-bottom-left {
    left: var(--fc-mx);
    bottom: var(--fc-my);
    right: auto;
    top: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#floatclient-widget.fc-pos-top-right,
#floatchat-widget.fc-pos-top-right {
    right: var(--fc-mx);
    top: var(--fc-my);
    left: auto;
    bottom: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

#floatclient-widget.fc-pos-top-left,
#floatchat-widget.fc-pos-top-left {
    left: var(--fc-mx);
    top: var(--fc-my);
    right: auto;
    bottom: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* ── Visibilidad con delay ────────────────────────── */
#floatclient-widget.fc-hidden,
#floatchat-widget.fc-hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
}

#floatclient-widget.fc-visible,
#floatchat-widget.fc-visible {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
    transition: opacity 0.4s ease, transform 0.4s var(--fc-transition);
}

/* ═════════════════════════════════════════════════════
   BOTÓN TOGGLE (común a todos los temas)
   ═════════════════════════════════════════════════════ */
#floatclient-widget .floatclient-toggle,
#floatchat-widget .floatchat-toggle {
    width: var(--fc-btn-size);
    height: var(--fc-btn-size);
    border-radius: var(--fc-radius);
    background: var(--fc-btn, #25D366);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--fc-shadow);
    position: relative;
    z-index: 2;
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-shrink: 0;
    outline: none;
    padding: 0;
    margin: 0;
}
#floatclient-widget .floatclient-toggle:focus-visible,
#floatchat-widget .floatchat-toggle:focus-visible {
    box-shadow: var(--fc-shadow), 0 0 0 3px rgba(255,255,255,0.6);
}
#floatclient-widget .floatclient-toggle:hover,
#floatchat-widget .floatchat-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.3);
}
#floatclient-widget .floatclient-toggle:active,
#floatchat-widget .floatchat-toggle:active {
    transform: scale(0.96);
}

/* Íconos del toggle (open / close) */
#floatclient-widget .fc-icon-chat,
#floatclient-widget .fc-icon-close,
#floatchat-widget .fc-icon-chat,
#floatchat-widget .fc-icon-close {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.3s var(--fc-transition);
}
#floatclient-widget .fc-icon-close,
#floatchat-widget .fc-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.6);
}
#floatclient-widget .fc-icon-chat,
#floatchat-widget .fc-icon-chat {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}
/* Cuando está abierto: intercambiar iconos */
#floatclient-widget.fc-open .fc-icon-chat,
#floatchat-widget.fc-open .fc-icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0.6);
}
#floatclient-widget.fc-open .fc-icon-close,
#floatchat-widget.fc-open .fc-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ═════════════════════════════════════════════════════
   MENÚ DE CANALES (Classic + Bubble + Minimal)
   ═════════════════════════════════════════════════════ */
#floatclient-widget .floatclient-menu,
#floatchat-widget .floatchat-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 0 var(--fc-menu-gap, 16px) 0;
    padding: 0;
    order: -1;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.22s ease, transform 0.28s var(--fc-transition);
}
#floatclient-widget.fc-open .floatclient-menu,
#floatclient-widget.fc-open .floatchat-menu,
#floatchat-widget.fc-open .floatclient-menu,
#floatchat-widget.fc-open .floatchat-menu {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

/* Animación escalonada para cada canal */
#floatclient-widget .floatclient-channel:nth-child(1),
#floatchat-widget .floatchat-channel:nth-child(1) { transition-delay: 0ms; }
#floatclient-widget .floatclient-channel:nth-child(2),
#floatchat-widget .floatchat-channel:nth-child(2) { transition-delay: 40ms; }
#floatclient-widget .floatclient-channel:nth-child(3),
#floatchat-widget .floatchat-channel:nth-child(3) { transition-delay: 80ms; }
#floatclient-widget .floatclient-channel:nth-child(4),
#floatchat-widget .floatchat-channel:nth-child(4) { transition-delay: 120ms; }
#floatclient-widget .floatclient-channel:nth-child(5),
#floatchat-widget .floatchat-channel:nth-child(5) { transition-delay: 160ms; }

/* ── Canal base en menú flotante (Classic + Bubble) ─── */
#floatclient-widget .floatclient-channel,
#floatchat-widget .floatchat-channel {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #1e293b;
    border-radius: 40px;
    background: #ffffff;
    padding: 8px 24px 8px 8px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16);
    white-space: nowrap;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
#floatclient-widget .floatclient-channel:hover,
#floatchat-widget .floatchat-channel:hover {
    transform: translateX(-4px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}
/* Alineación izquierda: hover al otro lado */
#floatclient-widget.fc-pos-bottom-left .floatclient-channel:hover,
#floatchat-widget.fc-pos-bottom-left .floatchat-channel:hover {
    transform: translateX(4px);
}

#floatclient-widget .fc-ch-icon,
#floatchat-widget .fc-ch-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--fc-ch-color, #25D366);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ffffff;
}
#floatclient-widget .fc-ch-label,
#floatchat-widget .fc-ch-label {
    flex: 1;
    padding-right: 6px;
    letter-spacing: 0.2px;
    color: #1e293b;
    font-size: 14px;
    font-weight: 600;
}

/* ═════════════════════════════════════════════════════
   TEMA: CLASSIC
   ═════════════════════════════════════════════════════ */
/* Classic usa los estilos base */

/* ═════════════════════════════════════════════════════
   TEMA: BUBBLE
   ═════════════════════════════════════════════════════ */

/* Pulse rings */
#floatclient-widget.fc-theme-bubble .fc-pulse,
#floatchat-widget.fc-theme-bubble .fc-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--fc-btn, #25D366);
    opacity: 0;
    animation: fc-pulse-ring 2.2s ease-out infinite;
    pointer-events: none;
}
#floatclient-widget.fc-theme-bubble .fc-pulse-2,
#floatchat-widget.fc-theme-bubble .fc-pulse-2 {
    animation-delay: 0.7s;
}
@keyframes fc-pulse-ring {
    0%   { transform: scale(1); opacity: 0.55; }
    80%  { transform: scale(1.7); opacity: 0; }
    100% { transform: scale(1.7); opacity: 0; }
}

/* Stop pulse when open */
#floatclient-widget.fc-theme-bubble.fc-open .fc-pulse,
#floatchat-widget.fc-theme-bubble.fc-open .fc-pulse {
    animation: none;
    opacity: 0;
}

/* Tooltip */
#floatclient-widget.fc-theme-bubble .fc-tooltip,
#floatchat-widget.fc-theme-bubble .fc-tooltip {
    background: #fff;
    color: #333;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.14);
    white-space: nowrap;
    margin-bottom: 10px;
    order: 1;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
    position: relative;
}
/* Arrow de tooltip */
#floatclient-widget.fc-theme-bubble.fc-pos-bottom-right .fc-tooltip::after,
#floatchat-widget.fc-theme-bubble.fc-pos-bottom-right .fc-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #fff;
}
#floatclient-widget.fc-theme-bubble.fc-pos-bottom-left .fc-tooltip::after,
#floatchat-widget.fc-theme-bubble.fc-pos-bottom-left .fc-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #fff;
}
/* Ocultar tooltip cuando está abierto */
#floatclient-widget.fc-theme-bubble.fc-open .fc-tooltip,
#floatchat-widget.fc-theme-bubble.fc-open .fc-tooltip {
    opacity: 0;
    transform: translateY(4px);
    pointer-events: none;
}

/* ═════════════════════════════════════════════════════
   TEMA: CARD (Tarjeta flotante desahogada y elegante)
   ═════════════════════════════════════════════════════ */

/* Ocultar menú clásico en tema card */
#floatclient-widget.fc-theme-card .floatclient-menu,
#floatclient-widget.fc-theme-card .floatchat-menu,
#floatchat-widget.fc-theme-card .floatclient-menu,
#floatchat-widget.fc-theme-card .floatchat-menu {
    display: none;
}

/* Card widget contenedor exterior */
#floatclient-widget.fc-theme-card .floatclient-card,
#floatclient-widget.fc-theme-card .floatchat-card,
#floatchat-widget.fc-theme-card .floatclient-card,
#floatchat-widget.fc-theme-card .floatchat-card {
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
    width: 330px;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    margin: 0 0 max(var(--fc-menu-gap, 20px), 20px) 0;
    padding: 0;
    order: -1;

    opacity: 0;
    pointer-events: none;
    transform: translateY(16px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.28s ease, transform 0.32s var(--fc-transition);
}
#floatclient-widget.fc-theme-card.fc-pos-bottom-left .floatclient-card,
#floatclient-widget.fc-theme-card.fc-pos-bottom-left .floatchat-card,
#floatchat-widget.fc-theme-card.fc-pos-bottom-left .floatclient-card,
#floatchat-widget.fc-theme-card.fc-pos-bottom-left .floatchat-card {
    transform-origin: bottom left;
}
#floatclient-widget.fc-theme-card.fc-open .floatclient-card,
#floatclient-widget.fc-theme-card.fc-open .floatchat-card,
#floatchat-widget.fc-theme-card.fc-open .floatclient-card,
#floatchat-widget.fc-theme-card.fc-open .floatchat-card {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

/* Cabecera de la tarjeta */
#floatclient-widget .fc-card-header,
#floatchat-widget .fc-card-header {
    padding: 18px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0;
}
#floatclient-widget .fc-card-title,
#floatchat-widget .fc-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-weight: 700;
    font-size: 16px;
    line-height: 1.2;
}
#floatclient-widget .fc-card-close,
#floatchat-widget .fc-card-close {
    background: rgba(255,255,255,0.22);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    transition: background 0.2s, transform 0.15s;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
}
#floatclient-widget .fc-card-close:hover,
#floatchat-widget .fc-card-close:hover {
    background: rgba(255,255,255,0.38);
    transform: scale(1.08);
}

/* Cuerpo de la tarjeta: padding interior generoso */
#floatclient-widget .fc-card-body,
#floatchat-widget .fc-card-body {
    padding: 22px 22px 26px 22px;
    background: #ffffff;
    margin: 0;
}
#floatclient-widget .fc-card-subtitle,
#floatchat-widget .fc-card-subtitle {
    font-size: 11.5px;
    color: #64748b;
    margin: 0 0 16px 0;
    padding: 0;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    line-height: 1.3;
}
#floatclient-widget .fc-card-channels,
#floatchat-widget .fc-card-channels {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
    padding: 0;
}

/* Botón interno de canal dentro de la Card */
#floatclient-widget .fc-card-channel,
#floatchat-widget .fc-card-channel {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 18px;
    border-radius: 14px;
    text-decoration: none;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin: 0;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
#floatclient-widget .fc-card-channel:hover,
#floatchat-widget .fc-card-channel:hover {
    background: #f8fafc;
    border-color: var(--fc-ch-color, #25D366);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}
#floatclient-widget .fc-card-ch-icon,
#floatchat-widget .fc-card-ch-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ffffff;
}
#floatclient-widget .fc-card-ch-label,
#floatchat-widget .fc-card-ch-label {
    flex: 1;
    color: #1e293b;
    font-size: 15px;
    font-weight: 600;
}
#floatclient-widget .fc-card-ch-arrow,
#floatchat-widget .fc-card-ch-arrow {
    color: #94a3b8;
    flex-shrink: 0;
    transition: transform 0.18s ease, color 0.18s ease;
}
#floatclient-widget .fc-card-channel:hover .fc-card-ch-arrow,
#floatchat-widget .fc-card-channel:hover .fc-card-ch-arrow {
    transform: translateX(3px);
    color: var(--fc-ch-color, #25D366);
}

/* ═════════════════════════════════════════════════════
   TEMA: MINIMAL
   ═════════════════════════════════════════════════════ */

#floatclient-widget.fc-theme-minimal,
#floatchat-widget.fc-theme-minimal {
    --fc-btn-size: 50px;
}

#floatclient-widget.fc-theme-minimal .floatclient-menu,
#floatclient-widget.fc-theme-minimal .floatchat-menu,
#floatchat-widget.fc-theme-minimal .floatclient-menu,
#floatchat-widget.fc-theme-minimal .floatchat-menu {
    gap: 8px;
    margin-bottom: 10px;
}

#floatclient-widget.fc-theme-minimal .floatclient-channel,
#floatclient-widget.fc-theme-minimal .floatchat-channel,
#floatchat-widget.fc-theme-minimal .floatclient-channel,
#floatchat-widget.fc-theme-minimal .floatchat-channel {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
    background: var(--fc-ch-color, #25D366);
    box-shadow: 0 2px 10px rgba(0,0,0,0.18);
    position: relative;
    overflow: visible;
}
#floatclient-widget.fc-theme-minimal .floatclient-channel:hover,
#floatclient-widget.fc-theme-minimal .floatchat-channel:hover,
#floatchat-widget.fc-theme-minimal .floatclient-channel:hover,
#floatchat-widget.fc-theme-minimal .floatchat-channel:hover {
    transform: scale(1.12);
}
#floatclient-widget.fc-theme-minimal .fc-ch-icon,
#floatchat-widget.fc-theme-minimal .fc-ch-icon {
    background: transparent;
    width: auto;
    height: auto;
    color: #fff;
}
#floatclient-widget.fc-theme-minimal .fc-ch-label,
#floatchat-widget.fc-theme-minimal .fc-ch-label {
    display: none;
}

/* Tooltip on hover for minimal */
#floatclient-widget.fc-theme-minimal .floatclient-channel::after,
#floatclient-widget.fc-theme-minimal .floatchat-channel::after,
#floatchat-widget.fc-theme-minimal .floatclient-channel::after,
#floatchat-widget.fc-theme-minimal .floatchat-channel::after {
    content: attr(aria-label);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
#floatclient-widget.fc-theme-minimal .floatclient-channel:hover::after,
#floatclient-widget.fc-theme-minimal .floatchat-channel:hover::after,
#floatchat-widget.fc-theme-minimal .floatclient-channel:hover::after,
#floatchat-widget.fc-theme-minimal .floatchat-channel:hover::after {
    opacity: 1;
}
#floatclient-widget.fc-theme-minimal.fc-pos-bottom-left .floatclient-channel::after,
#floatclient-widget.fc-theme-minimal.fc-pos-bottom-left .floatchat-channel::after,
#floatchat-widget.fc-theme-minimal.fc-pos-bottom-left .floatclient-channel::after,
#floatchat-widget.fc-theme-minimal.fc-pos-bottom-left .floatchat-channel::after {
    right: auto;
    left: calc(100% + 10px);
}

/* Toggle minimal overrides */
#floatclient-widget.fc-theme-minimal .floatclient-toggle,
#floatclient-widget.fc-theme-minimal .floatchat-toggle,
#floatchat-widget.fc-theme-minimal .floatclient-toggle,
#floatchat-widget.fc-theme-minimal .floatchat-toggle {
    --fc-btn-size: 50px;
}

/* ── Ocultar elementos de otros temas ─────────────────── */
/* El tooltip solo se usa en bubble */
.fc-tooltip { display: none; }
#floatclient-widget.fc-theme-bubble .fc-tooltip,
#floatchat-widget.fc-theme-bubble .fc-tooltip { display: block; }

/* La card solo se usa en card theme */
.floatclient-card,
.floatchat-card { display: none; }
#floatclient-widget.fc-theme-card .floatclient-card,
#floatclient-widget.fc-theme-card .floatchat-card,
#floatchat-widget.fc-theme-card .floatclient-card,
#floatchat-widget.fc-theme-card .floatchat-card { display: block; }

/* Los pulse rings solo en bubble */
.fc-pulse { display: none; }
#floatclient-widget.fc-theme-bubble .fc-pulse,
#floatchat-widget.fc-theme-bubble .fc-pulse { display: block; }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 480px) {
    #floatclient-widget,
    #floatchat-widget {
        --fc-mx: 14px;
        --fc-my: 20px;
    }
    #floatclient-widget.fc-theme-card .floatclient-card,
    #floatclient-widget.fc-theme-card .floatchat-card,
    #floatchat-widget.fc-theme-card .floatclient-card,
    #floatchat-widget.fc-theme-card .floatchat-card {
        width: calc(100vw - 28px);
        max-width: 320px;
    }
    #floatclient-widget .floatclient-channel,
    #floatchat-widget .floatchat-channel {
        padding: 8px 16px 8px 8px;
    }
}

/* ── Reduced motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    #floatclient-widget.fc-theme-bubble .fc-pulse,
    #floatchat-widget.fc-theme-bubble .fc-pulse {
        animation: none;
    }
    #floatclient-widget .floatclient-toggle,
    #floatchat-widget .floatchat-toggle,
    #floatclient-widget .floatclient-menu,
    #floatchat-widget .floatchat-menu,
    #floatclient-widget .floatclient-card,
    #floatchat-widget .floatchat-card,
    #floatclient-widget .fc-icon-chat,
    #floatclient-widget .fc-icon-close {
        transition: none;
    }
}
