/* ═════════════════════════════════════════════════════════════════
   FloatClient - Estilos del Widget Interactivo (4 Temas Completos)
   Classic, Bubble, Card, Minimal
   ═════════════════════════════════════════════════════════════════ */

/* ── Base Común ─────────────────────────────────────────────── */
.fc-widget-root {
    --fc-btn: #25D366;
    --fc-btn-size: 60px;
    --fc-radius: 50%;
    --fc-shadow: 0 8px 30px rgba(0, 0, 0, 0.28);
    --fc-transition: 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    box-sizing: border-box;
}

#landingLiveWidget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

/* Canvas stage preview widget */
.fc-stage-widget {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-left: auto;
}

/* ── Botón Toggle ───────────────────────────────────────────── */
.fc-live-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;
    outline: none;
    flex-shrink: 0;
}
.fc-live-toggle:hover {
    transform: scale(1.08);
}
.fc-live-toggle:active {
    transform: scale(0.96);
}

.fc-icon-chat,
.fc-icon-close {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s ease, transform 0.26s var(--fc-transition);
}
.fc-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0.6);
}
.fc-icon-chat {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.fc-widget-root.fc-open .fc-icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0.6);
}
.fc-widget-root.fc-open .fc-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* ── Menú de Canales (Classic, Bubble, Minimal) ──────────────── */
.fc-live-menu {
    display: none;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px);
    transition: opacity 0.22s ease, transform 0.26s var(--fc-transition);
}
.fc-widget-root.fc-open:not(.fc-theme-card) .fc-live-menu {
    display: flex;
    opacity: 1;
    pointer-events: all;
    transform: translateY(0);
}

/* Canal Píldora (Con el respiro perfecto en WhatsApp) */
.fc-live-channel {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #1e293b;
    border-radius: 40px;
    background: #ffffff;
    padding: 8px 26px 8px 8px; /* 26px derecho para que nunca toque la curvatura */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.16);
    white-space: nowrap;
    font-weight: 600;
    font-size: 13.5px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.fc-live-channel:hover {
    transform: translateX(-4px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.24);
}
.fc-live-channel .fc-ch-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.fc-live-channel .fc-ch-label {
    padding-right: 6px;
    letter-spacing: 0.2px;
}

/* ═════════════════════════════════════════════════════════════════
   TEMA 1: CLASSIC
   ═════════════════════════════════════════════════════════════════ */
.fc-widget-root.fc-theme-classic .fc-pulse,
.fc-widget-root.fc-theme-classic .fc-tooltip,
.fc-widget-root.fc-theme-classic .fc-live-card {
    display: none !important;
}

/* ═════════════════════════════════════════════════════════════════
   TEMA 2: BUBBLE (PULSE RINGS + TOOLTIP)
   ═════════════════════════════════════════════════════════════════ */
.fc-widget-root.fc-theme-bubble .fc-live-card {
    display: none !important;
}

/* Anillos de pulso animados */
.fc-widget-root.fc-theme-bubble .fc-pulse {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 3px solid var(--fc-btn, #25D366);
    background: transparent;
    opacity: 0;
    animation: fc-pulse-ring 2.2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    pointer-events: none;
    z-index: 1;
}
.fc-widget-root.fc-theme-bubble .fc-pulse-2 {
    animation-delay: 0.8s;
}
@keyframes fc-pulse-ring {
    0%   { transform: scale(0.9); opacity: 0.85; }
    50%  { opacity: 0.45; }
    100% { transform: scale(1.65); opacity: 0; }
}
.fc-widget-root.fc-theme-bubble.fc-open .fc-pulse {
    animation: none;
    opacity: 0;
}

/* Tooltip emergente «¿Necesitas ayuda?» */
.fc-widget-root.fc-theme-bubble .fc-tooltip {
    background: #ffffff;
    color: #0f172a;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
    white-space: nowrap;
    margin-bottom: 12px;
    position: relative;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: block;
}
.fc-widget-root.fc-theme-bubble .fc-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 22px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #ffffff;
}
.fc-widget-root.fc-theme-bubble.fc-open .fc-tooltip {
    display: none !important;
}

/* ═════════════════════════════════════════════════════════════════
   TEMA 3: CARD (EXPANDABLE POPUP CARD)
   ═════════════════════════════════════════════════════════════════ */
.fc-widget-root.fc-theme-card .fc-pulse,
.fc-widget-root.fc-theme-card .fc-tooltip,
.fc-widget-root.fc-theme-card .fc-live-menu {
    display: none !important;
}

.fc-live-card {
    display: none;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
    width: 310px;
    max-width: calc(100vw - 32px);
    overflow: hidden;
    margin-bottom: 14px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(16px) scale(0.95);
    transform-origin: bottom right;
    transition: opacity 0.26s ease, transform 0.28s var(--fc-transition);
}
.fc-widget-root.fc-theme-card.fc-open .fc-live-card {
    display: block;
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}

.fc-card-header {
    background: #25D366;
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.fc-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
}
.fc-card-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    transition: background 0.15s;
}
.fc-card-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.fc-card-body {
    padding: 16px 18px;
    background: #ffffff;
}
.fc-card-subtitle {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}
.fc-card-channels {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.fc-card-channel {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    text-decoration: none;
    color: #0f172a;
    border: 1px solid #f1f5f9;
    font-weight: 600;
    font-size: 13.5px;
    transition: background 0.18s, border-color 0.18s, transform 0.18s;
}
.fc-card-channel:hover {
    background: #f8fafc;
    border-color: #25D366;
    transform: translateX(2px);
}
.fc-card-ch-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}
.fc-card-ch-label {
    flex: 1;
}
.fc-card-ch-arrow {
    color: #94a3b8;
    transition: transform 0.18s, color 0.18s;
}
.fc-card-channel:hover .fc-card-ch-arrow {
    transform: translateX(3px);
    color: #25D366;
}

/* ═════════════════════════════════════════════════════════════════
   TEMA 4: MINIMAL (ICONS ONLY + TOOLTIP ON HOVER)
   ═════════════════════════════════════════════════════════════════ */
.fc-widget-root.fc-theme-minimal {
    --fc-btn-size: 50px;
}
.fc-widget-root.fc-theme-minimal .fc-pulse,
.fc-widget-root.fc-theme-minimal .fc-tooltip,
.fc-widget-root.fc-theme-minimal .fc-live-card {
    display: none !important;
}

.fc-widget-root.fc-theme-minimal .fc-live-menu {
    gap: 10px;
    margin-bottom: 12px;
}
.fc-widget-root.fc-theme-minimal .fc-live-channel {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    padding: 0;
    justify-content: center;
    background: var(--fc-ch-color, #25D366) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    position: relative;
    overflow: visible;
}
.fc-widget-root.fc-theme-minimal .fc-live-channel:hover {
    transform: scale(1.12);
}
.fc-widget-root.fc-theme-minimal .fc-live-channel .fc-ch-icon {
    background: transparent !important;
    width: auto;
    height: auto;
}
.fc-widget-root.fc-theme-minimal .fc-live-channel .fc-ch-label {
    display: none !important;
}

/* Floating tooltip on hover in Minimal */
.fc-widget-root.fc-theme-minimal .fc-live-channel::after {
    content: attr(data-label);
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 11px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.fc-widget-root.fc-theme-minimal .fc-live-channel:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(-2px);
}

/* ═════════════════════════════════════════════════════════════════
   MODAL DE CHAT CON IA (PRO)
   ═════════════════════════════════════════════════════════════════ */
#landingAiWindow {
    position: fixed;
    right: 24px;
    bottom: 96px;
    z-index: 10000;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 460px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px) scale(0.95);
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}
#landingAiWindow.fc-ai-open {
    opacity: 1;
    pointer-events: all;
    transform: translateY(0) scale(1);
}
.fc-ai-header {
    background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.fc-ai-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}
.fc-ai-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}
.fc-ai-msg--user {
    align-self: flex-end;
}
.fc-ai-msg--user .fc-ai-bubble {
    background: #4f46e5;
    color: #fff;
    border-radius: 16px 16px 4px 16px;
}
.fc-ai-msg--bot {
    align-self: flex-start;
}
.fc-ai-msg--bot .fc-ai-bubble {
    background: #ffffff;
    color: #1e293b;
    border-radius: 16px 16px 16px 4px;
    border: 1px solid #e2e8f0;
}
.fc-ai-bubble {
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.45;
}
.fc-ai-wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    background: #25D366;
    color: #fff !important;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.fc-ai-footer {
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e2e8f0;
}
.fc-ai-input-wrap {
    display: flex;
    gap: 8px;
}
.fc-ai-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    color: #1e293b;
}
.fc-ai-input:focus {
    border-color: #4f46e5;
}
.fc-ai-send-btn {
    background: #4f46e5;
    color: #fff;
    border: none;
    border-radius: 10px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
