/**
 * sp-chat-modal.css
 * SomosPadel Barcelona - White / Light Premium Modern Chat Experience
 * Responsive, mobile-first messaging UI with vibrant player colors & neon-lime accents.
 * Version: 2.1.0 Light
 */

:root {
    --sp-chat-bg: #f8fafc;
    --sp-chat-surface: #ffffff;
    --sp-chat-card-bg: #ffffff;
    --sp-chat-card-hover: #f1f5f9;
    --sp-chat-border: #e2e8f0;
    --sp-chat-border-active: #cbd5e1;
    --sp-chat-neon: #CCFF00;
    --sp-chat-neon-glow: rgba(204, 255, 0, 0.45);
    --sp-chat-text: #0f172a;
    --sp-chat-muted: #64748b;
    --sp-chat-subtle: #94a3b8;
    --sp-chat-other-bubble: #ffffff;
    --sp-chat-other-border: #e2e8f0;
    --sp-chat-self-bubble: #dcf8c6;
    --sp-chat-self-border: #c8ebb0;
}

/* ═══════════════════════════════════════════════════════════════
   1. OVERLAY & CONTAINER (Responsive Mobile-First & Desktop Modal)
   ═══════════════════════════════════════════════════════════════ */
.sp-chat-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100050;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.25s;
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.sp-chat-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.sp-chat-window {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: var(--sp-chat-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
    transform: translateY(20px);
}

.sp-chat-backdrop.active .sp-chat-window {
    transform: translateY(0);
}

/* Tablet & Desktop Modal View */
@media (min-width: 640px) {
    .sp-chat-window {
        width: 100%;
        max-width: 480px;
        height: 88vh;
        max-height: 840px;
        border-radius: 24px;
        border: 1px solid var(--sp-chat-border);
        box-shadow: 0 25px 60px rgba(15, 23, 42, 0.2), 0 0 1px rgba(0, 0, 0, 0.1);
    }
}

/* ═══════════════════════════════════════════════════════════════
   2. HEADER & NAVIGATION
   ═══════════════════════════════════════════════════════════════ */
.sp-chat-header {
    background: var(--sp-chat-surface);
    border-bottom: 1px solid var(--sp-chat-border);
    padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.sp-chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.sp-chat-header-title-wrap {
    min-width: 0;
    flex: 1;
}

.sp-chat-header-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--sp-chat-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.2px;
    line-height: 1.25;
}

.sp-chat-header-sub {
    margin: 2px 0 0;
    font-size: 0.72rem;
    color: var(--sp-chat-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sp-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sp-chat-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px solid var(--sp-chat-border);
    color: var(--sp-chat-text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.sp-chat-icon-btn:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    color: #0f172a;
    transform: scale(1.04);
}

.sp-chat-icon-btn:active {
    transform: scale(0.94);
}

.sp-chat-details-btn {
    background: #0f172a;
    border: 1px solid #0f172a;
    color: var(--sp-chat-neon);
    padding: 6px 12px;
    border-radius: 14px;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.sp-chat-details-btn:hover {
    background: #000000;
    color: #CCFF00;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ═══════════════════════════════════════════════════════════════
   3. AVATARS & PRESENCE
   ═══════════════════════════════════════════════════════════════ */
.sp-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: #f1f5f9;
    border: 1.5px solid var(--sp-chat-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: var(--sp-chat-text);
    position: relative;
    flex-shrink: 0;
    overflow: hidden;
    font-weight: 800;
}

.sp-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sp-chat-avatar.event-avatar {
    background: #f0fdf4;
    border-color: #86efac;
    color: #15803d;
}

.sp-chat-online-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: #10b981;
    border: 2px solid var(--sp-chat-surface);
    box-shadow: 0 0 4px rgba(16, 185, 129, 0.5);
}

/* ═══════════════════════════════════════════════════════════════
   4. INBOX VIEW (Bandeja "Mis Mensajes")
   ═══════════════════════════════════════════════════════════════ */
.sp-chat-inbox-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: var(--sp-chat-bg);
}

.sp-chat-search-wrap {
    padding: 12px 16px 8px;
    position: relative;
}

.sp-chat-search-box {
    display: flex;
    align-items: center;
    background: #f8fafc;
    border: 1.5px solid var(--sp-chat-border);
    border-radius: 16px;
    padding: 0 12px 0 14px;
    height: 44px;
    transition: all 0.2s ease;
}

.sp-chat-search-box:focus-within {
    background: #ffffff;
    border-color: #CCFF00;
    box-shadow: 0 0 0 3px rgba(204, 255, 0, 0.25);
}

.sp-chat-search-box i {
    color: var(--sp-chat-muted);
    font-size: 0.85rem;
    margin-right: 10px;
}

.sp-chat-search-clear {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 6px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.sp-chat-search-clear:hover {
    color: #ef4444;
    transform: scale(1.1);
}

.sp-chat-search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--sp-chat-text);
    font-size: 0.88rem;
    font-family: inherit;
}

.sp-chat-search-input::placeholder {
    color: var(--sp-chat-subtle);
}

.sp-chat-tabs {
    display: flex;
    gap: 6px;
    padding: 4px;
    margin: 4px 16px 10px;
    background: #f1f5f9;
    border-radius: 16px;
    border: 1px solid var(--sp-chat-border);
}

.sp-chat-tab-pill {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.3px;
    background: transparent;
    border: none;
    color: var(--sp-chat-muted);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.sp-chat-tab-pill:hover {
    background: rgba(255, 255, 255, 0.6);
    color: var(--sp-chat-text);
}

.sp-chat-tab-pill.active {
    background: #0f172a;
    color: var(--sp-chat-neon);
    font-weight: 900;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.25);
}

.sp-chat-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    -webkit-overflow-scrolling: touch;
}

/* Chat Card Item */
.sp-chat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--sp-chat-card-bg);
    border: 1px solid var(--sp-chat-border);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    text-decoration: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.sp-chat-card:hover {
    background: var(--sp-chat-card-hover);
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.sp-chat-card:active {
    transform: scale(0.98);
}

.sp-chat-card-main {
    flex: 1;
    min-width: 0;
}

.sp-chat-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 3px;
}

.sp-chat-card-title {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--sp-chat-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sp-chat-card-time {
    font-size: 0.68rem;
    color: var(--sp-chat-muted);
    font-weight: 600;
    flex-shrink: 0;
}

.sp-chat-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.sp-chat-card-preview {
    font-size: 0.78rem;
    color: var(--sp-chat-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.sp-chat-card-preview strong {
    color: var(--sp-chat-text);
    font-weight: 700;
}

/* Badges */
.sp-unread-badge,
.sp-unread-chat-badge {
    background: var(--sp-chat-neon);
    color: #0a0f1d;
    font-size: 0.68rem;
    font-weight: 950;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.08);
    line-height: 1;
}

/* Header notif button badge placement */
.header-notif-btn .sp-unread-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    font-size: 0.62rem;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
}

/* Empty State */
.sp-chat-empty {
    margin: auto;
    text-align: center;
    padding: 40px 24px;
    color: var(--sp-chat-muted);
}

.sp-chat-empty-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: #f1f5f9;
    border: 1px dashed var(--sp-chat-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: var(--sp-chat-muted);
    margin: 0 auto 16px;
}

.sp-chat-empty-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--sp-chat-text);
    margin-bottom: 6px;
}

.sp-chat-empty-desc {
    font-size: 0.78rem;
    color: var(--sp-chat-muted);
    max-width: 260px;
    margin: 0 auto;
    line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════
   5. CHAT ROOM (Pantalla de Conversación Activa)
   ═══════════════════════════════════════════════════════════════ */
.sp-chat-room-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    background: var(--sp-chat-bg);
}

.sp-chat-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
    -webkit-overflow-scrolling: touch;
}

/* Date separator */
.sp-chat-date-separator {
    text-align: center;
    margin: 10px 0;
    position: relative;
}

.sp-chat-date-separator span {
    background: #ffffff;
    border: 1px solid var(--sp-chat-border);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--sp-chat-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Message Rows */
.sp-chat-msg-row {
    display: flex;
    gap: 8px;
    max-width: 84%;
    animation: spMsgPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes spMsgPop {
    from { opacity: 0; transform: translateY(6px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.sp-chat-msg-row.other {
    align-self: flex-start;
}

.sp-chat-msg-row.self {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.sp-chat-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: #f1f5f9;
    border: 1px solid var(--sp-chat-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--sp-chat-text);
    flex-shrink: 0;
    margin-top: auto;
    overflow: hidden;
}

.sp-chat-msg-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Bubbles */
.sp-chat-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 0.88rem;
    line-height: 1.45;
    position: relative;
    word-break: break-word;
}

.sp-chat-msg-row.other .sp-chat-bubble {
    background: var(--sp-chat-other-bubble);
    border: 1px solid var(--sp-chat-other-border);
    color: var(--sp-chat-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.sp-chat-msg-row.self .sp-chat-bubble {
    background: var(--sp-chat-self-bubble);
    border: 1px solid var(--sp-chat-self-border);
    color: var(--sp-chat-text);
    border-bottom-right-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Nombre de jugador diferenciado con colores */
.sp-chat-sender-name {
    font-size: 0.72rem;
    font-weight: 800;
    margin-bottom: 3px;
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.sp-chat-sender-name.admin {
    color: #d97706;
}

.sp-chat-msg-text {
    font-size: 0.88rem;
    color: var(--sp-chat-text);
}

.sp-chat-msg-time {
    font-size: 0.62rem;
    color: var(--sp-chat-subtle);
    font-weight: 600;
    margin-top: 4px;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}

.sp-chat-msg-row.self .sp-chat-msg-time {
    color: var(--sp-chat-muted);
}

/* Broadcast / Admin notice banner */
.sp-chat-system-notice {
    width: 100%;
    align-self: center;
    background: #fefce8;
    border: 1.5px solid #fde047;
    border-radius: 16px;
    padding: 10px 14px;
    text-align: center;
    margin: 4px 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.sp-chat-system-notice-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #ca8a04;
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 950;
    padding: 2px 8px;
    border-radius: 10px;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sp-chat-system-notice-text {
    font-size: 0.8rem;
    color: #713f12;
    font-weight: 600;
    line-height: 1.4;
}

/* Media attachments in bubble */
.sp-chat-msg-img {
    max-width: 100%;
    max-height: 220px;
    border-radius: 12px;
    margin-top: 6px;
    display: block;
    cursor: pointer;
    border: 1px solid var(--sp-chat-border);
    background: #f1f5f9;
}

/* ═══════════════════════════════════════════════════════════════
   6. DOCKED INPUT BAR (Mobile-friendly, Safe Area aware)
   ═══════════════════════════════════════════════════════════════ */
.sp-chat-dock {
    background: var(--sp-chat-surface);
    border-top: 1px solid var(--sp-chat-border);
    padding: 10px 12px calc(max(12px, env(safe-area-inset-bottom, 12px)));
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.03);
}

.sp-chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sp-chat-input-container {
    flex: 1;
    background: #f1f5f9;
    border: 1px solid var(--sp-chat-border);
    border-radius: 24px;
    display: flex;
    align-items: center;
    padding: 2px 14px;
    min-height: 44px;
    transition: all 0.2s ease;
}

.sp-chat-input-container:focus-within {
    background: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.06);
}

.sp-chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--sp-chat-text);
    font-size: 0.9rem;
    font-family: inherit;
    padding: 8px 0;
}

.sp-chat-input::placeholder {
    color: var(--sp-chat-subtle);
}

.sp-chat-attach-btn {
    background: transparent;
    border: none;
    color: var(--sp-chat-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
    outline: none;
}

.sp-chat-attach-btn:hover {
    color: var(--sp-chat-text);
}

.sp-chat-send-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: var(--sp-chat-neon);
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: #0a0f1d;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    flex-shrink: 0;
}

.sp-chat-send-btn:hover {
    transform: scale(1.06);
    background: #b8e600;
    box-shadow: 0 4px 14px rgba(204, 255, 0, 0.45);
}

.sp-chat-send-btn:active {
    transform: scale(0.92);
}

.sp-chat-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Attachment preview strip */
.sp-chat-preview-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8fafc;
    border: 1px solid var(--sp-chat-border);
    padding: 6px 10px;
    border-radius: 12px;
}

.sp-chat-preview-thumb {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    object-fit: cover;
    border: 1.5px solid #10b981;
}

.sp-chat-preview-info {
    flex: 1;
    font-size: 0.74rem;
    color: var(--sp-chat-text);
}

.sp-chat-preview-remove {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    transition: all 0.15s;
}

.sp-chat-preview-remove:hover {
    background: #ef4444;
    color: #ffffff;
}

/* ═══════════════════════════════════════════════════════════════
   7. EMBEDDED BUTTON HELPER (.sp-chat-btn)
   ═══════════════════════════════════════════════════════════════ */
.sp-chat-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: #0f172a;
    border: 1.5px solid #0f172a;
    color: var(--sp-chat-neon);
    padding: 8px 14px;
    border-radius: 14px;
    font-size: 0.8rem;
    font-weight: 850;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    text-decoration: none;
}

.sp-chat-btn:hover {
    background: var(--sp-chat-neon);
    color: #0a0f1d;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.sp-chat-btn:active {
    transform: scale(0.96);
}

.sp-chat-btn i {
    font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════════
   11. BOTONES DE ELIMINACIÓN DE MENSAJES Y CHATS
   ═══════════════════════════════════════════════════════════════ */
.sp-chat-card-delete-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.72rem;
    padding: 3px 6px;
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
    opacity: 0.65;
    outline: none;
}

.sp-chat-card-delete-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    opacity: 1;
    transform: scale(1.08);
}

.sp-chat-msg-delete-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.65rem;
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
    transition: all 0.15s ease;
    opacity: 0.55;
    outline: none;
}

.sp-chat-msg-delete-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
    opacity: 1;
    transform: scale(1.1);
}


/* Botón de borrado de moderación (solo visible para SuperAdmin/Admin en mensajes ajenos) */
.sp-chat-msg-delete-btn--mod {
    color: #ef4444;
    opacity: 0.7;
}
.sp-chat-msg-delete-btn--mod:hover {
    color: #b91c1c;
    opacity: 1;
    background: rgba(239, 68, 68, 0.15);
}

/* ─── BUSCADOR DE JUGADORES ─────────────────────────────── */
.sp-chat-player-results-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #0f172a;
    border: 1px solid rgba(204, 255, 0, 0.3);
    border-radius: 14px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
    padding: 4px 0;
}
.sp-chat-player-results-dropdown:empty { display: none; }

.sp-chat-player-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sp-chat-player-result:last-child { border-bottom: none; }
.sp-chat-player-result:hover { background: rgba(204, 255, 0, 0.07); }

.sp-chat-player-result-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 900;
    border: 1.5px solid rgba(204,255,0,0.35);
    background: #1e293b;
    color: #CCFF00;
}
.sp-chat-player-result-avatar img {
    width: 100%; height: 100%; object-fit: cover;
}

.sp-chat-player-result-info {
    flex: 1;
    min-width: 0;
}
.sp-chat-player-result-name {
    display: block;
    font-size: 0.82rem;
    font-weight: 800;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sp-chat-player-result-level {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: #CCFF00;
    margin-top: 1px;
}

.sp-chat-player-result-btn {
    background: rgba(56, 189, 248, 0.15);
    border: 1px solid rgba(56,189,248,0.3);
    color: #38bdf8;
    border-radius: 10px;
    padding: 7px 10px;
    font-size: 0.78rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s;
}
.sp-chat-player-result-btn:hover {
    background: rgba(56,189,248,0.28);
}

.sp-chat-no-players-found {
    text-align: center;
    padding: 16px;
    font-size: 0.78rem;
    color: #64748b;
    font-weight: 700;
}

/* ─── CARRUSEL HORIZONTAL: CONEXIÓN RÁPIDA (JUGADORES) ─── */
.sp-chat-quick-players-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 16px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.sp-chat-quick-players-bar::-webkit-scrollbar {
    display: none;
}

.sp-chat-quick-player-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
}
.sp-chat-quick-player-item:active {
    transform: scale(0.92);
}

.sp-chat-quick-player-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    position: relative;
    background: #0f172a;
    border: 2px solid #CCFF00;
    box-shadow: 0 0 10px rgba(204, 255, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #CCFF00;
    font-size: 1rem;
    font-weight: 900;
    overflow: visible;
}
.sp-chat-quick-player-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.sp-chat-quick-avatar-explore {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border: 2px dashed #CCFF00;
    color: #CCFF00;
    box-shadow: none;
}

.sp-chat-quick-player-badge {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #CCFF00;
    border: 1px solid #CCFF00;
    font-size: 0.58rem;
    font-weight: 900;
    padding: 1px 4px;
    border-radius: 6px;
    white-space: nowrap;
    letter-spacing: 0.2px;
}

.sp-chat-quick-player-name {
    font-size: 0.68rem;
    font-weight: 800;
    color: var(--sp-chat-text);
    max-width: 54px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

/* ─── BADGES EN PESTAÑAS (SEGMENTED CONTROL) ─────────────── */
.sp-chat-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 10px;
    background: #CCFF00;
    color: #0f172a;
    font-size: 0.62rem;
    font-weight: 900;
    line-height: 1;
    margin-left: 4px;
}

.sp-chat-tab-badge-highlight {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

/* ─── PADEL QUICK CHIPS (RESPUESTAS RÁPIDAS EN SALA DE CHAT) ─── */
.sp-chat-quick-replies {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}
.sp-chat-quick-replies::-webkit-scrollbar {
    display: none;
}

.sp-chat-quick-reply-chip {
    flex-shrink: 0;
    background: #f1f5f9;
    border: 1px solid var(--sp-chat-border);
    color: #0f172a;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
}
.sp-chat-quick-reply-chip:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}
.sp-chat-quick-reply-chip:active {
    transform: scale(0.95);
    background: #0f172a;
    color: #CCFF00;
}

/* ─── BOTÓN ACCIÓN RÁPIDA EMPTY STATE ───────────────────── */
.sp-chat-quick-start-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #CCFF00;
    border: 1.5px solid #CCFF00;
    padding: 10px 18px;
    border-radius: 14px;
    font-size: 0.80rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(204, 255, 0, 0.2);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.sp-chat-quick-start-btn:hover {
    background: #000000;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(204, 255, 0, 0.3);
}
.sp-chat-quick-start-btn:active {
    transform: scale(0.96);
}

/* ─── ANIMACIONES PULSO ──────────────────────────────────── */
@keyframes spLivePulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.sp-chat-live-pulse-dot {
    animation: spLivePulse 2s infinite cubic-bezier(0.4, 0, 0.6, 1);
}

.sp-chat-unread-pulse {
    animation: spLivePulse 2.5s infinite;
}

