/* --- Global reset & viewport --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Auth-gated navigation --- */
body:not(.logged-in) #tab1,
body:not(.logged-in) .tablable1,
body:not(.logged-in) #hubradio,
body:not(.logged-in) .tablable2,
body:not(.logged-in) #tab4,
body:not(.logged-in) .tablable4 {
    display: none !important;
}

body:not(.logged-in) #tab3 {
    display: none;
}

body:not(.logged-in) .tablable3 {
    display: flex;
}

body:not(.logged-in) .tabs-container {
    justify-content: center;
}

body:not(.logged-in) .tabcontent1,
body:not(.logged-in) .tabcontent2 {
    display: none !important;
}

body:not(.logged-in) .tabcontent3 {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    grid-area: bottom;
    overflow-y: auto;
    padding: 16px;
}

/* --- App shell --- */
.tabcontainer {
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas:
        "top"
        "bottom";
    overflow: hidden;
}

h1 {
    font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
    font-size: clamp(14px, 2vw, 20px);
    color: white;
    text-align: left;
    margin-left: 5px;
    margin-top: 0;
    margin-bottom: 0;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.popup-card h3 {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    border-left: 4px solid #3498db;
    padding-left: 10px;
}

ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    gap: 3px;
}

li {
    cursor: pointer;
    border-bottom: 1px solid #f1f1f1;
    margin: 10px;
    text-align: center;
}

.p1 {
    color: black;
}

.p2 {
    color: grey;
}

/* --- Mapbox popup (canonical) --- */
.mapboxgl-popup-content {
    padding: 12px 14px !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    height: auto !important;
    min-width: 150px;
    color: inherit !important;
}

.mapboxgl-popup-close-button {
    font-size: 16px;
    color: #9ca3af;
    padding: 4px 8px;
    top: 6px;
    right: 4px;
}

.mapboxgl-popup-close-button:hover {
    background: transparent;
    color: #374151;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid #f3f4f6;
    padding-right: 15px;
}

.popup-title {
    font-size: 14px;
    color: #1f2937;
    font-weight: 700;
}

.popup-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detailGrid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.gridItem {
    background: #f9fafb;
    padding: 6px 8px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    border: 1px solid #f3f4f6;
}

.gridLabel {
    font-size: 11px;
    color: #9ca3af;
    margin-bottom: 2px;
    font-weight: 500;
}

.gridLabel i {
    width: 12px;
    margin-right: 2px;
}

.gridValue {
    font-size: 13px;
    color: #374151;
    font-weight: 600;
}

.popup-footer {
    font-size: 11px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    grid-column: 1 / -1;
}

.popup-footer i {
    margin-right: 4px;
}

/* --- Shared hub panel visibility --- */
.peko {
    display: none;
    width: 100%;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
}

.peko.is-active {
    display: block;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .hello {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "logo tabs"
            "greeting greeting";
        row-gap: 8px;
    }

    .nav-section.greeting {
        grid-area: greeting;
        justify-self: center;
    }

    .tabs-container {
        grid-area: tabs;
        justify-self: end;
    }

    .hello > a,
    .nav-brand-cluster {
        grid-area: logo;
        justify-self: start;
    }
}

@media (max-width: 640px) {
    body:not(.logged-in) .tabcontent3 {
        padding: 8px;
    }
}
