:root {
    --bg-color: #0f0f0f;
    --text-color: #ffffff;
    --accent-color: #B82306;
    --card-bg: rgba(26, 26, 26, 0.8);
    --card-border: rgba(255, 255, 255, 0.1);
    --font-header: 'Rajdhani', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at center, rgba(184, 35, 6, 0.15) 0%, rgba(15, 15, 15, 1) 70%);
    color: var(--text-color);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1250px;
    margin: 0 auto;
    padding: 0 1.5rem;
    min-width: 400px;
}

/* Hero Section */
.hero {
    padding: 4rem 0 3rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.03); /* Subtle white tint instead of black */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08); /* Defines the bottom edge */
    margin-bottom: 3rem;
}

.hero h1 {
    font-family: var(--font-header);
    font-size: clamp(3rem, 10vw, 5rem);
    text-transform: uppercase;
    letter-spacing: -2px;
    margin-bottom: 0.5rem;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5); /* Adds depth to the title */
}

.hero h1 span {
    color: var(--accent-color);
}

.hero p {
    color: #9ca3af;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Grid Layout */
.main-grid {
    display: grid;
    /* 'minmax(0, 1fr)' forces the browser to ignore content width when calculating 50% */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); 
    gap: 2rem;
    padding-bottom: 4rem;
    align-items: start; /* Prevents one box from stretching vertically to match the other */
}

/* Glass Card Styling */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 1.25rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    width: 100%; /* Ensures it fills exactly its half of the grid */
    min-width: 0; /* Critical for grid item stability */
}

/* Ensure the discord container doesn't push the width out */
.discord-container {
    width: 100%;
    overflow: hidden;
    border-radius: 0.75rem;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    font-family: var(--font-header);
    font-size: 1.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Animated Status Dot */
.status-pulse {
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 10px #22c55e;
}

.status-pulse::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: inherit;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}

/* Server Cards (Rendered by JS) */
.server-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
    cursor: pointer;
    overflow: hidden;
}

.server-card:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.server-main-info {
    display: flex;
    align-items: center; /* Keeps stats and buttons centered relative to the name */
    padding: 1.25rem;
    gap: 1rem;
}
.server-info-primary {
    flex: 1;
    min-width: 0;
}

.server-name {
    font-weight: 800;
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    word-break: break-word; /* Allows long names to break if necessary */
    display: block;         /* Ensures it behaves as a block element */
}

.server-meta {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9ca3af;
    display: flex;
    gap: 0.5rem;
}

.player-count-radial {
    text-align: right;
    min-width: 60px;
}

.count-main {
    color: var(--accent-color);
    font-weight: 800;
    font-size: 1.4rem;
    line-height: 1;
}

.count-max {
    font-size: 0.7rem;
    color: #6b7280;
}

/* Container for the split button */
.btn-group {
    display: flex;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--accent-color);
    background: var(--accent-color); /* Sets the base background to red */
    margin-left: auto; /* Aligns the button to the right */
}

/* Shared styles for both halves */
.btn-half {
    padding: 0.5rem 0.9rem;
    background: transparent;
    color: #ffffff; /* RESTORED: White text */
    text-decoration: none;
    font-weight: 800;
    font-size: 0.75rem;
    text-transform: uppercase;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Vertical divider line */
.btn-half.left {
    border-right: 1px solid rgba(255, 255, 255, 0.2); /* Subtle white divider */
}

/* Hover effects - turns solid red with white text */
.btn-half:hover {
    background: rgba(255, 255, 255, 0.1); 
    color: #ffffff;
}

/* Player List Table */
.player-list-popup {
    background: rgba(0, 0, 0, 0.3);
    padding: 0 1.25rem 1.25rem;
    display: none; /* Hidden by default */
}

/* Show player list when parent has 'expanded' class */
.server-card.expanded .player-list-popup {
    display: block;
}

.players-table {
    width: 100%;
    border-collapse: collapse;
}

.players-table th {
    text-align: left;
    font-size: 0.7rem;
    color: #6b7280;
    text-transform: uppercase;
    padding: 1rem 0 0.5rem;
}

.players-table td {
    padding: 0.5rem 0;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.score-col { text-align: right; color: var(--accent-color); font-weight: 700; }

/* Loading State */
.loading { padding: 3rem; text-align: center; color: #6b7280; }
.spinner {
    width: 30px; height: 30px; border: 3px solid rgba(184, 35, 6, 0.2);
    border-top-color: var(--accent-color); border-radius: 50%;
    animation: spin 1s linear infinite; margin: 0 auto 1rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Quake Color Classes */
.ql-1 { color: #ff0000; } .ql-2 { color: #00ff00; } .ql-3 { color: #ffff00; }
.ql-4 { color: #00b0f4; } .ql-5 { color: #00ffff; } .ql-6 { color: #ff00ff; }
.ql-7 { color: #ffffff; } .ql-0 { color: #000000; }

/* RESPONSIBLE SNAP POINT AT 600PX */
@media (max-width: 1000px) {
    .main-grid {
        grid-template-columns: 1fr; 
        gap: 1.5rem;
    }

    .hero { padding: 2rem 0; }

    .server-main-info {
        flex-wrap: wrap; 
    }

    .server-info-primary {
        min-width: 100%; 
        margin-bottom: 0.5rem;
    }

    .player-count-radial {
        text-align: left;
        flex: 1;
    }
    
    .btn-group {
        margin-top: 0.5rem;
        width: 100%; 
    }
    
    .btn-half {
        flex: 1; 
    }
}