html, body {
    min-height: 100%;
    margin: 0;
}

#map {
    height: 100vh;
    width: 100%;
    padding-top: 100px;
}

.leaflet-container {
    background: #111;
}

/* ── Badge DivIcon markers ── */
.badge-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.85);
    box-shadow: 0 1px 5px rgba(0,0,0,0.7);
    background: #222;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
}
.badge-icon-wrap:hover {
    transform: scale(1.3);
    box-shadow: 0 2px 10px rgba(0,0,0,0.9);
}
.badge-icon-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
/* Fallback when no badge image */
.badge-icon-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}
/* Size variants */
.badge-sz-32 { width: 32px; height: 32px; }
.badge-sz-24 { width: 24px; height: 24px; }
.badge-sz-20 { width: 20px; height: 20px; }
/* Active markers get a coloured border highlight */
.badge-active { border-color: #fff; border-width: 2.5px; }

/* ── Multi-tenant split badge ─────────────────────────────────────────────── */
/* .badge-icon-wrap needs relative so the +N counter can be positioned inside */
.badge-icon-wrap { position: relative; }

/* Override the centering flex so the two halves can fill the full height */
.badge-split { align-items: stretch; }

.badge-split .badge-half {
    flex: 1;
    min-width: 0;
    height: 100%;
    object-fit: cover;   /* img */
    display: block;
    width: 100%;         /* div fallback */
}
.badge-split .badge-half-fallback { background: #9e9e9e; }
.badge-split .badge-half:first-child:not(:last-child) {
    border-right: 1.5px solid rgba(255,255,255,0.5);
}

/* "+N" mini-counter shown when a stadium has 3+ tenants */
.badge-extra-count {
    position: absolute;
    bottom: 1px; right: 1px;
    font-size: 7px; font-weight: 700;
    line-height: 12px;
    width: 12px; height: 12px;
    text-align: center;
    background: rgba(0,0,0,0.82);
    color: #fff;
    border-radius: 50%;
    pointer-events: none;
}

/* ── Multi-tenant popup logo strip ───────────────────────────────────────── */
.popup-tenant-strip {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 8px;
}
.popup-tenant-logo-btn {
    background: none;
    border: 2px solid transparent;
    border-radius: 50%;
    padding: 2px;
    cursor: pointer;
    transition: border-color 0.12s;
    flex-shrink: 0;
}
.popup-tenant-logo-btn.active,
.popup-tenant-logo-btn:hover { border-color: #4fc3f7; }
.popup-tenant-logo-btn img,
.popup-tenant-logo-btn .btn-logo-fallback {
    width: 32px; height: 32px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}
.popup-tenant-logo-btn .btn-logo-fallback { background: #555; }

/* Only the active panel is visible */
.popup-tenant-panel          { display: none; }
.popup-tenant-panel.active   { display: block; }

/* Single-team popup: small logo above the team name */
.popup-single-logo {
    display: block;
    width: 34px; height: 34px;
    object-fit: contain;
    margin-bottom: 3px;
}

/* ── Marker hover tooltip ── */
.badge-tooltip {
    background: rgba(8, 10, 22, 0.93) !important;
    color: #e8eeff !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: 6px !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    padding: 4px 10px !important;
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.7) !important;
    white-space: nowrap !important;
    backdrop-filter: blur(6px);
    pointer-events: none;
}
/* Tip arrow inherits dark background */
.badge-tooltip.leaflet-tooltip-top::before {
    border-top-color: rgba(8, 10, 22, 0.93) !important;
}

.leaflet-popup-content {
    font-size: 14px;
}

.stadium-hero-img {
    height: 400px;
    object-fit: cover;
}

/* ── Gallery hero carousel ── */
.gallery-hero {
    position: relative;
    width: 100%;
    height: 480px;
    background: #111;
    overflow: hidden;
}

.gallery-track {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.gallery-track::-webkit-scrollbar {
    display: none;
}

.gallery-slide {
    flex: 0 0 100%;
    height: 100%;
    scroll-snap-align: start;
}

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-name-overlay {
    position: absolute;
    bottom: 1.5rem;
    left: 1.5rem;
    color: #fff;
    font-size: 2rem;
    font-weight: 800;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
    pointer-events: none;
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.65);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 2.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.55);
    user-select: none;
    z-index: 10;
}

.gallery-arrow:hover {
    background: rgba(0,0,0,0.88);
    border-color: rgba(255,255,255,0.7);
    transform: translateY(-50%) scale(1.08);
}

.gallery-arrow-prev {
    left: 1rem;
}

.gallery-arrow-next {
    right: 1rem;
}

.gallery-dots {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
}

.gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    border: none;
    cursor: pointer;
    padding: 0;
    transition: background 0.2s;
}

.gallery-dot.active {
    background: #fff;
}

@media (max-width: 768px) {
    .gallery-hero {
        height: 300px;
    }
    .gallery-name-overlay {
        font-size: 1.4rem;
    }
}

.card {
    border-radius: 14px;
}

.card:hover {
    transform: scale(1.01);
    transition: 0.2s;
}

.leaflet-popup-content {
    max-height: 280px;
    overflow-y: auto;
}

.leaflet-popup-content-wrapper {
    max-width: 300px;
}

.topbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 64px;
    background: #171b1f;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 14px;
}

.site-title {
    color: white;
    font-size: 22px;
    white-space: nowrap;
}

.main-links {
    display: flex;
    gap: 14px;
}

.main-links a {
    color: white;
    text-decoration: none;
    font-weight: 500;
}

.main-links a:hover {
    text-decoration: underline;
}

.filters {
    margin-left: auto;
    display: flex;
    gap: 16px;
    align-items: center;
}

.sticky-jump-menu {
    top: 70px;
    z-index: 2000;
}

.sticky-jump-menu .card-body {
    padding: 0.75rem 1rem;
}

.jump-menu-wrapper {
    position: sticky;
    top: 0;
    z-index: 3000;
    background: white;
    padding: 0.5rem 0;
}

.jump-menu-spacer {
    height: 0.5rem;
}

.team-logo-wrap {
    height: 150px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

.team-logo {
    max-height: 120px;
    max-width: 120px;
    object-fit: contain;
}

.team-logo-placeholder {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.team-card .card-title {
    min-height: 48px;
}

html {
    scroll-behavior: smooth;
}

.team-jump-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 3000;
    background: white;
    padding: 0.5rem 0;
}

.team-jump-menu-spacer {
    height: 75px;
}

.fixed-team-nav {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    width: 100%;
    z-index: 99999;
    background: yellow !important;
    border-bottom: 1px solid #ddd;
    padding: 10px 16px;
}

.fixed-team-nav-spacer {
    height: 70px;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
}



.stadium-map-card {
    max-width: 420px;
}



.team-map-logo {
    width: 54px;
    height: 54px;
    object-fit: contain;
}



.team-map-logo-placeholder {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

.stadium-map-card {
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

#stadium-detail-map {
    height: 420px;
    width: 100%;
}

#stadium-3d-map {
    height: 480px !important;
    width: 100% !important;
}

.stadium-logo-marker {
    width: 64px !important;
    height: 64px !important;
    background: transparent !important;
    border-radius: 50% !important;
    padding: 7px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.65) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    z-index: 9999 !important;
}

.stadium-logo-marker img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    display: block !important;
}

.legend {
    background: rgba(23, 27, 31, 0.95) !important;
    padding: 14px 16px !important;
    border-radius: 14px !important;
    color: white !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.45) !important;
    min-width: 140px;
    font-size: 14px;
    z-index: 9999;
}

.leaflet-control.legend {
    background: rgba(23, 27, 31, 0.95) !important;
    padding: 14px 16px !important;
    border-radius: 14px !important;
    color: white !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.45) !important;
    min-width: 140px;
    font-size: 14px;
}

.legend-title {
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 700;
    color: white;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    color: white;
}

.legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 10px;
    border: 2px solid rgba(255,255,255,0.75);
}

.serie-a {
    background: #00c853;
}

.serie-b {
    background: white;
}

.serie-c {
    background: #ff1744;
}

.mode-switch-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: 24px;
    color: white;
    white-space: nowrap;
}

.mode-label {
    font-size: 13px;
    font-weight: 700;
    opacity: 0.45;
}

.mode-label.active {
    opacity: 1;
}

.mode-switch {
    position: relative;
    display: inline-block;
    width: 74px;
    height: 36px;
    margin: 0;
}

.mode-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.mode-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: linear-gradient(135deg, #00c853, #00e5ff);
    border-radius: 999px;
    transition: 0.25s;
    box-shadow: inset 0 0 4px rgba(255,255,255,0.4);
}

.mode-slider::before {
    content: "";
    position: absolute;
    width: 28px;
    height: 28px;
    left: 4px;
    top: 4px;
    background: white;
    border-radius: 50%;
    transition: 0.25s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.45);
}

.mode-switch input:checked + .mode-slider {
    background: linear-gradient(135deg, #ffc107, #ff1744);
}

.mode-switch input:checked + .mode-slider::before {
    transform: translateX(38px);
}

.status-planning {
    background: #ffc107;
}

.status-approved {
    background: #ff9800;
}

.status-construction {
    background: #ff1744;
}
.image-credit {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    text-align: right;
    padding-right: 4px;
    line-height: 1.2;
}

.card-img-top {
    width: 100%;
    height: 260px;
    object-fit: cover;
}

@media (max-width: 768px) {
    .card-img-top {
        height: 220px;
    }
}

.stadium-popup {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.stadium-popup h4 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 800;
}

.popup-city {
    margin: 0 0 12px;
    color: #666;
    font-size: 14px;
}

.popup-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
    border-top: 1px solid #e6e6e6;
    font-size: 14px;
}

.popup-btn {
    display: block;
    margin-top: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #f1f3f5;
    color: #111;
    text-decoration: none;
    font-weight: 700;
    text-align: center;
}

.popup-primary {
    background: #111;
    color: white;
}

@media (max-width: 768px) {
    .leaflet-popup-content-wrapper {
        border-radius: 18px;
    }

    .leaflet-popup-content {
        width: 300px !important;
        margin: 18px;
    }

    .stadium-popup h4 {
        font-size: 22px;
    }

    .popup-city {
        font-size: 16px;
    }

    .popup-row {
        font-size: 16px;
        padding: 11px 0;
    }

    .popup-btn {
        font-size: 17px;
        padding: 16px;
        border-radius: 14px;
    }

    .leaflet-popup-close-button {
        font-size: 28px !important;
        width: 36px !important;
        height: 36px !important;
        line-height: 32px !important;
    }
}

/* ── Country-League Picker ───────────────────────────────────────────────── */
.clp-wrap {
    position: relative;
    flex-shrink: 0;
}

/* The trigger button looks like a form-select but is a <button> */
.clp-trigger {
    cursor: pointer;
    text-align: left;
    width: clamp(160px, 18vw, 260px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* form-select already supplies bg-color, border, padding, caret arrow */
}

/* Dropdown panel */
.clp-panel {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 200px;
    max-height: 70vh;
    overflow-y: auto;
    background: rgba(23, 27, 31, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
    z-index: 9999;
    padding: 4px 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.2) transparent;
}

/* Country row */
.clp-country-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    color: #ccd6ff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s;
    gap: 8px;
}

.clp-country-row:hover,
.clp-country-row.active {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
}

/* Chevron rotates when accordion is open */
.clp-chevron {
    font-size: 14px;
    opacity: 0.45;
    transition: transform 0.18s, opacity 0.18s;
    flex-shrink: 0;
    line-height: 1;
}

.clp-country-row.open .clp-chevron {
    transform: rotate(90deg);
    opacity: 1;
}

/* League list — accordion: collapses via max-height */
.clp-leagues {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.22s ease;
}

.clp-leagues.open {
    max-height: 320px;
}

/* League row */
.clp-league-row {
    padding: 5px 14px 5px 30px;
    color: #8ab4ff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    white-space: nowrap;
}

.clp-league-row:hover {
    background: rgba(100, 160, 255, 0.12);
    color: #fff;
}

.clp-league-row.active {
    color: #fff;
    font-weight: 700;
}

/* Mobile: full-width panel */
@media (max-width: 768px) {
    .clp-panel {
        min-width: calc(100vw - 24px);
        left: 0;
    }
    .clp-trigger {
        width: clamp(140px, 40vw, 220px);
    }
}

/* ── CLP active-state (stronger visual) ── */
.clp-country-row.active {
    background: rgba(100, 160, 255, 0.18);
    color: #fff;
    border-left: 3px solid #4a9eff;
}
.clp-league-row.active {
    background: rgba(100, 160, 255, 0.14);
    color: #fff;
    font-weight: 700;
    border-left: 3px solid #4a9eff;
    padding-left: 27px;
}
.clp-country-row:hover:not(.active) {
    background: rgba(255, 255, 255, 0.07);
}

/* ── Filter active-state highlight (ownership, stadium selects) ── */
select.filter-has-value {
    border-color: #4a9eff !important;
    box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.25);
    color: #fff;
}

/* ── Live search ── */
.search-wrap {
    position: relative;
    flex-shrink: 0;
    width: clamp(160px, 18vw, 300px);
}
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    background: #1a1a1a;
    border: 1px solid #555;
    border-top: none;
    border-radius: 0 0 6px 6px;
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 220px;
    overflow-y: auto;
}
.search-results li {
    padding: 8px 12px;
    color: #ddd;
    cursor: pointer;
    font-size: 13px;
}
.search-results li:hover { background: #333; }

/* ── Mobile: compact inline filter bar ── */
@media (max-width: 768px) {
    /* Filter drawer stays as the navbar second row — always visible */
    #filterDrawer {
        gap: 5px !important;
        padding: 2px 0 6px !important;
        flex-wrap: wrap !important;
    }

    /* Compact controls */
    #filterDrawer .form-select,
    #filterDrawer .form-control,
    #filterDrawer .clp-trigger {
        font-size: 13px !important;
        padding: 3px 8px !important;
        height: 32px;
    }

    /* Search spans its own full-width row */
    .search-wrap {
        flex: 0 0 100%;
        width: 100%;
    }

    /* Stadium / project pickers have too many entries for mobile */
    #stadiumFilter,
    #developmentStadiumFilter { display: none !important; }

    /* Map: full viewport, offset for 2-row navbar */
    #map {
        height: 100dvh;
        padding-top: 120px;
    }

    /* Mobile bottom sheet */
    #mobileSheet.open {
        display: block;
    }
}

/* Bottom sheet — hidden by default on all viewports; shown only on mobile via .open */
#mobileSheet {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2000;
    background: #1a1d21;
    border-radius: 16px 16px 0 0;
    max-height: 60vh;
    overflow-y: auto;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.7);
    color: #e0e0e0;
}
#mobileSheetInner {
    padding: 8px 16px 28px;
}
#mobileSheetClose {
    position: sticky;
    top: 0;
    float: right;
    background: rgba(26, 29, 33, 0.95);
    border: none;
    color: #aaa;
    font-size: 22px;
    line-height: 1;
    padding: 10px 14px;
    cursor: pointer;
    z-index: 1;
    border-radius: 0 16px 0 8px;
}
#mobileSheetClose:hover { color: white; }