/* ==============================================
   XN Contact Widget — Frontend
   Burbuja estilo XNSidebar: círculo blanco 42px
   ============================================== */

/* ── Contenedor principal ─────────────────────
   pointer-events:none → el contenedor NO bloquea
   clics cuando el panel está cerrado.
   ─────────────────────────────────────────────*/
#xncw-widget {
    position: fixed;
    z-index: 9991;                  /* 1 por encima de XNSidebar (9990) */
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --xncw-label-color: #1f2937;
}

/* Cuando está cerrado, la burbuja sí que tiene pointer-events. El panel no. */
#xncw-widget.xncw-closed #xncw-panel {
        pointer-events: none !important;
        opacity: 0;
        transform: translateY(10px) scale(0.97);
        visibility: hidden;
}

#xncw-widget.xncw-right { right: 70px; bottom: 80px; }
#xncw-widget.xncw-left  { left:  24px; bottom: 80px; }

/* ── Burbuja — igual que XNSidebar ────────────*/
#xncw-bubble {
    pointer-events: auto;
    position: relative;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #ffffff;
    color: #374151;
    border: 1px solid #d1d5db;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    outline: none;
    user-select: none;
}

#xncw-bubble:hover {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
    transform: scale(1.06);
}

#xncw-bubble:active {
    transform: scale(0.93);
}

/* Estado abierto — fondo gris claro (igual que XNSidebar .xnv-open) */
#xncw-widget.xncw-open #xncw-bubble {
    background: #f3f4f6;
    border-color: #9ca3af;
}

/* Swap de icono al abrir */
#xncw-bubble .xncw-icon-main  { transition: opacity 0.18s ease, transform 0.18s ease; }
#xncw-bubble .xncw-icon-close {
    position: absolute;
    opacity: 0;
    transform: rotate(-45deg) scale(0.7);
    transition: opacity 0.18s ease, transform 0.18s ease;
    font-size: 13px;
}

#xncw-widget.xncw-open #xncw-bubble .xncw-icon-main  { opacity: 0; transform: rotate(45deg) scale(0.7); }
#xncw-widget.xncw-open #xncw-bubble .xncw-icon-close { opacity: 1; transform: rotate(0deg) scale(1); }

/* ── Badge de mensajes no leídos ───────────── */
#xncw-badge {
    display: none;
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    pointer-events: none;
    z-index: 1;
}

#xncw-badge.xncw-badge-visible {
    display: flex;
}

/* ── Panel de opciones ────────────────────────*/
#xncw-panel {
    position: absolute;
    bottom: calc(42px + 10px);
    width: 260px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
    border: 1px solid #e5e7eb;
    overflow: hidden;

    pointer-events: none;
    opacity: 0;
    transform: translateY(10px) scale(0.97);
    transform-origin: bottom right;
    transition: opacity 0.2s ease, transform 0.22s cubic-bezier(0.34, 1.3, 0.64, 1);
}

#xncw-widget.xncw-right #xncw-panel { right: 0; transform-origin: bottom right; }
#xncw-widget.xncw-left  #xncw-panel { left:  0; transform-origin: bottom left; }

#xncw-widget.xncw-open #xncw-panel {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ── Opciones dentro del panel ──────────────── */
.xncw-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    text-decoration: none;
    color: var(--xncw-label-color, #1f2937) !important;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    transition: background 0.13s ease;
    border-bottom: 1px solid #f3f4f6;
}

.xncw-option:last-child { border-bottom: none; }
.xncw-option:hover      { background: #f9fafb; }
.xncw-option:active     { background: #f3f4f6; }

.xncw-opt-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: background 0.13s, transform 0.13s;
}

.xncw-option:hover .xncw-opt-icon {
    background: #eef2ff;
    transform: scale(1.08);
}

.xncw-opt-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xncw-opt-arrow {
    font-size: 10px;
    color: #d1d5db;
    flex-shrink: 0;
    transition: transform 0.13s, color 0.13s;
}

.xncw-option:hover .xncw-opt-arrow {
    transform: translateX(3px);
    color: #9ca3af;
}

/* Resets para botones */
.xncw-option[type="button"],
.xncw-option button {
    border: none;
    background: transparent;
    padding: 12px 14px;
}

/* Badge visible/hidden states */
#xncw-badge.xncw-show {
    display: flex;
}
