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

:root {
    --color-bg-deep: #F5F6F8;
    --color-bg-card: rgba(255, 255, 255, 0.95);
    --color-border: #E2E8F0;
    --color-text-primary: #0B1120;
    --color-text-secondary: #6B7280;
    --color-neon-cyan: #8C1932;
    --color-neon-cyan-glow: rgba(140, 25, 50, 0.2);
    --color-neon-purple: #083285;
    --color-neon-gold: #E38F27;
    --sombra-card: 0 4px 24px rgba(8, 50, 133, 0.1);
}

#chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 340px;
    height: 400px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--color-border);
    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(108, 45, 158, 0.05);
    border-bottom: 1px solid var(--color-border);
    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: 'Nunito', sans-serif;
    font-weight: 800;
    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.05);
}

#chat-box::-webkit-scrollbar-thumb {
    background: rgba(108, 45, 158, 0.15);
    border-radius: 3px;
}

#chat-box::-webkit-scrollbar-thumb:hover {
    background: rgba(108, 45, 158, 0.25);
}

/* Mensaje individual */
.chat-message {
    margin-bottom: 4px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(108, 45, 158, 0.03);
    border: 1px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(108, 45, 158, 0.05);
    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: 700;
    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-purple);
}

.chat-message .nombre-usuario .badge-anfitrion {
    background: linear-gradient(135deg, var(--color-neon-purple), var(--color-neon-cyan));
    color: #ffffff;
    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(108, 45, 158, 0.02) !important;
    border: 1px solid var(--color-border) !important;
    border-left: 4px solid var(--color-text-secondary) !important;
    padding: 12px 15px;
    text-align: center;
    box-shadow: none;
}

.chat-message.sistema.inicio {
    background: #E0F7F4 !important;
    border-left-color: var(--color-neon-cyan) !important;
}

.chat-message.sistema.fin {
    background: #FFF8E1 !important;
    border-left-color: var(--color-neon-gold) !important;
}

.chat-message.sistema.ganador {
    background: #F3EBF9 !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: 700;
    color: var(--color-neon-purple);
    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(108, 45, 158, 0.03);
    border-top: 1px solid var(--color-border);
    gap: 8px;
}

#chat-message {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--color-border);
    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-purple);
}

#chat-send-btn {
    background: linear-gradient(135deg, var(--color-neon-purple) 0%, #7b35b3 100%);
    color: #ffffff;
    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 rgba(108, 45, 158, 0.2);
}

#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, var(--color-neon-purple), var(--color-neon-cyan));
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 8px 24px rgba(108, 45, 158, 0.15);
    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);
    }
}
