/* ==========================================================================
 * chat-widget.css — Widget de Chat Global Flotante
 * Rust México Norteño — Fase 1 (Navegación + Chat)
 * Autocontenido: no afecta estilos globales del sitio
 * ========================================================================== */

#chat-fab {
    position: fixed; bottom: 24px; right: 24px; z-index: 9998;
    width: 56px; height: 56px; border-radius: 50%;
    background-color: var(--rust-red, #cd412b); color: white;
    border: 2px solid rgba(255,255,255,0.2); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(205, 65, 43, 0.5);
    transition: transform 0.2s, box-shadow 0.2s;
}
#chat-fab:hover { transform: scale(1.1); box-shadow: 0 6px 28px rgba(205,65,43,0.7); }
#chat-fab .unread-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 20px; height: 20px; border-radius: 10px;
    background-color: #fff; color: var(--rust-red, #cd412b);
    font-size: 0.7rem; font-weight: bold; display: none;
    align-items: center; justify-content: center; padding: 0 5px;
    font-family: 'Roboto', sans-serif;
}

#chat-drawer {
    position: fixed; top: 0; right: 0; z-index: 9999;
    width: 340px; max-width: 90vw; height: 100vh;
    background-color: rgba(18,18,18,0.97);
    border-left: 2px solid var(--rust-red, #cd412b);
    backdrop-filter: blur(12px);
    display: flex; flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}
#chat-drawer.open { transform: translateX(0); }

.chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.1); flex-shrink: 0;
}
.chat-header h6 { color: white; margin: 0; font-family: 'Bebas Neue',sans-serif; letter-spacing: 1.5px; font-size: 1.1rem; }
.chat-header h6 i { color: var(--rust-red,#cd412b); margin-right: 6px; }
.chat-header .online-count { font-size: 0.7rem; color: #aaa; font-family: 'Roboto',sans-serif; letter-spacing: 0; }
.chat-close { background: none; border: none; color: #888; font-size: 1.2rem; cursor: pointer; padding: 4px; }
.chat-close:hover { color: var(--rust-red,#cd412b); }

.chat-messages {
    flex: 1; overflow-y: auto; padding: 12px 16px;
    display: flex; flex-direction: column; gap: 8px;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-thumb { background-color: rgba(255,255,255,0.15); border-radius: 2px; }

.chat-msg { display: flex; flex-direction: column; gap: 2px; animation: chatFadeIn 0.2s ease; }
@keyframes chatFadeIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:translateY(0)} }
.chat-msg .msg-author { font-size:0.75rem; font-weight:700; color:var(--rust-red,#cd412b); font-family:'Bebas Neue',sans-serif; letter-spacing:0.5px; }
.chat-msg .msg-text { font-size:0.85rem; color:#ddd; word-break:break-word; line-height:1.3; }
.chat-msg .msg-time { font-size:0.65rem; color:#666; }

.chat-typing { font-size:0.7rem; color:#888; font-style:italic; padding:0 16px 4px; min-height:18px; flex-shrink:0; }

.chat-input-area { padding:10px 12px; border-top:1px solid rgba(255,255,255,0.1); flex-shrink:0; }
.chat-input-area .input-group .form-control {
    background-color:rgba(255,255,255,0.08); border:1px solid rgba(255,255,255,0.15);
    color:white; font-size:0.85rem; border-radius:6px 0 0 6px;
}
.chat-input-area .input-group .form-control::placeholder { color:#666; }
.chat-input-area .input-group .form-control:focus {
    background-color:rgba(255,255,255,0.12); border-color:var(--rust-red,#cd412b); box-shadow:none;
}
.chat-input-area .btn-send {
    background-color:var(--rust-red,#cd412b); color:white; border:none;
    border-radius:0 6px 6px 0; padding:6px 14px; font-size:1rem;
}
.chat-input-area .btn-send:hover { background-color:#a33220; }

.chat-login-nudge { text-align:center; padding:8px; font-size:0.75rem; color:#888; }
.chat-login-nudge a { color:var(--rust-red,#cd412b); text-decoration:none; }

#chat-backdrop { position:fixed; inset:0; background:rgba(0,0,0,0.4); z-index:9998; display:none; }
#chat-backdrop.show { display:block; }


/* ── Emoji Picker ─────────────────────────────────────────────────────── */
.emoji-picker {
    background: rgba(20,20,20,0.95);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 6px;
    margin-bottom: 6px;
    max-height: 160px;
    overflow-y: auto;
}
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2px;
}
.emoji-item {
    background: none;
    border: none;
    font-size: 1.3rem;
    padding: 4px 2px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s;
    text-align: center;
}
.emoji-item:hover {
    background: rgba(255,255,255,0.15);
    transform: scale(1.2);
}
.btn-emoji {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: white;
    border-radius: 6px 0 0 6px;
    padding: 4px 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-emoji:hover {
    background: rgba(255,255,255,0.15);
}

/* ── Server Badge ────────────────────────────────────────────────────── */
.server-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 0.5px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-right: 4px;
    background: #2a2a2a;
    color: #FFD700;
    border: 1px solid rgba(255,215,0,0.3);
    vertical-align: middle;
}

@media (max-width:480px) {
    #chat-drawer { width:100vw; max-width:100vw; }
}
