/* Estilos para el Chat en Vivo de Zombie Revenge */

/* Hero del Chat (Efecto premium coincidente con Servidores/Top) */
.chat-hero {
    overflow: hidden;
    position: relative;
    padding: clamp(26px, 5vw, 58px);
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--panel);
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}

.chat-hero-glow {
    position: absolute;
    right: -90px;
    bottom: -120px;
    width: 330px;
    height: 330px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(115, 255, 88, 0.14), transparent 68%);
    pointer-events: none;
}

.chat-hero-content {
    position: relative;
    z-index: 2;
}

.chat-hero h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin: 10px 0 14px;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: var(--text);
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.chat-hero p {
    color: var(--muted);
    font-size: 1.1rem;
    max-width: 650px;
    margin: 0;
    line-height: 1.5;
}

/* Contenedor del Chat */
.chat-wrapper {
    margin-bottom: 50px;
}

.chat-panel {
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--panel-strong);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    height: 600px;
    overflow: hidden;
    backdrop-filter: blur(16px);
}

/* Cabecera del chat */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(113, 255, 91, 0.12);
    background: rgba(0, 0, 0, 0.3);
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pulse-indicator {
    width: 10px;
    height: 10px;
    background-color: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--green);
    animation: pulse 1.8s infinite alternate;
}

@keyframes pulse {
    0% {
        transform: scale(0.9);
        opacity: 0.6;
        box-shadow: 0 0 4px var(--green);
    }
    100% {
        transform: scale(1.1);
        opacity: 1;
        box-shadow: 0 0 12px var(--green);
    }
}

.status-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.chat-info-pill {
    font-size: 0.75rem;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 99px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Contenedor de los Mensajes */
.chat-messages-container {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
    background: radial-gradient(circle at 50% 50%, rgba(11, 15, 18, 0.4) 0%, rgba(7, 9, 12, 0.8) 100%);
}

/* Personalizar barra de scroll */
.chat-messages-container::-webkit-scrollbar {
    width: 6px;
}

.chat-messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages-container::-webkit-scrollbar-thumb {
    background: rgba(113, 255, 91, 0.15);
    border-radius: 4px;
}

.chat-messages-container::-webkit-scrollbar-thumb:hover {
    background: var(--border);
}

/* Spinner de Carga */
.chat-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--muted);
    gap: 14px;
}

.spinner {
    width: 38px;
    height: 38px;
    border: 3px solid rgba(113, 255, 91, 0.1);
    border-top: 3px solid var(--green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 10px rgba(115, 255, 88, 0.2);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--muted);
    text-align: center;
    opacity: 0.8;
}

.chat-empty-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 8px var(--green));
}

/* Mensajes individuales (Estructura de burbuja premium) */
.chat-msg-row {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    max-width: 82%;
    animation: slideInUp 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Si es nuestro propio mensaje */
.chat-msg-row.self {
    align-self: flex-end;
    align-items: flex-end;
}

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

/* Fila de metadatos */
.chat-msg-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 0.8rem;
}

.chat-msg-author {
    font-weight: 700;
    color: var(--text);
    transition: color 0.2s ease;
}

.chat-msg-time {
    color: rgba(255, 255, 255, 0.35);
    font-size: 0.72rem;
}

.chat-msg-badges {
    display: inline-flex;
    gap: 4px;
}

/* Burbuja del mensaje */
.chat-msg-bubble {
    padding: 12px 18px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #e5ebe4;
    font-size: 0.95rem;
    line-height: 1.45;
    word-break: break-word;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.chat-msg-row.self .chat-msg-bubble {
    border-top-left-radius: 18px;
    border-top-right-radius: 4px;
    background: rgba(115, 255, 88, 0.07);
    border: 1px solid rgba(115, 255, 88, 0.16);
    box-shadow: 0 4px 15px rgba(115, 255, 88, 0.03);
}

.chat-msg-bubble:hover {
    background-color: rgba(255, 255, 255, 0.07);
}

.chat-msg-row.self .chat-msg-bubble:hover {
    background-color: rgba(115, 255, 88, 0.1);
}

/* Badge de Rango del chat */
.chat-rank-badge {
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
}

/* Diseños Premium para Rangos */
/* 1. JEFE: Gold Glow */
.chat-author-jefe {
    color: var(--yellow) !important;
    text-shadow: 0 0 10px rgba(255, 233, 107, 0.45);
}
.chat-bubble-jefe {
    border-color: rgba(255, 233, 107, 0.3) !important;
    background: linear-gradient(135deg, rgba(255, 233, 107, 0.05), rgba(7, 9, 12, 0.6)) !important;
}

/* 2. ADMINISTRADOR: Red Glow */
.chat-author-admin, .chat-author-administrator {
    color: var(--red) !important;
    text-shadow: 0 0 10px rgba(255, 61, 61, 0.45);
}
.chat-bubble-admin, .chat-bubble-administrator {
    border-color: rgba(255, 61, 61, 0.25) !important;
    background: linear-gradient(135deg, rgba(255, 61, 61, 0.04), rgba(7, 9, 12, 0.6)) !important;
}

/* 3. SCRIPTER: Violet Glow */
.chat-author-scripter {
    color: #bb86fc !important;
    text-shadow: 0 0 10px rgba(187, 134, 252, 0.45);
}
.chat-bubble-scripter {
    border-color: rgba(187, 134, 252, 0.25) !important;
    background: linear-gradient(135deg, rgba(187, 134, 252, 0.04), rgba(7, 9, 12, 0.6)) !important;
}

/* 4. MODERADOR: Cyan Glow */
.chat-author-moderador, .chat-author-moderator {
    color: #03dac6 !important;
    text-shadow: 0 0 10px rgba(3, 218, 198, 0.45);
}

/* Barra de Acción de Envío (Formulario) */
.chat-action-bar {
    padding: 16px 24px;
    border-top: 1px solid rgba(113, 255, 91, 0.12);
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
}

.chat-loading-auth {
    text-align: center;
    color: var(--muted);
    font-size: 0.9rem;
    animation: pulseAuth 1.5s infinite ease-in-out;
}

@keyframes pulseAuth {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.chat-form {
    display: flex;
    gap: 12px;
    align-items: center;
    position: relative;
}

.chat-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.chat-input {
    width: 100%;
    min-height: 48px;
    padding: 12px 64px 12px 18px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(113, 255, 91, 0.15);
    border-radius: 99px;
    color: var(--text);
    outline: none;
    font-size: 0.95rem;
    transition: border-color 0.22s ease, background-color 0.22s ease, box-shadow 0.22s ease;
}

.chat-input:focus {
    border-color: var(--green);
    background: rgba(115, 255, 88, 0.02);
    box-shadow: 0 0 15px rgba(115, 255, 88, 0.12);
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

/* Contador de caracteres */
.chat-char-counter {
    position: absolute;
    right: 18px;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.22);
    pointer-events: none;
    user-select: none;
    transition: color 0.2s ease;
}

.chat-char-counter.warning {
    color: var(--yellow);
}

.chat-char-counter.danger {
    color: var(--red);
}

/* Botón de Enviar */
.chat-send-btn {
    min-height: 48px;
    width: 48px;
    padding: 0;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(115, 255, 88, 0.75);
    background: linear-gradient(135deg, var(--green), #d4ff63);
    color: #071007;
    cursor: pointer;
    font-size: 1.15rem;
    font-weight: 800;
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.chat-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 18px rgba(115, 255, 88, 0.45);
}

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

.chat-send-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.15);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Banner de Bloqueo para Invitados (Premium Neon) */
.chat-locked-banner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px 24px;
    border-radius: 4px;
    background: linear-gradient(135deg, rgba(7, 9, 12, 0.95) 0%, rgba(11, 15, 18, 0.98) 100%);
    border: 1px solid rgba(255, 61, 61, 0.22);
    box-shadow: 0 0 35px rgba(255, 61, 61, 0.05), inset 0 0 20px rgba(0, 0, 0, 0.6);
    position: relative;
    overflow: hidden;
    animation: glowBorder 4s infinite alternate;
}

@keyframes glowBorder {
    0% {
        border-color: rgba(255, 61, 61, 0.2);
        box-shadow: 0 0 25px rgba(255, 61, 61, 0.04);
    }
    100% {
        border-color: rgba(113, 255, 91, 0.22);
        box-shadow: 0 0 35px rgba(113, 255, 91, 0.06);
    }
}

.chat-locked-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
    animation: floatIcon 3s infinite ease-in-out;
}

@keyframes floatIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.chat-locked-title {
    font-weight: 800;
    font-size: 1.05rem;
    color: var(--text);
    margin: 0 0 6px 0;
    letter-spacing: 0.02em;
}

.chat-locked-desc {
    font-size: 0.88rem;
    color: var(--muted);
    margin: 0 0 16px 0;
}

.chat-locked-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    width: 100%;
    max-width: 320px;
}

.chat-locked-actions .btn {
    flex: 1;
    min-height: 38px;
    font-size: 0.88rem;
}

/* Responsividad para móviles */
@media (max-width: 768px) {
    .chat-panel {
        height: 520px;
    }
    .chat-messages-container {
        padding: 16px;
        gap: 12px;
    }
    .chat-msg-row {
        max-width: 90%;
    }
    .chat-msg-bubble {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    .chat-header {
        padding: 12px 16px;
    }
    .chat-action-bar {
        padding: 12px 16px;
    }
    .chat-input {
        min-height: 44px;
        padding-left: 14px;
        font-size: 0.9rem;
    }
    .chat-send-btn {
        min-height: 44px;
        width: 44px;
    }
    .chat-locked-actions {
        flex-direction: column;
        gap: 8px;
    }
}
