/* Reset and Base Styles */
html {
    background-color: #0e0e10; /* Match the darkest color of your body's gradient */
    /* Optional: If you ever need body height to be 100% of html instead of vh */
    /* height: 100%; */
}
*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --header-height: 70px; /* Default/fallback, JS will update */
    --controls-height: 60px; /* Default/fallback, JS will update */
    --base-content-padding: 1.5rem; /* Your desired base padding above player list */
}


body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #1a1a1d 0%, #0e0e10 100%);
    background-attachment: fixed;
    color: #e0e0e0;
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
}

body.modal-open {
    overflow: hidden; /* Prevent background scroll when modal is open */
}

.container {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1.5rem; /* Adjusted padding for some container uses */
}

/* Sr-only for accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Header Styles */
.site-header {
    /* Glassmorphism Styles (already present or ensure they are) */
    background-color: rgba(24, 24, 27, 0.75); /* Or your chosen glass values */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(42, 42, 46, 0.5);

    /* Core styles for hiding header effect */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 101; /* Higher than sticky-controls */
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); /* Shadow when visible */

    padding: 0; /* As inner .container elements handle horizontal padding */
}

.site-header .container { /* General rule for containers within header */
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.site-header .header-top-content {
    /* padding-top & padding-bottom are already defined in your CSS and look okay */
    /* display, justify-content, align-items, flex-wrap are also defined */
}

.site-header .header-actions {
    /* padding, display, justify-content, align-items, flex-wrap, gap, border-top, margin-top are defined */
}

.site-header.is-hidden {
    transform: translateY(-100%);
    box-shadow: none; /* Remove shadow when hidden */
}

.header-top-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.5rem 1.5rem; /* Container padding */
}

.site-header h1 {
    color: #ffffff;
    text-align: left;
    margin: 0;
    font-size: clamp(1.5rem, 4vw, 2rem); /* Slightly adjusted title size */
    font-weight: 700;
}

.about-us-button {
    background-color: rgba(88, 166, 255, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: #ffffff;
    border: 1px solid rgba(88, 166, 255, 0.5);
    border-radius: 0.5rem;
    padding: 0.5rem 1rem; /* Adjusted padding */
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
    margin-left: 1rem;
}

.about-us-button:hover,
.about-us-button:focus {
    background-color: rgba(121, 192, 255, 0.8);
    transform: translateY(-2px);
    outline: none;
}

.header-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem; /* Gap between action links */
    padding: 0.5rem 1.5rem 0.75rem 1.5rem; /* Container padding + bottom padding */
    border-top: 1px solid rgba(42, 42, 46, 0.3); /* Subtle separator if needed */
    margin-top: 0.5rem;
}

.header-action-link {
    color: #c0c0c0;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    border-radius: 0.375rem;
    background-color: rgba(50, 50, 55, 0.5);
    border: 1px solid rgba(60, 60, 65, 0.4);
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.1s ease;
}

.header-action-link:hover,
.header-action-link:focus {
    color: #ffffff;
    background-color: rgba(88, 166, 255, 0.6);
    border-color: rgba(88, 166, 255, 0.4);
    transform: translateY(-1px);
    outline: none;
}


/* Sticky Controls Container (Search and Stats) */
.sticky-controls-container {
    /* Glassmorphism Styles */
    background-color: rgba(31, 31, 34, 0.75); /* Adjusted alpha for a good glass effect */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* For Safari */
    border-bottom: 1px solid rgba(42, 42, 46, 0.5); /* Consistent border */

    /* Layout & Sticky Positioning Styles */
    position: sticky;
    z-index: 100;
    top: var(--header-height); /* Sticks below the visible fixed header */
    transition: top 0.3s ease-in-out; /* Smooth transition for top change */
    padding: 0; /* Correct, as inner .container and .search-and-stats handle internal spacing */
}

.sticky-controls-container.header-is-hidden {
    top: 0; /* Sticks to viewport top when main header is hidden */
}

/* Ensure .container within .sticky-controls-container uses full padding for content alignment */
.sticky-controls-container .container {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem; /* Horizontal padding for the content inside */
    padding-right: 1.5rem;
}
/* Remove general padding from .sticky-controls-container itself */
.sticky-controls-container {
    padding: 0; /* Let inner .container handle horizontal padding */
}
.sticky-controls-container .search-and-stats {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    /* Keep other styles like display: flex, gap, etc. */
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 768px) {
    .sticky-controls-container .search-and-stats {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 1.5rem;
    }
}


.search-and-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem; /* Reduced gap slightly */
    /* margin-bottom: 0; Removed as sticky-controls-container handles spacing */
}

.search-container {
    flex-grow: 1;
}

.search {
    width: 100%;
    padding: 0.8rem 1.2rem; /* Adjusted padding */
    font-size: 0.95rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(48, 48, 51, 0.7);
    background-color: rgba(31, 31, 34, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: #e0e0e0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.search:focus {
    outline: none;
    border-color: rgba(88, 166, 255, 0.8);
    background-color: rgba(31, 31, 34, 0.75);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.25);
}

.search::placeholder {
    color: #8a8a8a;
}

.stats-container {
    background-color: transparent; /* Will inherit from sticky-controls-container */
    color: #b0b0b0;
    padding: 0.8rem 1.2rem;
    border-radius: 0.5rem;
    text-align: center;
    font-size: 0.9rem; /* Adjusted font size */
    border: 1px solid rgba(48, 48, 51, 0.5); /* Optional: border for stats itself */
    flex-shrink: 0;
}

.stats-container #totalPlayers {
    font-weight: 600;
    color: #e0e0e0;
}

/* Main Content Styles */
.main-content { /* Class added to your <main> tag */
    padding-top: calc(var(--header-height) + var(--controls-height) + var(--base-content-padding));
    padding-bottom: var(--base-content-padding); /* Keep your bottom padding */
    transition: padding-top 0.3s ease-in-out;
}

.main-content.header-is-hidden {
    /* Adjust padding when main header is hidden, only need to clear controls bar */
    padding-top: calc(var(--controls-height) + var(--base-content-padding));
}

.player-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); /* Slightly adjusted minmax */
    gap: 1.5rem;
}

.loading-placeholder,
.error-message {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 1.1rem;
    color: #a0a0a0;
    padding: 3rem 1rem;
    background-color: rgba(31, 31, 34, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 0.75rem;
    border: 1px solid rgba(42, 42, 46, 0.4);
}

.card {
    background-color: rgba(31, 31, 34, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 0.75rem;
    padding: 1.25rem; /* Adjusted padding */
    display: flex;
    flex-direction: column;
    text-align: center;
    border: 1px solid rgba(42, 42, 46, 0.5);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.card .player-skin-container {
    width: 100%;
    max-width: 90px; /* Adjusted max width */
    height: 170px;
    margin: 0 auto 1rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card img.player-skin {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}


.card .info {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0.25rem;
}

.card .info .name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #ffffff;
    word-break: break-all;
}

.card .info .reason {
    font-size: 0.85rem; /* Adjusted */
    color: #c0c0c0;
    min-height: 2.55em; /* 3 lines for 0.85rem font with 1.5 line-height */
    line-height: 1.5;
    overflow-wrap: break-word;
}

.card .info .uuid {
    font-size: 0.75rem; /* Adjusted */
    color: #888888;
    word-break: break-all;
    margin-top: 0.25rem;
}

.card .info .platform {
    font-size: 0.9rem;
    color: #8ab4f8; /* A nice blue shade */
    margin-top: 0.4rem;
    font-weight: 600;
}

.card .namemc-link {
    margin-top: 1rem;
    padding: 0.6rem 1rem;
    background-color: rgba(88, 166, 255, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    color: #ffffff;
    border: 1px solid rgba(88, 166, 255, 0.5);
    border-radius: 0.5rem;
    font-size: 0.85rem; /* Adjusted */
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease, border-color 0.2s ease;
}

.card .namemc-link:hover,
.card .namemc-link:focus {
    background-color: rgba(121, 192, 255, 0.8);
    border-color: rgba(121, 192, 255, 0.7);
    transform: scale(1.03);
    text-decoration: none;
}

/* Footer Styles */
.site-footer {
    background-color: rgba(24, 24, 27, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #a0a0a0;
    text-align: center;
    padding: 1.5rem 0; /* Adjusted padding */
    margin-top: 2.5rem; /* Adjusted margin */
    border-top: 1px solid rgba(42, 42, 46, 0.5);
    font-size: 0.85rem;
}


/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65); /* Slightly darker overlay */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.modal {
    background-color: rgba(31, 31, 34, 0.85); /* Slightly more opaque modal */
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 0.75rem;
    padding: 1.75rem; /* Adjusted padding */
    width: 90%;
    max-width: 550px; /* Slightly smaller max-width */
    border: 1px solid rgba(50, 50, 55, 0.6);
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    color: #e0e0e0;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(60, 60, 65, 0.5);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: #ffffff;
}

.close-button {
    background: none;
    border: none;
    color: #a0a0a0;
    font-size: 1.75rem; /* Adjusted size */
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    transition: color 0.2s ease;
}

.close-button:hover {
    color: #ffffff;
}

.modal-content p {
    margin-bottom: 1rem;
    line-height: 1.6; /* Adjusted line height */
    font-size: 0.95rem;
}
.modal-content p:last-child {
    margin-bottom: 0;
}
.modal-content strong {
    color: #ffffff;
    font-weight: 600;
}
.modal-content em {
    color: #b0b0b0;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .search-and-stats {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 1.5rem;
    }
    .search-container {
        margin-right: 0; /* No longer needed with flex gap */
    }
    /* REMOVE/COMMENT OUT THE HARDCODED TOP FOR .sticky-controls-container HERE */
    /* .sticky-controls-container {
        top: 100px; /* This was overriding the dynamic top value */
    /* } */
}


@media (max-width: 767px) {
    .site-header h1 {
        text-align: center;
        width: 100%;
        margin-bottom: 0.75rem;
    }
    .header-top-content {
        justify-content: center;
        padding-left: 1rem; /* Adjust padding for smaller screens */
        padding-right: 1rem;
    }
    .about-us-button {
        margin-top: 0.5rem; /* Space if title wraps or is alone */
        margin-left: 0; /* Center if it's on its own line */
    }
    .header-actions {
        padding-left: 1rem;
        padding-right: 1rem;
        gap: 0.5rem; /* Smaller gap for links */
    }
    .header-action-link {
        font-size: 0.8rem; /* Smaller links on mobile */
        padding: 0.35rem 0.7rem;
    }

    /* REMOVE/COMMENT OUT THE HARDCODED TOP FOR .sticky-controls-container HERE */
    /* .sticky-controls-container {
        top: 130px; /* This was overriding the dynamic top value */
    /* The padding: 0.5rem 0; below is acceptable if you want extra padding on mobile for the bar itself */
    /* } */

    /* If you want the sticky-controls-container to have its own vertical padding on mobile,
       this is okay, but ensure it's what you intend. The JS will measure its offsetHeight
       including this padding for --controls-height. */
    .sticky-controls-container {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }


    .sticky-controls-container .container,
    .main-content.container { /* This rule seems to be trying to apply .container styles to .main-content if it also has .container */
        /* It's fine if .main-content also has .container class in HTML for padding. */
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .stats-container {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    .search {
        font-size: 0.9rem;
        padding: 0.7rem 1rem;
    }
}

@media (max-width: 480px) {
    .player-list {
        grid-template-columns: 1fr;
    }
    .card .player-skin-container {
        max-width: 80px;
        height: 150px;
    }
    .card .info .name {
        font-size: 1.1rem;
    }
    .modal {
        padding: 1.25rem;
    }
    .modal-header h2 {
        font-size: 1.2rem;
    }

    /* REMOVE/COMMENT OUT THE HARDCODED TOP FOR .sticky-controls-container HERE */
    /* .sticky-controls-container {
        top: 145px; /* This was overriding the dynamic top value */
    /* } */

    .site-header h1 {
        font-size: 1.3rem;
    }
    .about-us-button {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
}