/* Reset & Base */
*, *::before, *::after {
    box-sizing: border_box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-color: #101012;
    --card-bg: #1a1a1c;
    --text-color: #ffffff;
    --text-muted: #747785; /* Zinc 400 */
    --text-dim: #52525b; /* Zinc 600 */
    
    --font-family: 'Inter', sans-serif;
    
    --max-width: 1060px;
    --sidebar-width: 220px;
    --gap-layout: 40px;

    --rating-9: #186a3b; /* Green 500 */
    --rating-8: #28b463; /* Lime 500 */
    --rating-7: #f4d03f; /* Yellow 500 */
    --rating-6: #f39c12; /* Orange 500 */
    --rating-5: #e74c3c; /* Red 500 */
    --rating-low: #7f1d1d; /* Red 900 */
    --rating-none: #27272a; /* Zinc 800 */
    
    --border-radius: 6px;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    line-height: 1.5;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

h1, h2, h3 {
    font-weight: 700;
    line-height: 1.2;
}

/* Layout Structure */
.topbar {
    width: 100%;
    padding: 10px 0;
    background-color: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 50px;
}

.main-header {
    width: 100%;
    padding: 0 0 20px 0;
}

.header-content {
    /* No extra constraints needed as it's now inside the layout grid */
}

/* 
.header-content h1 was here 
*/
.header-content h1 {
    font-size: 24px;
    font-weight: 800;
}

.app-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px 40px 20px;
    display: flex;
    gap: var(--gap-layout);
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
}

.main-content {
    flex: 1;
    min-width: 0; /* Prevents flex items from overflowing */
}


/* Components: Topbar */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
}

.search-container {
    flex: 1;
    display: flex;
    justify-content: center;
}

.search-form {
    width: 100%;
    max-width: 400px;
}

.search-input {
    width: 100%;
    background-color: var(--card-bg);
    border: 1px solid transparent;
    border-radius: 99px;
    padding: 8px 16px;
    color: var(--text-color);
    font-family: var(--font-family);
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--text-muted);
}


/* Components: Sidebar */

.logo-link {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-section {
    margin-bottom: 30px;
}

.nav-title {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 200;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    color: var(--text-muted);
    font-size: 15px;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-color);
}

.nav-link.active {
    font-weight: 500;
}

.team-rating-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    font-weight: 700;
    font-size: 15px;
}

.rating-high { color: var(--rating-9); }
.rating-medium { color: var(--rating-6); }
.rating-low { color: var(--rating-low); }

.heatmap-box.rating-injured { 
    background: repeating-linear-gradient(135deg, #323236 0 6px, #36363a 6px 12px);
    font-size: 23px;
    line-height: 1;
}


/* Components: Player Row (Card) */
.player-row-wrapper {
    display: flex;
    align-items: stretch; /* Heatmap boxes stretch to height */
    margin-bottom: 8px;
    gap: 6px; /* Layout Gap between card and heatmap */
}

.player-info-card {
    flex: 1; /* Takes available space */
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2px 6px;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
    min-width: 0; /* Allow shrinking */
}

.player-info-card:hover {
    background-color: #232326;
}

/* Columns */


.face-col {
    width: 40px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.player-face-img, .player-face-placeholder {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #27272a;
}
.player-face-placeholder {
    background-image: url('data:image/svg+xml;utf8,<svg fill="%2352525b" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>');
    background-size: 20px;
    background-repeat: no-repeat;
    background-position: center;
}

.club-col, .league-col {
    width: 30px;
    display: flex;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-muted);
}
.club-placeholder-icon, .league-placeholder-icon {
    font-size: 16px;
    opacity: 0.5;
}

.info-col {
    flex: 1;
    padding: 0 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.player-name {
    font-weight: 500;
    color: var(--text-color);
}

.heatmap-container {
    display: flex;
    align-items: stretch;
    justify-content: flex-end; /* Align to right */
    gap: 6px;
    /* On mobile this will contain the history */
}

/* Heatmap Boxes */
.heatmap-box {
    width: 48px; /* All boxes same size now */
    height: auto; /* Stretch */
    min-height: 32px; 
    border-radius: 4px; 
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: white;
    background-color: var(--rating-none);
    flex-shrink: 0;
}

.current-rating {
    font-size: 13px;
}

/* --- Match Detail Versus Layout --- */

/* Home Team (Left Column) - Right Aligned */
/* Order: Flag - Name - Logo - Photo - Rating */
.layout-home-versus {
    flex-direction: row;
    justify-content: flex-end; /* Align entire row to right */
}

.layout-home-versus .player-info-card {
    flex: 0 1 auto; /* Don't stretch too much, wrap content */
    flex-direction: row-reverse; /* Reverses items inside card: Info(Flag/Name) - Logo - Photo */
}

/* Also reverse info col so Flag comes before Name (visually) */
.layout-home-versus .info-col {
    flex-direction: row-reverse; 
    text-align: right;
    justify-content: flex-start; /* Because row-reverse, start is visually right */
}
.layout-home-versus .flag {
    margin-left: 0 !important;
    margin-right: 6px;
}


/* Away Team (Right Column) - Left Aligned */
/* Order: Rating - Photo - Logo - Name - Flag */
.layout-away-versus {
    flex-direction: row-reverse; /* Flip wrapper: HeatmapContainer - InfoCard */
    justify-content: flex-end; /* Because row-reverse, end is visually left */
}

.layout-away-versus .player-info-card {
    flex: 0 1 auto;
    /* Default direction row: Photo - Logo - Info(Name - Flag) */
}

.layout-away-versus .heatmap-container {
    padding-right: 6px;
}

.layout-away-versus .info-col {
    text-align: left;
}

/* Mobile override for Versus layout to avoid breaking */
@media (max-width: 768px) {
    .layout-home-versus,
    .layout-away-versus {
         flex-direction: row; 
         justify-content: space-between;
    }
    .layout-home-versus .player-info-card,
    .layout-away-versus .player-info-card {
        flex-direction: row; 
    }
    .layout-home-versus .info-col {
        flex-direction: row;
        justify-content: flex-start;
    }
    .layout-home-versus .flag {
        margin-right: 0;
        margin-left: 6px !important;
    }
}

/* Rating Classes */
.rating-9 { background-color: var(--rating-9); color: rgb(255, 255, 255); }
.rating-8 { background-color: var(--rating-8); color: black; }
.rating-7 { background-color: var(--rating-7); color: black; }
.rating-6 { background-color: var(--rating-6); color: black; }
.rating-5 { background-color: var(--rating-5); }
/* Steam-like Review Colors */
.steam-overwhelming { color: #66C0F4; font-weight: 700; text-shadow: 0 0 4px rgba(102,192,244,0.4); } /* Blue-ish for highest */
.steam-very-positive { color: #66C0F4; font-weight: 700; }
.steam-positive { color: #A4D007; font-weight: 700; } /* Steam Green */
.steam-mostly-positive { color: #A4D007; }
.steam-mixed { color: #B9A074; font-weight: 700; } /* Steam Mixed/Yellow */
.steam-mostly-negative { color: #B9A074; }
.steam-negative { color: #ce4e4e; font-weight: 700; }

.review-verdict {
    margin-right: 6px;
}

.review-verdict:hover {
    text-decoration: underline;
    cursor: default;
}

.rating-none { background-color: var(--rating-none); color: var(--text-muted); }

.icon-sub {
    font-size: 10px;
    position: absolute;
    bottom: -1px;
    right: 2px;
}

.icon-goal {
    position: absolute;
    top: 5px;
    right: 3px;
    line-height: 0;
    font-size: 20px;
    letter-spacing: -2px;
}

/* Match Card for Lists */
.match-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.match-card {
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle, #2c2c30 0%, #1a1a1c 100%);
}

.match-date {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 6px 4px 4px 10px;
    background: #1a1a1c;
    border-radius: 6px 6px 0 0;

}

.match-scoreline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.match-team {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding-top: 4px;
}

.match-team.home {
    justify-content: flex-end;
    text-align: right;
}

.match-team.away {
    justify-content: flex-start;
    text-align: left;
}

.team-badge {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex-shrink: 0;
}

.team-name {
    font-weight: 500;
    font-size: 15px;
    line-height: 1.2;
}
.team-name.current-team {
    color: var(--text-color);
}

.score-badge {
    background-color: #212123;
    padding: 10px 10px;
    font-weight: 700;
    font-size: 16px;

}


/* Match Detail Specifics */
.match-summary-card {
    text-align: center;
    margin-bottom: 40px;
}

.match-meta {
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 14px;
    margin-bottom: 20px;
    letter-spacing: 1px;
}

.scoreboard {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.team-display {
    flex: 1;
    font-family: "Roboto Condensed", sans-serif;
    font-size: 48px;
    font-weight: 800;
}
.team-display.right-align { text-align: right; }
.team-display.left-align { text-align: left; }

.score-display {
    background-color: #1a1a1c;
    color: white;
    padding: 8px 24px;
    border-radius: 8px;
    font-family: "Roboto Condensed", sans-serif;
    font-size: 48px;
    font-weight: 800;
    letter-spacing: -4px;
}

.match-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.team-column-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #27272a;
}

.section-title {
    margin-bottom: 20px;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.section-header {
    padding: 10px 0;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.empty-state, .empty-text {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
}


/* Heatmap Headers in Team Detail */
.section-header-row {
    display: flex;
    align-items: flex-end; /* Align bottom so dates are close to heatmap */
    justify-content: space-between;
    margin-bottom: 8px;
    padding-right: 0;
}

.heatmap-header-container {
    display: flex;
    gap: 6px;
    padding-right: 0; /* Align with heatmap container right edge */
}

.heatmap-col-header {
    width: 32px; /* Same as heatmap-box */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-shrink: 0;
    width: 48px;
}

.heatmap-col-header .match-code {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-color);
    line-height: 1.2;
}

.heatmap-col-header .match-date {
    font-size: 12px;
    color: #797b81;
}

.heatmap-col-header-empty {
    width: 32px; /* Placeholder for current rating column if needed, or remove if not desired aligned */
    flex-shrink: 0;
}

/* Mobile adjustments for headers */
@media (max-width: 768px) {
    .section-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .heatmap-header-container {
        align-self: flex-end; /* Push to right on mobile to match player row layout */
        max-width: 50%; /* Match the max-width of heatmap container in mobile */
        justify-content: flex-end;
        overflow: hidden; /* Ensure it doesn't break layout */
    }

    .heatmap-col-header-empty {
         display: none; /* Hide empty column on mobile as current rating is hidden */
    }
}

/* Responsive Mobile */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        gap: 20px;
        padding: 0 10px 40px 10px;
    }

    .topbar-inner {
        padding: 0 10px;
    }

    .sidebar {
        display: none;
    }
    
    .mobile-menu-btn {
        display: block;
    }

    /* Player Row Mobile */
    .rank-col, 
    .club-col, 
    .league-col,
    .current-rating {
        display: none !important;
    }
    
    .player-row-wrapper {
        gap: 4px;
    }

    .player-info-card {
        padding: 8px 10px; 
        min-width: 0;
        flex-grow: 1; /* Grow to fill space but leave room for heatmap */
        flex-shrink: 1;
        width: auto;
    }

    .player-name {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .heatmap-container {
        flex: 0 0 auto; /* Don't grow, stick to content size */
        max-width: 50%; /* Prevent taking over name */
        overflow: hidden; 
        justify-content: flex-end; /* Align right */
    }
    
    .heatmap-box {
        flex-shrink: 0;
        /* Ensure history ratings are visible */
    }

    /* Match Detail Columns Stack */
    .match-stats-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .scoreboard {
        gap: 10px;
    }
    .team-display {
        font-size: 16px;
    }
    .score-display {
        font-size: 24px;
        padding: 5px 15px;
    }
}

.flag {
  background: url(https://cdn.football-graph.com/static/images_flags_responsive_custom.png) no-repeat;
  background-size: 100%
}
.flag-ad { background-position: 0 0.406504%; }
.flag-ae { background-position: 0 0.813008%; }
.flag-af { background-position: 0 1.219512%; }
.flag-ag { background-position: 0 1.626016%; }
.flag-ai { background-position: 0 2.03252%; }
.flag-al { background-position: 0 2.439024%; }
.flag-am { background-position: 0 2.845528%; }
.flag-an { background-position: 0 3.252032%; }
.flag-ao { background-position: 0 3.658536%; }
.flag-aq { background-position: 0 4.06504%; }
.flag-ar { background-position: 0 4.471544%; }
.flag-as { background-position: 0 4.878048%; }
.flag-at { background-position: 0 5.284552%; }
.flag-au { background-position: 0 5.691056%; }
.flag-aw { background-position: 0 6.09756%; }
.flag-az { background-position: 0 6.504064%; }
.flag-ba { background-position: 0 6.910568%; }
.flag-bb { background-position: 0 7.317072%; }
.flag-bd { background-position: 0 7.723576%; }
.flag-be { background-position: 0 8.13008%; }
.flag-bf { background-position: 0 8.536584%; }
.flag-bg { background-position: 0 8.943088%; }
.flag-bh { background-position: 0 9.349592%; }
.flag-bi { background-position: 0 9.756096%; }
.flag-bj { background-position: 0 10.1626%; }
.flag-bm { background-position: 0 10.569104%; }
.flag-bn { background-position: 0 10.975608%; }
.flag-bo { background-position: 0 11.382112%; }
.flag-br { background-position: 0 11.788616%; }
.flag-bs { background-position: 0 12.19512%; }
.flag-bt { background-position: 0 12.601624%; }
.flag-bv { background-position: 0 13.008128%; }
.flag-bw { background-position: 0 13.414632%; }
.flag-by { background-position: 0 13.821136%; }
.flag-bz { background-position: 0 14.22764%; }
.flag-ca { background-position: 0 14.634144%; }
.flag-cc { background-position: 0 15.040648%; }
.flag-cd { background-position: 0 15.447152%; }
.flag-cf { background-position: 0 15.853656%; }
.flag-cg { background-position: 0 16.26016%; }
.flag-ch { background-position: 0 16.666664%; }
.flag-ci { background-position: 0 17.073168%; }
.flag-ck { background-position: 0 17.479672%; }
.flag-cl { background-position: 0 17.886176%; }
.flag-cm { background-position: 0 18.29268%; }
.flag-cn { background-position: 0 18.699184%; }
.flag-co { background-position: 0 19.105688%; }
.flag-cr { background-position: 0 19.512192%; }
.flag-cu { background-position: 0 19.918696%; }
.flag-cv { background-position: 0 20.3252%; }
.flag-cx { background-position: 0 20.731704%; }
.flag-cy { background-position: 0 21.138208%; }
.flag-cz { background-position: 0 21.544712%; }
.flag-de { background-position: 0 21.951216%; }
.flag-dj { background-position: 0 22.35772%; }
.flag-dk { background-position: 0 22.764224%; }
.flag-dm { background-position: 0 23.170728%; }
.flag-do { background-position: 0 23.577232%; }
.flag-dz { background-position: 0 23.983736%; }
.flag-ec { background-position: 0 24.39024%; }
.flag-ee { background-position: 0 24.796744%; }
.flag-eg { background-position: 0 25.203248%; }
.flag-eh { background-position: 0 25.609752%; }
.flag-er { background-position: 0 26.016256%; }
.flag-es { background-position: 0 26.42276%; }
.flag-et { background-position: 0 26.829264%; }
.flag-fi { background-position: 0 27.235768%; }
.flag-fj { background-position: 0 27.642272%; }
.flag-fk { background-position: 0 28.048776%; }
.flag-fm { background-position: 0 28.45528%; }
.flag-fo { background-position: 0 28.861784%; }
.flag-fr { background-position: 0 29.268288%; }
.flag-ga { background-position: 0 29.674792%; }
.flag-gd { background-position: 0 30.081296%; }
.flag-ge { background-position: 0 30.4878%; }
.flag-gf { background-position: 0 30.894304%; }
.flag-gh { background-position: 0 31.300808%; }
.flag-gi { background-position: 0 31.707312%; }
.flag-gl { background-position: 0 32.113816%; }
.flag-gm { background-position: 0 32.52032%; }
.flag-gn { background-position: 0 32.926824%; }
.flag-gp { background-position: 0 33.333328%; }
.flag-gq { background-position: 0 33.739832%; }
.flag-gr { background-position: 0 34.146336%; }
.flag-gs { background-position: 0 34.55284%; }
.flag-gt { background-position: 0 34.959344%; }
.flag-gu { background-position: 0 35.365848%; }
.flag-gw { background-position: 0 35.772352%; }
.flag-gy { background-position: 0 36.178856%; }
.flag-hk { background-position: 0 36.58536%; }
.flag-hm { background-position: 0 36.991864%; }
.flag-hn { background-position: 0 37.398368%; }
.flag-hr { background-position: 0 37.804872%; }
.flag-ht { background-position: 0 38.211376%; }
.flag-hu { background-position: 0 38.61788%; }
.flag-id { background-position: 0 39.024384%; }
.flag-ie { background-position: 0 39.430888%; }
.flag-il { background-position: 0 39.837392%; }
.flag-in { background-position: 0 40.243896%; }
.flag-io { background-position: 0 40.6504%; }
.flag-iq { background-position: 0 41.056904%; }
.flag-ir { background-position: 0 41.463408%; }
.flag-is { background-position: 0 41.869912%; }
.flag-it { background-position: 0 42.276416%; }
.flag-jm { background-position: 0 42.68292%; }
.flag-jo { background-position: 0 43.089424%; }
.flag-jp { background-position: 0 43.495928%; }
.flag-ke { background-position: 0 43.902432%; }
.flag-kg { background-position: 0 44.308936%; }
.flag-kh { background-position: 0 44.71544%; }
.flag-ki { background-position: 0 45.121944%; }
.flag-km { background-position: 0 45.528448%; }
.flag-kn { background-position: 0 45.934952%; }
.flag-kp { background-position: 0 46.341456%; }
.flag-kr { background-position: 0 46.74796%; }
.flag-kw { background-position: 0 47.154464%; }
.flag-ky { background-position: 0 47.560968%; }
.flag-kz { background-position: 0 47.967472%; }
.flag-la { background-position: 0 48.373976%; }
.flag-lb { background-position: 0 48.78048%; }
.flag-lc { background-position: 0 49.186984%; }
.flag-li { background-position: 0 49.593488%; }
.flag-lk { background-position: 0 49.999992%; }
.flag-lr { background-position: 0 50.406496%; }
.flag-ls { background-position: 0 50.813%; }
.flag-lt { background-position: 0 51.219504%; }
.flag-lu { background-position: 0 51.626008%; }
.flag-lv { background-position: 0 52.032512%; }
.flag-ly { background-position: 0 52.439016%; }
.flag-ma { background-position: 0 52.84552%; }
.flag-mc { background-position: 0 53.252024%; }
.flag-md { background-position: 0 53.658528%; }
.flag-me { background-position: 0 54.065032%; }
.flag-mg { background-position: 0 54.471536%; }
.flag-mh { background-position: 0 54.87804%; }
.flag-mk { background-position: 0 55.284544%; }
.flag-ml { background-position: 0 55.691048%; }
.flag-mm { background-position: 0 56.097552%; }
.flag-mn { background-position: 0 56.504056%; }
.flag-mo { background-position: 0 56.91056%; }
.flag-mp { background-position: 0 57.317064%; }
.flag-mq { background-position: 0 57.723568%; }
.flag-mr { background-position: 0 58.130072%; }
.flag-ms { background-position: 0 58.536576%; }
.flag-mt { background-position: 0 58.94308%; }
.flag-mu { background-position: 0 59.349584%; }
.flag-mv { background-position: 0 59.756088%; }
.flag-mw { background-position: 0 60.162592%; }
.flag-mx { background-position: 0 60.569096%; }
.flag-my { background-position: 0 60.9756%; }
.flag-mz { background-position: 0 61.382104%; }
.flag-na { background-position: 0 61.788608%; }
.flag-nc { background-position: 0 62.195112%; }
.flag-ne { background-position: 0 62.601616%; }
.flag-nf { background-position: 0 63.00812%; }
.flag-ng { background-position: 0 63.414624%; }
.flag-ni { background-position: 0 63.821128%; }
.flag-nl { background-position: 0 64.227632%; }
.flag-no { background-position: 0 64.634136%; }
.flag-np { background-position: 0 65.04064%; }
.flag-nr { background-position: 0 65.447144%; }
.flag-nu { background-position: 0 65.853648%; }
.flag-nz { background-position: 0 66.260152%; }
.flag-om { background-position: 0 66.666656%; }
.flag-pa { background-position: 0 67.07316%; }
.flag-pe { background-position: 0 67.479664%; }
.flag-pf { background-position: 0 67.886168%; }
.flag-pg { background-position: 0 68.292672%; }
.flag-ph { background-position: 0 68.699176%; }
.flag-pk { background-position: 0 69.10568%; }
.flag-pl { background-position: 0 69.512184%; }
.flag-pm { background-position: 0 69.918688%; }
.flag-pn { background-position: 0 70.325192%; }
.flag-pr { background-position: 0 70.731696%; }
.flag-pt { background-position: 0 71.1382%; }
.flag-pw { background-position: 0 71.544704%; }
.flag-py { background-position: 0 71.951208%; }
.flag-qa { background-position: 0 72.357712%; }
.flag-re { background-position: 0 72.764216%; }
.flag-ro { background-position: 0 73.17072%; }
.flag-rs { background-position: 0 73.577224%; }
.flag-ru { background-position: 0 73.983728%; }
.flag-rw { background-position: 0 74.390232%; }
.flag-sa { background-position: 0 74.796736%; }
.flag-sb { background-position: 0 75.20324%; }
.flag-sc { background-position: 0 75.609744%; }
.flag-sd { background-position: 0 76.016248%; }
.flag-se { background-position: 0 76.422752%; }
.flag-sg { background-position: 0 76.829256%; }
.flag-sh { background-position: 0 77.23576%; }
.flag-si { background-position: 0 77.642264%; }
.flag-sj { background-position: 0 78.048768%; }
.flag-sk { background-position: 0 78.455272%; }
.flag-sl { background-position: 0 78.861776%; }
.flag-sm { background-position: 0 79.26828%; }
.flag-sn { background-position: 0 79.674784%; }
.flag-so { background-position: 0 80.081288%; }
.flag-sr { background-position: 0 80.487792%; }
.flag-ss { background-position: 0 80.894296%; }
.flag-st { background-position: 0 81.3008%; }
.flag-sv { background-position: 0 81.707304%; }
.flag-sy { background-position: 0 82.113808%; }
.flag-sz { background-position: 0 82.520312%; }
.flag-tc { background-position: 0 82.926816%; }
.flag-td { background-position: 0 83.33332%; }
.flag-tf { background-position: 0 83.739824%; }
.flag-tg { background-position: 0 84.146328%; }
.flag-th { background-position: 0 84.552832%; }
.flag-tj { background-position: 0 84.959336%; }
.flag-tk { background-position: 0 85.36584%; }
.flag-tl { background-position: 0 85.772344%; }
.flag-tm { background-position: 0 86.178848%; }
.flag-tn { background-position: 0 86.585352%; }
.flag-to { background-position: 0 86.991856%; }
.flag-tp { background-position: 0 87.39836%; }
.flag-tr { background-position: 0 87.804864%; }
.flag-tt { background-position: 0 88.211368%; }
.flag-tv { background-position: 0 88.617872%; }
.flag-tw { background-position: 0 89.024376%; }
.flag-ty { background-position: 0 89.43088%; }
.flag-tz { background-position: 0 89.837384%; }
.flag-ua { background-position: 0 90.243888%; }
.flag-ug { background-position: 0 90.650392%; }
.flag-gb, .flag-uk { background-position: 0 91.056896%; }
.flag-um { background-position: 0 91.4634%; }
.flag-us { background-position: 0 91.869904%; }
.flag-uy { background-position: 0 92.276408%; }
.flag-uz { background-position: 0 92.682912%; }
.flag-va { background-position: 0 93.089416%; }
.flag-vc { background-position: 0 93.49592%; }
.flag-ve { background-position: 0 93.902424%; }
.flag-vg { background-position: 0 94.308928%; }
.flag-vi { background-position: 0 94.715432%; }
.flag-vn { background-position: 0 95.121936%; }
.flag-vu { background-position: 0 95.52844%; }
.flag-wf { background-position: 0 95.934944%; }
.flag-ws { background-position: 0 96.341448%; }
.flag-ye { background-position: 0 96.747952%; }
.flag-za { background-position: 0 97.154456%; }
.flag-zm { background-position: 0 97.56096%; }
.flag-zr { background-position: 0 97.967464%; }
.flag-zw { background-position: 0 98.373968%; }
.flag-nir { background-position: 0 98.780472%; }
.flag-eng { background-position: 0 99.186976%; }
.flag-wal { background-position: 0 99.59348%; }
.flag-sco { background-position: 0 100.0%; }

/* Header Content Blocks */
.entity-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.player-header-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.player-header-photo img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #27272a;
}

.player-header-info h1 {
    margin: 0;
    font-size: 28px;
}

.player-header-team {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}



/* --- Topbar & Logo --- */
.topbar {
    position: relative;
    z-index: 50; /* Ensure it stays above other content but below overlay if overlay is > 50 */
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between; /* Space out items: toggles/logo left/center, search right */
    position: relative;
    width: 100%;
}

.site-logo {
    display: block;
    color: #90909b; /* White logo */
    fill: currentColor;
    max-width: 145px; /* Adjust as needed */
    height: auto;
}

.branding {
    display: flex;
    align-items: center;
}

/* Desktop Search */
.desktop-search {
    display: block;
    flex-grow: 1;
    max-width: 400px;
    margin-left: auto; /* Push to right */
}

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

.search-input {
    width: 100%;
    padding: 8px 12px 8px 36px; /* Space for icon */
    border-radius: 4px;
    border: 1px solid #333;
    background: #1a1a1c;
    color: #fff;
    font-size: 14px;
}

.search-icon-inside {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}

/* Mobile Toggles */
.mobile-search-btn {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

/* Mobile Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color); /* Match site bg or slightly darker */
    z-index: 1000;
    display: none; /* Hidden by default */
    flex-direction: column;
    padding: 20px;
}

.search-overlay.active {
    display: flex;
}

.search-overlay-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.search-form-overlay {
    flex-grow: 1;
}

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

.overlay-search-input {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border-radius: 6px;
    border: 1px solid #3f3f46;
    background: #27272a;
    color: #fff;
    font-size: 16px;
    outline: none;
}

.overlay-search-input:focus {
    border-color: #52525b;
}

.overlay-search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 18px;
}

.close-overlay-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 28px;
    cursor: pointer;
    padding: 4px;
}

.close-overlay-btn:hover {
    color: #fff;
}

.search-overlay-content {
    flex-grow: 1;
    overflow-y: auto;
}

.search-results-mobile h4 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.search-results-mobile ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.search-results-mobile li {
    margin-bottom: 2px;
}

.search-results-mobile a {
    display: flex;
    flex-direction: column;
    padding: 12px;
    background: var(--card-bg);
    border-radius: 4px;
    text-decoration: none;
    color: #fff;
    transition: background 0.2s;
    border: 1px solid transparent; /* Prevent jump on hover border */
}

.search-results-mobile a:hover {
    background: #27272a;
}

.result-type {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .desktop-search {
        display: none; /* Hide standard search input on mobile */
    }

    .mobile-search-btn {
        display: block; /* Show search icon on mobile */
    }

    /* Center Logo on Mobile */
    .topbar-inner {
        justify-content: center;
    }

    .branding {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    /* Keep toggles on sides */
    .mobile-menu-btn {
        position: absolute;
        left: 10px; /* Adjust padding matching container */
        display: block; /* Ensure visible */
    }

    .mobile-search-btn {
        position: absolute;
        right: 10px;
    }
}

/* --- Mobile Responsiveness for Player Rows --- */

/* Tablet Portrait / Large Mobile (768px) */
@media (max-width: 768px) {
    .heatmap-box {
        width: 36px; /* Reduced from 48px */
        font-size: 14px;
        min-height: 36px;
    }
    
    .heatmap-box svg, .heatmap-box .icon {
        width: 14px;
        height: 14px;
    }

    /* Info Card Optimization */
    .player-info-card {
        padding: 4px 4px;
    }

    .face-col {
        width: 32px;
    }
    
    .player-face-img, .player-face-placeholder {
        width: 24px;
        height: 24px;
    }

    .club-col {
        display: none;
    }

    .info-col {
        padding: 0 4px;
    }

    .info-col .flag {
        display: none !important;
    }
    
    .heatmap-container {
        max-width: none;
        overflow: visible;
    }
}

/* Small Mobile (480px) */
@media (max-width: 480px) {
    /* Show only last 3 items using nth-last-child logic */
    .heatmap-container .heatmap-box:not(:nth-last-child(-n+3)) {
        display: none;
    }
    
    .heatmap-box {
        width: 34px;
        font-size: 13px;
    }

    .player-name {
        font-size: 14px;
    }
}

/* Very Small Mobile (320px) */
@media (max-width: 320px) {
    .heatmap-box {
        width: 30px;
        min-height: 30px;
        font-size: 12px;
    }
}

