/**
 * ESTILOS DEL CHAT DE JUEGOS - PREMIUM DARK GLASSMORPHIC
 * Sistema de chat unificado para salas de bingo (5 Aciertos y Lineal)
 */

:root {
    --color-bg-deep: #0b0c10;
    --color-bg-card: rgba(20, 24, 33, 0.75);
    --color-border: rgba(255, 255, 255, 0.08);
    --color-text-primary: #ffffff;
    --color-text-secondary: #a0aec0;
    --color-neon-cyan: #00f2fe;
    --color-neon-cyan-glow: rgba(0, 242, 254, 0.3);
    --color-neon-purple: #9d4edd;
    --color-neon-gold: #ffb703;
    --sombra-card: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

#chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 340px;
    height: 400px;
    background: rgba(20, 24, 33, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 20px;
    box-shadow: var(--sombra-card);
    display: flex;
    flex-direction: column;
    z-index: 3000;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), height 0.3s;
}

#chat-container.minimized {
    height: 52px;
    transform: translateY(0);
}

/* Header del chat */
#chat-header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

#chat-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-text-primary);
}

#chat-status {
    width: 8px;
    height: 8px;
    background-color: var(--color-neon-cyan);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--color-neon-cyan);
    animation: chatPulse 2s infinite;
}

@keyframes chatPulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 6px var(--color-neon-cyan);
    }
    50% {
        opacity: 0.4;
        box-shadow: 0 0 2px var(--color-neon-cyan);
    }
}

#chat-controls {
    display: flex;
    gap: 8px;
}

.chat-control-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-control-btn:hover {
    color: var(--color-text-primary);
}

/* Caja de mensajes */
#chat-box {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: transparent;
}

#chat-box::-webkit-scrollbar {
    width: 6px;
}

#chat-box::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

#chat-box::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

#chat-box::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Mensaje individual */
.chat-message {
    margin-bottom: 4px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    animation: chatSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes chatSlideIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message .nombre-usuario {
    font-weight: 600;
    color: var(--color-text-primary);
    font-size: 0.85rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-message .nombre-usuario.anfitrion {
    color: var(--color-neon-cyan);
}

.chat-message .nombre-usuario .badge-anfitrion {
    background: linear-gradient(135deg, #ffb703, #fb8500);
    color: #0b0c10;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* Mensajes del sistema */
.chat-message.sistema {
    background: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.04) !important;
    border-left: 4px solid var(--color-text-secondary) !important;
    padding: 12px 15px;
    text-align: center;
    box-shadow: none;
}

.chat-message.sistema.inicio {
    background: rgba(0, 242, 254, 0.04) !important;
    border-left-color: var(--color-neon-cyan) !important;
}

.chat-message.sistema.fin {
    background: rgba(255, 183, 3, 0.04) !important;
    border-left-color: var(--color-neon-gold) !important;
}

.chat-message.sistema.ganador {
    background: rgba(157, 78, 221, 0.04) !important;
    border-left-color: var(--color-neon-purple) !important;
}

.chat-message.sistema .nombre-usuario {
    font-weight: 700;
    color: var(--color-text-primary);
    font-size: 0.8rem;
    margin-bottom: 5px;
    justify-content: center;
}

.chat-message.sistema .texto-mensaje {
    font-weight: 600;
    color: var(--color-neon-cyan);
    font-size: 0.95rem;
}

.chat-message.sistema .timestamp {
    display: none;
}

.chat-message .texto-mensaje {
    color: var(--color-text-primary);
    font-size: 0.9rem;
    word-wrap: break-word;
    line-height: 1.4;
}

.chat-message .timestamp {
    font-size: 0.7rem;
    color: var(--color-text-secondary);
    margin-top: 4px;
    text-align: right;
}

/* Mensaje vacío */
.chat-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-secondary);
}

.chat-empty p {
    margin: 8px 0;
    font-size: 0.85rem;
}

/* Formulario de envío */
#chat-form {
    display: flex;
    padding: 10px 14px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    gap: 8px;
}

#chat-message {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
    padding: 10px 14px;
    border-radius: 12px;
    outline: none;
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

#chat-message:focus {
    border-color: var(--color-neon-cyan);
}

#chat-send-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #0b0c10;
    border: none;
    padding: 0 16px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

#chat-send-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 0 10px var(--color-neon-cyan-glow);
}

#chat-send-btn:active {
    transform: scale(0.98);
}

#chat-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 991px) {
    #chat-container {
        width: calc(100% - 20px);
        right: 10px;
        bottom: 10px;
        height: 380px;
    }
}

/* Notificación de nuevo mensaje */
.chat-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: #0b0c10;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 8px 24px rgba(0, 242, 254, 0.25);
    animation: chatSlideInDown 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
}

@keyframes chatSlideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
