/* ==========================================================================
   WP FACEBOOK-STYLE LIVE CHAT - FRONTEND STYLES (DARKSTYLE & RESPONSIVE)
   ========================================================================== */

:root {
    --wpfb-primary: #0084ff;
    --wpfb-primary-hover: #0073e6;
    --wpfb-bg-dock: rgba(24, 25, 26, 0.95);
    --wpfb-bg-window: #242526;
    --wpfb-bg-surface: #3a3b3c;
    --wpfb-bg-surface-hover: #4e4f50;
    --wpfb-text-main: #e4e6eb;
    --wpfb-text-muted: #b0b3b8;
    --wpfb-border: rgba(255, 255, 255, 0.1);
    --wpfb-msg-in: #3a3b3c;
    --wpfb-msg-out: var(--wpfb-primary);
    --wpfb-green: #31a24c;
    --wpfb-red: #fa383e;
    --wpfb-radius-lg: 12px;
    --wpfb-radius-md: 8px;
    --wpfb-radius-pill: 24px;
    --wpfb-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --wpfb-shadow: 0 12px 28px 0 rgba(0, 0, 0, 0.4), 0 2px 4px 0 rgba(0, 0, 0, 0.2);
}

/* Base Root Container */
#wpfb-chat-root {
    font-family: var(--wpfb-font);
    font-size: 14px;
    line-height: 1.4;
    color: var(--wpfb-text-main);
    box-sizing: border-box;
    z-index: 999990;
    position: relative;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* OCULTAR CHAT CUANDO GV-OVERLAY ESTÁ ACTIVO Y VOLVER A MOSTRAR AL DESACTIVAR */
body:has(.gv-overlay.active) #wpfb-chat-root,
body:has(.gv-overlay.is-active) #wpfb-chat-root,
body:has(.gv-overlay.show) #wpfb-chat-root,
body:has(.gv-overlay.open) #wpfb-chat-root,
body:has([class*="gv-overlay"].active) #wpfb-chat-root,
body:has([class*="gv-overlay"].is-active) #wpfb-chat-root,
body:has([class*="gv-overlay"].show) #wpfb-chat-root,
body:has([class*="gv-overlay"].open) #wpfb-chat-root,
#wpfb-chat-root.wpfb-hidden-by-overlay {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#wpfb-chat-root * {
    box-sizing: border-box;
}

/* ==========================================================================
   1. BARRA INFERIOR FLOTANTE (DOCK BAR)
   ========================================================================== */
.wpfb-dock-bar {
    position: fixed;
    bottom: 0;
    right: 24px;
    height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    background: var(--wpfb-bg-dock);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--wpfb-border);
    border-bottom: none;
    border-top-left-radius: var(--wpfb-radius-lg);
    border-top-right-radius: var(--wpfb-radius-lg);
    box-shadow: var(--wpfb-shadow);
    z-index: 999999;
}

.wpfb-dock-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: transparent;
    border: none;
    outline: none;
    color: var(--wpfb-text-main);
    padding: 0 11px;
    height: 32px;
    line-height: 1;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--wpfb-radius-pill);
    cursor: pointer;
    transition: background 0.18s ease, transform 0.1s ease;
    user-select: none;
    white-space: nowrap;
    box-sizing: border-box;
    vertical-align: middle;
}

.wpfb-dock-btn:hover {
    background: var(--wpfb-bg-surface);
}

.wpfb-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.wpfb-btn-icon svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.wpfb-btn-label {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    white-space: nowrap;
}

.wpfb-dock-main-btn {
    position: relative;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.wpfb-dock-main-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.wpfb-dock-dms-btn {
    position: relative;
}

.wpfb-label-full {
    display: inline;
}

.wpfb-label-short {
    display: none;
}

.wpfb-show-mobile {
    display: none !important;
}

.wpfb-live-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(49, 162, 76, 0.22);
    border: 1px solid rgba(49, 162, 76, 0.45);
    padding: 0 7px;
    border-radius: 12px;
    height: 20px;
    line-height: 1;
    margin-left: 2px;
    box-sizing: border-box;
}

.wpfb-pulse-dot {
    width: 6px;
    height: 6px;
    min-width: 6px;
    background: var(--wpfb-green);
    border-radius: 50%;
    animation: wpfb-pulse 1.8s infinite;
    flex-shrink: 0;
}

@keyframes wpfb-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(49, 162, 76, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 5px rgba(49, 162, 76, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(49, 162, 76, 0); }
}

.wpfb-online-count {
    font-size: 11px;
    font-weight: 700;
    color: #4ade80;
    line-height: 1;
}

.wpfb-unread-badge {
    background: var(--wpfb-red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 0 5px;
    height: 16px;
    min-width: 16px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-sizing: border-box;
}

/* Pestañas del dock */
.wpfb-dock-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 32px;
}

.wpfb-dock-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--wpfb-bg-surface);
    color: var(--wpfb-text-main);
    border: 1px solid var(--wpfb-border);
    padding: 0 10px;
    height: 32px;
    line-height: 1;
    border-radius: var(--wpfb-radius-pill);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    box-sizing: border-box;
    max-width: 160px;
    transition: background 0.15s ease;
}

.wpfb-dock-tab:hover {
    background: var(--wpfb-bg-surface-hover);
}

.wpfb-dock-tab.is-active {
    background: var(--wpfb-primary);
    color: #fff;
    border-color: var(--wpfb-primary);
}

.wpfb-dock-tab img {
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    flex-shrink: 0;
}

.wpfb-dock-tab-title {
    display: inline-block;
    max-width: 75px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1;
}

.wpfb-dock-tab-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 14px;
    line-height: 1;
    margin-left: 2px;
    opacity: 0.7;
    cursor: pointer;
    border-radius: 50%;
}

.wpfb-dock-tab-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.25);
}

.wpfb-dock-spacer {
    flex: 1 1 10px;
}

/* Perfil de usuario en el dock */
.wpfb-dock-user-profile {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 0 10px;
    height: 32px;
    line-height: 1;
    border-radius: var(--wpfb-radius-pill);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.wpfb-dock-user-profile:hover {
    background: var(--wpfb-bg-surface);
    border-color: rgba(255, 255, 255, 0.15);
}

.wpfb-my-avatar-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.wpfb-user-avatar-sm {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wpfb-user-avatar-sm {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: #333;
}

.wpfb-my-avatar-wrapper .wpfb-user-status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--wpfb-green);
    border: 2px solid var(--wpfb-bg-dock);
}

.wpfb-user-name-sm {
    font-size: 12px;
    font-weight: 600;
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wpfb-user-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--wpfb-green);
}

/* ==========================================================================
   2. VENTANAS DE CHAT FLOTANTES (POPUP WINDOWS DOCKED)
   ========================================================================== */
.wpfb-toast-container {
    position: fixed;
    bottom: 58px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000002;
    pointer-events: none;
}

.wpfb-toast {
    pointer-events: auto;
    width: 310px;
    background: rgba(24, 25, 26, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0, 132, 255, 0.4);
    border-radius: var(--wpfb-radius-lg);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.55), 0 0 18px rgba(0, 132, 255, 0.2);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    animation: wpfb-toast-in 0.32s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.25s ease;
    position: relative;
    overflow: hidden;
}

.wpfb-toast:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.65), 0 0 24px rgba(0, 132, 255, 0.35);
    border-color: var(--wpfb-primary);
}

.wpfb-toast.is-hiding {
    animation: wpfb-toast-out 0.28s ease forwards;
}

@keyframes wpfb-toast-in {
    from { opacity: 0; transform: translateX(50px) scale(0.92); }
    to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes wpfb-toast-out {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to { opacity: 0; transform: translateX(40px) scale(0.9); }
}

.wpfb-toast-avatar-box {
    position: relative;
    flex-shrink: 0;
}

.wpfb-toast-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--wpfb-primary);
}

.wpfb-toast-badge {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: var(--wpfb-green);
    border: 2px solid var(--wpfb-bg-dock);
    border-radius: 50%;
}

.wpfb-toast-content {
    flex: 1;
    min-width: 0;
}

.wpfb-toast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2px;
}

.wpfb-toast-name {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wpfb-toast-pill {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(0, 132, 255, 0.2);
    color: var(--wpfb-primary);
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

.wpfb-toast-msg {
    font-size: 12px;
    color: var(--wpfb-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.wpfb-toast-close {
    background: transparent;
    border: none;
    color: var(--wpfb-text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0.6;
    transition: opacity 0.15s;
    flex-shrink: 0;
    align-self: flex-start;
}

.wpfb-toast-close:hover {
    opacity: 1;
    color: #fff;
}

.wpfb-toast-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--wpfb-primary), #00d2ff);
    animation: wpfb-toast-progress 5.5s linear forwards;
}

@keyframes wpfb-toast-progress {
    from { width: 100%; }
    to { width: 0%; }
}

@media (max-width: 768px) {
    .wpfb-toast-container {
        left: 12px;
        right: 12px;
        bottom: 60px;
    }
    .wpfb-toast {
        width: 100%;
    }
}
.wpfb-chat-windows {
    position: fixed;
    bottom: 48px;
    right: 24px;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-end;
    gap: 14px;
    pointer-events: none;
    z-index: 999998;
}

.wpfb-chat-window {
    width: 360px;
    height: 460px;
    background: var(--wpfb-bg-window);
    border: 1px solid var(--wpfb-border);
    border-radius: var(--wpfb-radius-lg);
    box-shadow: var(--wpfb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
    animation: wpfb-slide-up 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes wpfb-slide-up {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.wpfb-chat-window.is-minimized {
    display: none;
}

/* Cabecera de la ventana */
.wpfb-win-header {
    height: 46px;
    background: var(--wpfb-bg-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border-bottom: 1px solid var(--wpfb-border);
}

/* Notificación visual pulsante para respuestas privadas */
@keyframes wpfb-glow-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 132, 255, 0.7);
        filter: brightness(1);
    }
    50% {
        box-shadow: 0 0 16px 4px rgba(0, 132, 255, 0.95);
        filter: brightness(1.3);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(0, 132, 255, 0);
        filter: brightness(1);
    }
}

.wpfb-win-header.wpfb-header-flash {
    animation: wpfb-glow-pulse 1.1s infinite ease-in-out !important;
    background: linear-gradient(135deg, #0084ff, #0056b3) !important;
}

.wpfb-dock-tab.wpfb-tab-flash {
    animation: wpfb-glow-pulse 1.1s infinite ease-in-out !important;
    border-color: #0084ff !important;
}

.wpfb-win-userinfo {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.wpfb-win-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.wpfb-win-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--wpfb-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wpfb-win-status {
    font-size: 10px;
    color: var(--wpfb-green);
    display: flex;
    align-items: center;
    gap: 3px;
}

.wpfb-win-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.wpfb-icon-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--wpfb-text-muted);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wpfb-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Área de mensajes y contenedor con scroll inteligente */
.wpfb-win-messages-wrap {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.wpfb-scroll-bottom-btn {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--wpfb-primary);
    color: #ffffff;
    border: none;
    outline: none;
    padding: 5px 14px;
    border-radius: var(--wpfb-radius-pill);
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    z-index: 10;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    user-select: none;
    animation: wpfb-toast-in 0.2s ease;
}

.wpfb-scroll-bottom-btn:hover {
    background: var(--wpfb-primary-hover);
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}

.wpfb-win-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--wpfb-bg-window);
    scroll-behavior: smooth;
}

.wpfb-win-messages::-webkit-scrollbar {
    width: 6px;
}
.wpfb-win-messages::-webkit-scrollbar-thumb {
    background: var(--wpfb-bg-surface);
    border-radius: 4px;
}

.wpfb-welcome-notice {
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed var(--wpfb-border);
    border-radius: var(--wpfb-radius-md);
    padding: 8px 10px;
    font-size: 11px;
    color: var(--wpfb-text-muted);
    text-align: center;
    margin-bottom: 6px;
}

/* Indicador de carga de mensajes anteriores */
.wpfb-loading-older {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px 12px;
    margin: 4px auto 8px auto;
    font-size: 11.5px;
    color: var(--wpfb-text-muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--wpfb-border);
    border-radius: var(--wpfb-radius-pill);
    width: fit-content;
    align-self: center;
    user-select: none;
    pointer-events: none;
}

.wpfb-mini-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--wpfb-primary);
    border-radius: 50%;
    animation: wpfb-spin 0.7s linear infinite;
}

@keyframes wpfb-spin {
    to { transform: rotate(360deg); }
}

/* Burbujas de mensaje */
.wpfb-msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 85%;
}

.wpfb-msg-row.wpfb-msg-in {
    align-self: flex-start;
}

.wpfb-msg-row.wpfb-msg-out {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.wpfb-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.wpfb-msg-in .wpfb-msg-avatar:hover {
    transform: scale(1.15);
    box-shadow: 0 0 8px var(--wpfb-primary);
}

.wpfb-my-msg-avatar {
    cursor: default;
}
.wpfb-my-msg-avatar:hover {
    transform: none;
    box-shadow: none;
}

/* Estilos especiales para el mensaje de Publicidad (Sin avatar y centrado) */
.wpfb-msg-row.wpfb-msg-ad {
    max-width: 100% !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 14px 0 10px 0 !important;
    padding: 0 !important;
    align-self: center !important;
}

.wpfb-msg-row.wpfb-msg-ad .wpfb-ad-body {
    max-width: 100% !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

.wpfb-msg-sender-ad {
    cursor: default !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    margin-bottom: 6px !important;
}

.wpfb-ad-sender-name {
    font-size: 11px !important;
    font-weight: 700 !important;
    color: var(--wpfb-text-muted, #94a3b8) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

.wpfb-ad-badge {
    background: rgba(255, 152, 0, 0.18) !important;
    color: #ff9800 !important;
    border: 1px solid rgba(255, 152, 0, 0.35) !important;
    font-size: 9.5px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    padding: 1px 6px !important;
    border-radius: 4px !important;
}

.wpfb-ad-bubble {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    max-width: 100% !important;
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.wpfb-ad-slot-container {
    width: 300px;
    min-width: 300px;
    min-height: 250px;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.wpfb-ad-slot-container iframe,
.wpfb-ad-slot-container ins {
    margin: 0 auto !important;
    display: block !important;
}

.wpfb-ad-time {
    margin-top: 4px !important;
    font-size: 10px !important;
    color: var(--wpfb-text-muted, #94a3b8) !important;
    text-align: center !important;
}

.wpfb-msg-body {
    display: flex;
    flex-direction: column;
}

.wpfb-msg-sender {
    font-size: 11px;
    font-weight: 600;
    color: #b0b3b8;
    margin-bottom: 3px;
    padding-left: 2px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: color 0.15s ease;
    user-select: none;
    width: fit-content;
}

.wpfb-msg-in .wpfb-msg-sender:hover {
    color: var(--wpfb-primary);
    text-decoration: underline;
}

.wpfb-msg-sender-tag {
    font-size: 9px;
    font-weight: 600;
    color: var(--wpfb-primary);
    background: rgba(0, 132, 255, 0.15);
    border: 1px solid rgba(0, 132, 255, 0.25);
    padding: 0 5px;
    border-radius: 8px;
    line-height: 14px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    transition: background 0.15s ease, color 0.15s ease;
}

.wpfb-msg-in .wpfb-msg-sender:hover .wpfb-msg-sender-tag {
    background: var(--wpfb-primary);
    color: #ffffff;
}

.wpfb-msg-out .wpfb-msg-sender {
    display: none;
}

/* Envoltorio de burbuja y acción de responder */
.wpfb-msg-bubble-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.wpfb-msg-out .wpfb-msg-bubble-wrap {
    flex-direction: row-reverse;
}

/* Botón discreto de responder (hover en escritorio, visible en móvil) */
.wpfb-msg-reply-btn {
    opacity: 0;
    pointer-events: none;
    background: var(--wpfb-bg-surface);
    border: 1px solid var(--wpfb-border);
    color: var(--wpfb-text-muted);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.15s ease, background 0.15s ease, transform 0.15s ease;
    flex-shrink: 0;
    padding: 0;
}

.wpfb-msg-row:hover .wpfb-msg-reply-btn {
    opacity: 1;
    pointer-events: auto;
}

.wpfb-msg-reply-btn:hover {
    color: #ffffff;
    background: var(--wpfb-primary);
    border-color: var(--wpfb-primary);
    transform: scale(1.12);
}

@media (max-width: 768px) {
    .wpfb-msg-reply-btn {
        opacity: 0.65;
        pointer-events: auto;
    }
}

.wpfb-msg-bubble {
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 13px;
    word-break: break-word;
    position: relative;
    line-height: 1.35;
    transition: box-shadow 0.2s ease;
}

/* Estilo del bloque citado dentro de la burbuja */
.wpfb-msg-quote {
    background: rgba(0, 0, 0, 0.22);
    border-left: 3px solid var(--wpfb-primary);
    border-radius: var(--wpfb-radius-sm, 4px);
    padding: 4px 8px;
    margin-bottom: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s ease;
    max-width: 100%;
    overflow: hidden;
    user-select: none;
}

.wpfb-msg-out .wpfb-msg-quote {
    background: rgba(0, 0, 0, 0.25);
    border-left-color: rgba(255, 255, 255, 0.85);
}

.wpfb-msg-quote:hover {
    background: rgba(0, 0, 0, 0.35);
}

.wpfb-quote-sender {
    display: block;
    font-weight: 700;
    color: var(--wpfb-primary);
    margin-bottom: 2px;
    font-size: 10.5px;
}

.wpfb-msg-out .wpfb-quote-sender {
    color: #ffffff;
}

.wpfb-quote-text {
    display: block;
    color: var(--wpfb-text-muted);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.wpfb-msg-out .wpfb-quote-text {
    color: rgba(255, 255, 255, 0.85);
}

/* Barra flotante de respuesta arriba del input */
.wpfb-reply-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--wpfb-bg-surface);
    border-top: 1px solid var(--wpfb-border);
    border-left: 3px solid var(--wpfb-primary);
    border-radius: var(--wpfb-radius-sm, 4px) var(--wpfb-radius-sm, 4px) 0 0;
    padding: 6px 10px;
    margin-bottom: 6px;
    animation: wpfb-toast-in 0.18s ease;
}

.wpfb-reply-bar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    flex: 1;
}

.wpfb-reply-bar-icon {
    color: var(--wpfb-primary);
    flex-shrink: 0;
}

.wpfb-reply-bar-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-align: left;
}

.wpfb-reply-bar-sender {
    font-size: 11px;
    font-weight: 700;
    color: var(--wpfb-primary);
}

.wpfb-reply-bar-snippet {
    font-size: 11px;
    color: var(--wpfb-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.wpfb-reply-bar-close {
    background: none;
    border: none;
    color: var(--wpfb-text-muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 50%;
    transition: color 0.15s ease;
}

.wpfb-reply-bar-close:hover {
    color: #ff4d4f;
}

/* Destello / resaltado suave al hacer clic en un mensaje citado */
@keyframes wpfb-msg-pulse-highlight {
    0% { transform: scale(1.02); box-shadow: 0 0 0 3px var(--wpfb-primary); }
    50% { transform: scale(1.04); box-shadow: 0 0 16px var(--wpfb-primary); }
    100% { transform: scale(1); box-shadow: none; }
}

.wpfb-msg-highlight .wpfb-msg-bubble {
    animation: wpfb-msg-pulse-highlight 1.6s ease-in-out;
}

.wpfb-msg-in .wpfb-msg-bubble {
    background: var(--wpfb-msg-in);
    color: var(--wpfb-text-main);
    border-bottom-left-radius: 4px;
}

.wpfb-msg-out .wpfb-msg-bubble {
    background: var(--wpfb-msg-out);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.wpfb-msg-time {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 3px;
    align-self: flex-end;
}

.wpfb-msg-in .wpfb-msg-time {
    color: var(--wpfb-text-muted);
}

/* Archivos multimedia dentro del chat */
.wpfb-media-preview-img {
    max-width: 220px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
    margin-top: 4px;
    transition: transform 0.15s ease;
}

.wpfb-media-preview-img:hover {
    transform: scale(1.02);
}

.wpfb-media-audio {
    width: 200px;
    height: 36px;
    margin-top: 4px;
}

.wpfb-media-video {
    max-width: 220px;
    border-radius: 8px;
    margin-top: 4px;
}

/* Vista previa y Miniaturas de Video (Ultra-optimizado con thumbnail) */
.wpfb-video-preview {
    position: relative;
    max-width: 220px;
    max-height: 200px;
    min-width: 140px;
    min-height: 100px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.wpfb-video-preview:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.wpfb-video-thumb-img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: cover;
    display: block;
    background: #111;
}

.wpfb-video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.28);
    transition: background 0.2s ease;
}

.wpfb-video-preview:hover .wpfb-video-play-overlay {
    background: rgba(0, 0, 0, 0.12);
}

.wpfb-video-play-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
    border: 2px solid rgba(255, 255, 255, 0.85);
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.wpfb-video-play-icon svg {
    margin-left: 3px;
    display: block;
}

.wpfb-video-preview:hover .wpfb-video-play-icon {
    transform: scale(1.12);
    background: var(--wpfb-primary, #0084ff);
    border-color: #ffffff;
}

.wpfb-video-badge {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.72);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
    pointer-events: none;
    letter-spacing: 0.3px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* Barra de entrada de texto e inputs */
.wpfb-win-footer {
    padding: 8px 10px;
    background: var(--wpfb-bg-surface);
    border-top: 1px solid var(--wpfb-border);
}

.wpfb-input-box {
    display: flex;
    align-items: center;
    background: var(--wpfb-bg-window);
    border-radius: var(--wpfb-radius-pill);
    padding: 2px 6px;
    border: 1px solid var(--wpfb-border);
    transition: border-color 0.15s;
}

.wpfb-input-box:focus-within {
    border-color: var(--wpfb-primary);
}

.wpfb-chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--wpfb-text-main);
    padding: 8px 8px;
    font-size: 13px;
    min-width: 0;
}

.wpfb-chat-input::placeholder {
    color: var(--wpfb-text-muted);
}

.wpfb-footer-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

.wpfb-action-btn {
    background: transparent;
    border: none;
    outline: none;
    color: var(--wpfb-text-muted);
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, color 0.15s;
}

.wpfb-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.wpfb-btn-send {
    color: var(--wpfb-primary);
}
.wpfb-btn-send:hover {
    color: var(--wpfb-primary-hover);
}

/* Barra de progreso de subida multimedia en el chat */
.wpfb-media-progress-wrap {
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--wpfb-border);
    border-radius: var(--wpfb-radius-sm);
    margin-bottom: 6px;
    animation: wpfb-toast-in 0.2s ease;
}
.wpfb-media-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--wpfb-text);
}
.wpfb-media-progress-pct {
    color: var(--wpfb-primary);
    font-family: monospace;
    font-weight: 700;
}
.wpfb-media-progress-track {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    overflow: hidden;
}
.wpfb-media-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--wpfb-primary), #00d2ff);
    border-radius: 4px;
    transition: width 0.15s ease;
}

/* Grabadora de Notas de Voz */
.wpfb-recording-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(250, 56, 62, 0.12);
    border: 1px solid rgba(250, 56, 62, 0.3);
    border-radius: var(--wpfb-radius-pill);
    padding: 4px 10px;
    color: var(--wpfb-red);
    font-size: 12px;
    font-weight: 600;
}

.wpfb-rec-pulse {
    width: 10px;
    height: 10px;
    background: var(--wpfb-red);
    border-radius: 50%;
    animation: wpfb-pulse-red 1.2s infinite;
}

@keyframes wpfb-pulse-red {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(250, 56, 62, 0.7); }
    70% { transform: scale(1.15); box-shadow: 0 0 0 6px rgba(250, 56, 62, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(250, 56, 62, 0); }
}

/* ==========================================================================
   3. PANEL DE USUARIOS CONECTADOS
   ========================================================================== */
.wpfb-flyout-panel {
    position: fixed;
    bottom: 50px;
    right: 24px;
    width: 290px;
    max-height: 420px;
    background: var(--wpfb-bg-window);
    border: 1px solid var(--wpfb-border);
    border-radius: var(--wpfb-radius-lg);
    box-shadow: var(--wpfb-shadow);
    display: flex;
    flex-direction: column;
    z-index: 999999;
    overflow: hidden;
    animation: wpfb-slide-up 0.2s ease;
}

.wpfb-panel-header {
    padding: 10px 14px;
    background: var(--wpfb-bg-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--wpfb-border);
}

.wpfb-panel-title {
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--wpfb-text-main);
}
.wpfb-panel-title svg {
    color: var(--wpfb-green);
}

.wpfb-panel-close {
    background: transparent;
    border: none;
    color: var(--wpfb-text-muted);
    font-size: 18px;
    cursor: pointer;
}

.wpfb-panel-search {
    padding: 8px 12px;
    border-bottom: 1px solid var(--wpfb-border);
}

.wpfb-panel-search input {
    width: 100%;
    background: var(--wpfb-bg-surface);
    border: 1px solid var(--wpfb-border);
    border-radius: var(--wpfb-radius-pill);
    padding: 5px 10px;
    font-size: 12px;
    color: var(--wpfb-text-main);
    outline: none;
}

.wpfb-online-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.wpfb-user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    transition: background 0.15s;
    cursor: pointer;
}

.wpfb-user-row:hover {
    background: var(--wpfb-bg-surface);
}

.wpfb-user-row-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wpfb-user-row-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    position: relative;
}

.wpfb-user-row-name {
    font-size: 13px;
    font-weight: 600;
}

.wpfb-empty-state {
    padding: 20px 12px;
    text-align: center;
    color: var(--wpfb-text-muted);
    font-size: 12px;
}

/* Estilos de la lista de Mis Chats */
.wpfb-dm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-bottom: 1px solid var(--wpfb-border);
    cursor: pointer;
    transition: background 0.15s ease;
}

.wpfb-dm-row:hover {
    background: var(--wpfb-bg-surface-hover);
}

.wpfb-dm-status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 9px;
    height: 9px;
    background: #64748b;
    border: 2px solid var(--wpfb-bg-window);
    border-radius: 50%;
}

.wpfb-dm-status-dot.is-online {
    background: var(--wpfb-green);
}

.wpfb-dm-time {
    font-size: 10px;
    color: var(--wpfb-text-muted);
    margin-left: 6px;
    flex-shrink: 0;
}

.wpfb-dm-preview {
    font-size: 11px;
    color: var(--wpfb-text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 145px;
    margin-top: 2px;
}

.wpfb-dm-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 8px;
}

.wpfb-btn-delete-dm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.28);
    color: #f87171;
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, transform 0.12s;
    line-height: 1;
    flex-shrink: 0;
}

.wpfb-btn-delete-dm:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
    transform: scale(1.08);
}

.wpfb-btn-delete-dm svg {
    display: block;
    width: 13px;
    height: 13px;
    fill: currentColor;
}

/* ==========================================================================
   4. MODAL DE EDICIÓN DE PERFIL
   ========================================================================== */
.wpfb-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000;
    padding: 16px;
    box-sizing: border-box;
    overflow-y: auto;
}

.wpfb-modal-box {
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    background: var(--wpfb-bg-window);
    border: 1px solid var(--wpfb-border);
    border-radius: var(--wpfb-radius-lg);
    box-shadow: var(--wpfb-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: wpfb-slide-up 0.2s ease;
    margin: auto;
}

.wpfb-modal-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--wpfb-bg-surface);
    border-bottom: 1px solid var(--wpfb-border);
}

.wpfb-modal-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--wpfb-text-main);
}

.wpfb-modal-close {
    background: transparent;
    border: none;
    font-size: 20px;
    line-height: 1;
    color: var(--wpfb-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
}

.wpfb-modal-close:hover {
    color: var(--wpfb-text-main);
    background: rgba(255, 255, 255, 0.08);
}

.wpfb-modal-body {
    padding: 18px;
    overflow-y: auto;
    flex: 1 1 auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.wpfb-modal-body::-webkit-scrollbar {
    width: 6px;
}
.wpfb-modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.wpfb-profile-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.wpfb-profile-preview img {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 2px solid var(--wpfb-primary);
    object-fit: cover;
    flex-shrink: 0;
}

.wpfb-avatar-progress-container {
    width: 100%;
    margin-top: 6px;
    background: rgba(0, 0, 0, 0.25);
    padding: 6px 10px;
    border-radius: var(--wpfb-radius-md);
    border: 1px solid var(--wpfb-border);
}

.wpfb-avatar-progress-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.wpfb-avatar-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    border-radius: 4px;
    transition: width 0.2s ease;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.wpfb-avatar-progress-text {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #4ade80;
    text-align: right;
}

.wpfb-profile-tip {
    font-size: 12px;
    color: var(--wpfb-text-muted);
}

.wpfb-form-group {
    margin-bottom: 14px;
}

.wpfb-form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--wpfb-text-muted);
}

.wpfb-form-group input {
    width: 100%;
    background: var(--wpfb-bg-surface);
    border: 1px solid var(--wpfb-border);
    border-radius: var(--wpfb-radius-md);
    padding: 8px 12px;
    font-size: 13px;
    color: var(--wpfb-text-main);
    outline: none;
}

.wpfb-form-group small {
    display: block;
    font-size: 11px;
    color: var(--wpfb-text-muted);
    margin-top: 4px;
}

.wpfb-avatar-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 6px;
}

.wpfb-avatar-quick-actions {
    display: flex;
    gap: 6px;
}

.wpfb-btn-pill {
    background: var(--wpfb-bg-surface-alt, rgba(255, 255, 255, 0.08));
    color: var(--wpfb-text-main, #e4e6eb);
    border: 1px solid var(--wpfb-border, rgba(255, 255, 255, 0.15));
    border-radius: 16px;
    padding: 0 12px;
    height: 30px;
    min-height: 30px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    gap: 5px;
    box-sizing: border-box;
    vertical-align: middle;
    margin: 0;
}

.wpfb-btn-pill:hover {
    background: var(--wpfb-primary);
    color: #ffffff;
    border-color: var(--wpfb-primary);
    transform: translateY(-1px);
}

.wpfb-btn-pill.is-active {
    background: var(--wpfb-primary);
    color: #ffffff;
    border-color: var(--wpfb-primary);
}

.wpfb-avatar-picker {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    gap: 8px;
    max-height: 155px;
    overflow-y: auto;
    padding: 6px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--wpfb-border, rgba(255, 255, 255, 0.1));
    border-radius: 8px;
}

.wpfb-avatar-picker::-webkit-scrollbar {
    width: 6px;
}
.wpfb-avatar-picker::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.wpfb-avatar-option {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
    object-fit: cover;
    background: #1e1e24;
}

.wpfb-avatar-option:hover {
    transform: scale(1.1);
}

.wpfb-avatar-option.is-selected {
    border-color: var(--wpfb-primary);
    box-shadow: 0 0 8px var(--wpfb-primary);
}

.wpfb-toon-customizer {
    margin-top: 10px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--wpfb-border, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    animation: wpfbFadeIn 0.2s ease-out;
}

.wpfb-customizer-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--wpfb-text-muted, #b0b3b8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wpfb-customizer-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 480px) {
    .wpfb-customizer-grid {
        grid-template-columns: 1fr;
    }
}

.wpfb-customizer-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wpfb-customizer-field label {
    font-size: 11px;
    font-weight: 500;
    color: var(--wpfb-text-muted, #b0b3b8);
}

.wpfb-custom-select {
    width: 100%;
    padding: 6px 8px;
    font-size: 12px;
    background: var(--wpfb-bg-surface, #242526);
    color: var(--wpfb-text-main, #e4e6eb);
    border: 1px solid var(--wpfb-border, rgba(255, 255, 255, 0.15));
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
}

.wpfb-custom-select:focus {
    border-color: var(--wpfb-primary);
}

.wpfb-modal-footer {
    flex-shrink: 0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    background: var(--wpfb-bg-surface);
    border-top: 1px solid var(--wpfb-border);
}

.wpfb-btn-primary, .wpfb-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0 20px;
    height: 38px;
    min-height: 38px;
    line-height: 1;
    border-radius: var(--wpfb-radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    box-sizing: border-box;
    vertical-align: middle;
    margin: 0;
    letter-spacing: 0.3px;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.wpfb-btn-primary {
    background: var(--wpfb-primary);
    color: #fff;
}
.wpfb-btn-primary:hover {
    background: var(--wpfb-primary-hover);
}

.wpfb-btn-secondary {
    background: transparent;
    color: var(--wpfb-text-muted);
}
.wpfb-btn-secondary:hover {
    color: var(--wpfb-text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   5. LIGHTBOX DE MEDIOS
   ========================================================================== */
.wpfb-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000001;
}

.wpfb-lightbox-close {
    position: absolute;
    top: 20px;
    right: 24px;
    font-size: 32px;
    color: #fff;
    background: transparent;
    border: none;
    cursor: pointer;
}

.wpfb-lightbox-content img, .wpfb-lightbox-content video {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: var(--wpfb-shadow);
}

/* ==========================================================================
   6. RESPONSIVIDAD PARA DISPOSITIVOS MÓVILES (ULTRA RESPONSIVE & TOUCH READY)
   ========================================================================== */
@media (max-width: 768px) {
    .wpfb-show-mobile {
        display: inline-flex !important;
    }

    .wpfb-hide-mobile {
        display: none !important;
    }

    .wpfb-label-full {
        display: none !important;
    }

    .wpfb-label-short {
        display: inline !important;
        font-weight: 700;
        font-size: 13px;
    }

    /* Barra inferior flotante en móvil */
    .wpfb-dock-bar {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        border-radius: 0 !important;
        border-left: none !important;
        border-right: none !important;
        justify-content: space-between !important;
        padding: 0 10px max(6px, env(safe-area-inset-bottom, 0px)) 10px !important;
        height: calc(50px + env(safe-area-inset-bottom, 0px)) !important;
        box-sizing: border-box !important;
        gap: 6px !important;
    }

    .wpfb-dock-btn {
        padding: 0 8px;
        height: 34px;
        font-size: 12px;
    }

    .wpfb-dock-tabs {
        max-width: 110px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .wpfb-dock-tabs::-webkit-scrollbar {
        display: none;
    }

    .wpfb-dock-user-profile {
        padding: 3px;
        background: transparent;
        border: none;
    }

    .wpfb-user-avatar-sm {
        width: 28px;
        height: 28px;
    }

    /* Ventana de chat en móvil: Pantalla Completa Táctil (App Nativa Feel) */
    .wpfb-chat-windows {
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        top: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        flex-direction: column !important;
        gap: 0 !important;
        margin: 0 !important;
        z-index: 1000000 !important;
        pointer-events: none;
    }

    .wpfb-chat-window {
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        pointer-events: auto !important;
        animation: wpfb-mobile-slide-up 0.24s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    @keyframes wpfb-mobile-slide-up {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .wpfb-win-header {
        height: 52px;
        padding: 0 12px;
        flex-shrink: 0;
        background: var(--wpfb-bg-surface);
    }

    .wpfb-btn-minimize {
        display: none !important;
    }

    .wpfb-btn-back {
        background: transparent;
        border: none;
        color: var(--wpfb-text-main);
        padding: 6px;
        margin-right: 4px;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }

    .wpfb-win-messages {
        padding: 12px 10px;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .wpfb-msg-row {
        max-width: 90%;
    }

    .wpfb-win-footer {
        padding: 8px 10px max(10px, env(safe-area-inset-bottom, 0px)) 10px;
        flex-shrink: 0;
    }

    /* Previene el zoom automático de iOS en inputs */
    .wpfb-chat-input {
        font-size: 16px !important;
        padding: 8px 10px;
    }

    .wpfb-action-btn {
        padding: 7px;
        min-width: 34px;
        min-height: 34px;
    }

    /* Panel de usuarios en móvil */
    .wpfb-flyout-panel {
        left: 0 !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        border: none !important;
        z-index: 1000001 !important;
        animation: wpfb-mobile-slide-up 0.24s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    .wpfb-panel-header {
        height: 52px;
        padding: 0 14px;
        flex-shrink: 0;
    }

    .wpfb-panel-close {
        font-size: 26px;
        padding: 6px 10px;
    }

    /* Notificación Toast en móvil */
    .wpfb-toast-container {
        left: 10px !important;
        right: 10px !important;
        bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .wpfb-toast {
        width: 100% !important;
    }
}

/* Premium touch targets, safe areas, and bounded mobile conversation tabs. */
.wpfb-chat-window, .wpfb-flyout-panel, .wpfb-modal-box { contain: layout paint; }
.wpfb-dock-bar { padding-bottom: env(safe-area-inset-bottom, 0px); }
.wpfb-chat-window { max-width: min(92vw, 380px); }
.wpfb-chat-input, #wpfb-search-users, #wpfb-input-name { min-height: 44px; }
.wpfb-avatar-option { border-radius: 50%; object-fit: cover; }
#wpfb-input-avatar-file { display: block; max-width: 100%; margin-top: 8px; color: var(--wpfb-text-muted); }
.wpfb-upload-avatar-label { display: block; margin-top: 14px; color: var(--wpfb-text-muted); }
@media (max-width: 768px) {
  .wpfb-chat-window { max-width: 100vw; }
  .wpfb-dock-tabs { flex: 1 1 auto; min-width: 0; max-width: 48vw; }
  .wpfb-dock-tab-title { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .wpfb-modal-box { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); margin: 12px auto; }
}
@media (prefers-reduced-motion: reduce) { #wpfb-chat-root *, #wpfb-chat-root *::before, #wpfb-chat-root *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
