/* General Body and Font Styling */
body {
    background-color: #10001C;
    color: #D0A0FF;
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    margin: 0;
    padding: 0;
    text-shadow: 0 0 3px rgba(208, 160, 255, 0.5);
}

/* Main Grid Container */
.container {
    display: grid;
    grid-template-columns: 2fr 1.2fr 1.2fr;
    grid-template-rows: auto 1fr;
    gap: 20px;
    padding: 20px;
    max-width: 1600px;
    margin: auto;
    min-height: 100vh; 
    box-sizing: border-box;
}

/* General Panel Styling */
.panel {
    background-color: rgba(0, 0, 0, 0.4);
    border: 1px solid #2a0845;
    border-radius: 15px;
    padding: 25px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

h3 {
    text-transform: uppercase;
    font-weight: 700;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid #4a2865;
    padding-bottom: 10px;
}

/* Specific Panel Grid Placement */
.server-info {
    grid-column: 1 / 2;
    grid-row: 1 / 3;
}

.map-info {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    align-items: center;
}

.server-selector {
    grid-column: 3 / 4;
    grid-row: 1 / 2;
}

.top-players-all-time {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

.top-players-last-30 {
    grid-column: 3 / 4;
    grid-row: 2 / 3;
}

/* Server Info Panel */
.server-info .player-count {
    /* min: 1.1rem, skaliert mit 1.8% der Fensterbreite, max: 1.4rem */
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    margin-bottom: 25px;
}

.online-players-list {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE */
}

/* Passt die innere Liste an. */
.online-players-list {
    /* NEU: Die maximale Höhe ist die FENSTERHÖHE minus 260px Puffer für andere Elemente */
    max-height: calc(100vh - 230px);

    /* Sorgt für den Scrollbalken, wenn die Liste länger als max-height ist */
    overflow-y: auto;

    /* Stile & Fixes für den Scrollbalken */
    min-height: 0; 
    scrollbar-width: thin;
    scrollbar-color: #0f001a #0a0011;
    -ms-overflow-style: none;
}
/* Map Panel */
.map-info .map-name-text {
    font-size: 1.2rem;
    margin-top: -15px;
    margin-bottom: 15px;
}
.map-image-container {
    border: 3px solid #3a1855;
    border-radius: 10px;
    padding: 5px;
    background-color: #1a082a;
    line-height: 0;
}
.map-image {
    width: 256px;
    height: 256px;
    object-fit: cover; /* This prevents the image from stretching */
    border-radius: 6px;
}

/* Top Players Lists */
.top-players-list {
    overflow-y: auto;
    flex-grow: 1;
}
ol, ul {
    list-style-position: inside;
    padding-left: 0;
    margin: 0;
}
li {
    padding: 8px 5px;
    border-bottom: 1px solid #2a183a;
    font-size: clamp(0.9rem, 1.2vw, 1.1rem);
}
li:last-child {
    border-bottom: none;
}
.online-players-list ul {
    list-style: none;
}

/* --- MODIFIED SECTION START --- */

/* Server Selector Panel */
.server-grid {
    display: grid;
    /* ÄNDERUNG: Die Spalten & Zeilen passen sich dem Inhalt an, anstatt sich auszudehnen */
    grid-template-columns: repeat(2, auto);
    grid-template-rows: repeat(2, auto);
    gap: 15px;
    /* HINZUGEFÜGT: Zentriert das gesamte Raster innerhalb des Panels */
    margin: auto;
}

.server-icon {
    /* ADDED: Fixed dimensions to make buttons smaller */
    width: 140px;
    height: 140px;

    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 15px; /* Adjusted padding */
    box-sizing: border-box;
    background-color: #1C1A27;
    border-radius: 12px;
    transition: all 0.2s ease-in-out;
    border: 2px solid var(--icon-color);
    box-shadow: 0 0 8px var(--icon-color);
}

/* --- MODIFIED SECTION END --- */


.server-name-top {
    /* ADDED: Gives the text a fixed vertical space to ensure alignment */
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Your existing font styles */
    font-size: 14px;
    font-weight: bold;
    color: #fff;
    text-transform: uppercase;
}
.server-icon:hover {
    /* Make the glow brighter on hover */
    box-shadow: 0 0 15px var(--icon-color);
    transform: translateY(-5px);
}

.server-icon.active,
.server-icon.active:hover {
    /* The active button gets the brightest, white outline and glow */
    border-color: #fff;
    box-shadow: 0 0 20px #fff;
}
.server-logo {
    /* Adjust size to fit the remaining space */
    max-width: 80%;
    max-height: 80%; /* Prevents large logos from overflowing the container */
    object-fit: contain;
}
.server-selector a.server-icon {
    text-decoration: none;
}
.server-icon.offline {
    /* Your existing styles for the red border and glow */
    border-color: #E65A5A;
    box-shadow: 0 0 8px #E65A5A;
    filter: grayscale(50%);
    opacity: 0.7;

    /* ADD THIS LINE to make the button un-clickable */
    pointer-events: none;
}

/* Verhindert den Hover-Effekt bei Offline-Buttons */
.server-icon.offline:hover {
    transform: none; /* Deaktiviert das Anheben/Zoomen */
    box-shadow: 0 0 8px #E65A5A; /* Behält den roten Glow bei, ohne ihn zu verstärken */
}

/* --- RESPONSIVE DESIGN FOR SCALABILITY --- */

/* For tablets and smaller devices */
@media (max-width: 1200px) {
    .container {
        /* Switch to a two-column layout */
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto; /* Let rows size automatically */
    }

    /* The main server info panel now spans both columns */
    .server-info {
        grid-column: 1 / 3;
        grid-row: 1 / 2;
    }
    
    .map-info {
        grid-column: 1 / 2;
        grid-row: 2 / 3;
    }
    
    .server-selector {
        grid-column: 2 / 3;
        grid-row: 2 / 3;
    }
    
    .top-players-all-time {
        grid-column: 1 / 2;
        grid-row: 3 / 4;
    }
    
    .top-players-last-30 {
        grid-column: 2 / 3;
        grid-row: 3 / 4;
    }
}

/* For mobile phones */
@media (max-width: 768px) {
    .container {
        /* Switch to a single-column layout */
        grid-template-columns: 1fr;
        padding: 10px; /* Reduce padding on small screens */
        gap: 15px; /* Reduce gap on small screens */
    }

    /* Reset all grid placements to flow naturally in one column */
    .server-info,
    .map-info,
    .server-selector,
    .top-players-all-time,
    .top-players-last-30 {
        grid-column: auto;
        grid-row: auto;
    }

    h3 {
        font-size: 1.3rem;
    }

    .server-info .player-count {
        font-size: 1.2rem;
    }
    
    /* Make map image responsive */
    .map-image {
        width: 100%; /* Fill container width */
        height: auto; /* Maintain aspect ratio */
        max-width: 256px; /* Optional: prevent it from becoming too large */
    }
}