/* Ivanivi Tools — Chat Flotante (frontend) */

.ivanivi-fc {
    position: fixed;
    bottom: var(--ivanivi-fc-bottom, 25px);
    z-index: var(--ivanivi-fc-zindex, 99999);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.ivanivi-fc-right { right: var(--ivanivi-fc-side, 25px); align-items: flex-end; }
.ivanivi-fc-left  { left:  var(--ivanivi-fc-side, 25px); align-items: flex-start; }

/* Oculto hasta que un trigger lo muestre */
.ivanivi-fc-waiting { display: none; }
.ivanivi-fc-visible { display: flex; animation: ivanivi-fc-in 0.35s ease-out; }

@keyframes ivanivi-fc-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------------- Botón principal ---------------- */
.ivanivi-fc-main {
    position: relative;
    width: var(--ivanivi-fc-size, 56px);
    height: var(--ivanivi-fc-size, 56px);
    border-radius: 50%;
    background: var(--ivanivi-fc-btn-bg, #6366f1);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    padding: 0;
    text-decoration: none;
    box-sizing: border-box;
}
.ivanivi-fc-main:hover {
    transform: scale(1.07);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}
.ivanivi-fc-icon {
    width: 58%;
    height: 58%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
.ivanivi-fc-icon svg { width: 100%; height: 100%; }
.ivanivi-fc-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    display: block;
}
.ivanivi-fc-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-45deg) scale(0.6);
}
.ivanivi-fc.open .ivanivi-fc-icon-open  { opacity: 0; transform: rotate(45deg) scale(0.6); }
.ivanivi-fc.open .ivanivi-fc-icon-close { opacity: 1; transform: rotate(0) scale(1); }

/* Badge de mensajes pendientes */
.ivanivi-fc-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 20px;
    background: var(--ivanivi-fc-badge-bg, #dc2626);
    color: var(--ivanivi-fc-badge-color, #fff);
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-sizing: border-box;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.ivanivi-fc.open .ivanivi-fc-badge,
.ivanivi-fc.badge-seen .ivanivi-fc-badge { display: none; }

/* ---------------- Lista de canales ---------------- */
.ivanivi-fc-channels {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: inherit;
    pointer-events: none;
}
.ivanivi-fc-channel {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(var(--ivanivi-fc-size, 56px) * 0.86);
    height: calc(var(--ivanivi-fc-size, 56px) * 0.86);
    border-radius: 50%;
    position: relative;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(10px) scale(0.85);
    transition: opacity 0.22s ease, transform 0.22s ease;
}
.ivanivi-fc.open .ivanivi-fc-channels { pointer-events: auto; }
.ivanivi-fc.open .ivanivi-fc-channel  { opacity: 1; transform: translateY(0) scale(1); }
.ivanivi-fc.open .ivanivi-fc-channel:nth-child(1) { transition-delay: 0.03s; }
.ivanivi-fc.open .ivanivi-fc-channel:nth-child(2) { transition-delay: 0.07s; }
.ivanivi-fc.open .ivanivi-fc-channel:nth-child(3) { transition-delay: 0.11s; }
.ivanivi-fc.open .ivanivi-fc-channel:nth-child(4) { transition-delay: 0.15s; }
.ivanivi-fc.open .ivanivi-fc-channel:nth-child(5) { transition-delay: 0.19s; }
.ivanivi-fc.open .ivanivi-fc-channel:nth-child(6) { transition-delay: 0.23s; }
.ivanivi-fc-channel:hover { transform: scale(1.1) !important; }
.ivanivi-fc-channel svg { width: 100%; height: 100%; display: block; }

/* Tooltip con el nombre del canal */
.ivanivi-fc-tooltip {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    font-size: 12.5px;
    font-weight: 500;
    padding: 5px 11px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}
.ivanivi-fc-right .ivanivi-fc-tooltip { right: calc(100% + 10px); }
.ivanivi-fc-left  .ivanivi-fc-tooltip { left:  calc(100% + 10px); }
.ivanivi-fc-channel:hover .ivanivi-fc-tooltip { opacity: 1; }

/* ---------------- Burbuja CTA ---------------- */
.ivanivi-fc-cta {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--ivanivi-fc-cta-bg, #fff);
    color: var(--ivanivi-fc-cta-color, #111827);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
    max-width: 240px;
    line-height: 1.4;
}
.ivanivi-fc.open .ivanivi-fc-cta,
.ivanivi-fc.cta-closed .ivanivi-fc-cta { display: none; }
.ivanivi-fc-cta-close {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
    font-size: 17px;
    line-height: 1;
    padding: 0 2px;
    flex-shrink: 0;
}
.ivanivi-fc-cta-close:hover { opacity: 1; }

/* ---------------- Efectos de atención ---------------- */
.ivanivi-fc-effect-pulse .ivanivi-fc-main { animation: ivanivi-fc-pulse 2.2s infinite; }
@keyframes ivanivi-fc-pulse {
    0%   { box-shadow: 0 6px 18px rgba(0,0,0,0.22), 0 0 0 0 var(--ivanivi-fc-btn-bg, #6366f1); }
    70%  { box-shadow: 0 6px 18px rgba(0,0,0,0.22), 0 0 0 14px rgba(0,0,0,0); }
    100% { box-shadow: 0 6px 18px rgba(0,0,0,0.22), 0 0 0 0 rgba(0,0,0,0); }
}

.ivanivi-fc-effect-bounce .ivanivi-fc-main { animation: ivanivi-fc-bounce 2.6s infinite; }
@keyframes ivanivi-fc-bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-9px); }
    60% { transform: translateY(-5px); }
}

.ivanivi-fc-effect-wobble .ivanivi-fc-main { animation: ivanivi-fc-wobble 3s infinite; }
@keyframes ivanivi-fc-wobble {
    0%, 100% { transform: rotate(0); }
    6%  { transform: rotate(-9deg); }
    12% { transform: rotate(8deg); }
    18% { transform: rotate(-6deg); }
    24% { transform: rotate(4deg); }
    30% { transform: rotate(0); }
}
/* El efecto se detiene al abrir para no molestar */
.ivanivi-fc.open .ivanivi-fc-main { animation: none; }

/* ---------------- Móvil ---------------- */
@media (max-width: 480px) {
    .ivanivi-fc-cta { max-width: 180px; font-size: 13px; }
}
