/**
 * EMF Mapper - Site Stylesheet
 * ============================
 * Eén begrijpbaar CSS bestand voor de hele site.
 * Geen Tailwind, geen complexe build tools.
 * 
 * Structuur:
 * 1. CSS Variabelen (kleuren, spacing)
 * 2. Reset & Basis
 * 3. Typography
 * 4. Layout (containers, grid)
 * 5. Navigatie
 * 6. Footer
 * 7. Buttons & Forms
 * 8. Cards & Sections
 * 9. Utilities
 * 10. Map Controls (geimporteerd)
 */

/* Import base-styles voor kaart controls positionering */
@import url('/css/base-styles.css');

/* ============================================
   1. CSS VARIABELEN
   ============================================ */
:root {
    /* Kleuren */
    --color-brand: #336699;
    --color-brand-dark: #264d73;
    --color-brand-light: #4a7fb3;
    
    --color-text: #374151;
    --color-text-light: #6b7280;
    --color-text-dark: #111827;
    
    --color-bg: #e4ebfc;
    --color-bg-white: #ffffff;
    --color-bg-dark: #1f2937;
    
    --color-border: #e5e7eb;
    --color-border-dark: #d1d5db;
    
    /* Spacing */
    --space-xs: 0.25rem;   /* 4px */
    --space-sm: 0.5rem;    /* 8px */
    --space-md: 1rem;      /* 16px */
    --space-lg: 1.5rem;    /* 24px */
    --space-xl: 2rem;      /* 32px */
    --space-2xl: 3rem;     /* 48px */
    
    /* Layout */
    --container-max: 1100px;
    --container-padding: 1rem;
    --nav-height: 66px;  /* Vaste hoogte navigatiemenu */
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    
    /* Border radius */
    --radius-sm: 0.5rem;    /* 8px - was 4px */
    --radius-md: 0.5rem;    /* 8px - was 6px */
    --radius-lg: 0.75rem;   /* 12px - was 8px */
    --radius-xl: 1rem;      /* 16px - was 12px */
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* ============================================
   2. RESET & BASIS
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: var(--nav-height);
}

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

a {
    color: var(--color-brand);
    text-decoration: none;
}

a:hover {
    color: var(--color-brand-dark);
    text-decoration: underline;
}

/* ============================================
   3. TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-brand);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: var(--space-md);
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

p {
    margin-bottom: var(--space-md);
}

.text-sm { font-size: var(--font-size-sm); }
.text-lg { font-size: var(--font-size-lg); }
.text-muted { color: var(--color-text-light); }

/* ============================================
   4. LAYOUT
   ============================================ */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

.page-content {
    flex: 1;
    padding: var(--space-xl) 0;
}

/* Flexbox helpers */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* Grid */
.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   5. NAVIGATIE
   ============================================ */
.nav-main {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    min-height: var(--nav-height);
    display: flex;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10100; /* Higher than map elements (10000) */
    transition: transform 0.3s ease;
    overflow: visible;
}

.nav-main.nav-hidden {
    transform: translateY(-100%);
}

/* Add padding to body to compensate for fixed header */
body {
    padding-top: var(--nav-height);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
    height: var(--nav-height); /* Ensure container has fixed height */
    position: relative; /* Make this the positioning context for nav-mobile */
}

.nav-logo {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: #336699;
    text-decoration: none;
}

.nav-logo:hover {
    color: #336699;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    list-style: none;
}

.nav-link {
    display: block;
    padding: var(--space-sm) var(--space-md);
    color: var(--color-text);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.nav-link:hover {
    background-color: var(--color-bg-white);
    color: var(--color-brand);
    text-decoration: none;
}

.nav-link.active {
    background-color: var(--color-brand);
    color: white;
}

.nav-link.active:hover {
    background-color: var(--color-brand-dark);
}

/* Auth links rechts */
.nav-auth {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Mobile menu */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: var(--space-sm);
    color: var(--color-text);
}

/* Mobile Menu Container */
.nav-mobile {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 10100;
    max-height: calc(100vh - var(--nav-height));
    overflow-y: auto;
}

.nav-mobile.active {
    display: block;
}

/* Mobile Menu Content */
.nav-mobile-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-mobile-link {
    display: block;
    padding: 0.75rem 1rem;
    color: #111827;
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.5rem;
    transition: background-color 0.2s, color 0.2s;
}

.nav-mobile-link:hover {
    background-color: #f3f4f6;
    color: #336699;
    text-decoration: none;
}

.nav-mobile-link.active {
    background-color: #336699;
    color: white;
}

.nav-mobile-link.active:hover {
    background-color: #2d5986;
}

.nav-mobile-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 0.5rem 0;
}

/* Mobile Menu Overlay */
.nav-mobile-overlay {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 10099;
}

.nav-mobile-overlay.active {
    display: block;
}

@media (max-width: 900px) {
    .nav-menu {
        display: none;
    }
    
    /* User menu blijft zichtbaar maar compacter */
    .nav-auth {
        display: flex;
        align-items: center;
        gap: var(--space-xs);
    }
    
    .nav-toggle {
        display: block;
    }
}

/* ============================================
   6. FOOTER
   ============================================ */
.footer-main {
    background: var(--color-bg-dark);
    color: #d1d5db;
    padding: var(--space-2xl) 0 var(--space-xl);
    margin-top: auto;
}

/* Hide footer on home and map pages */
/* Map page - body has class page-fullscreen-map */
body.page-fullscreen-map footer.footer-main {
    display: none !important;
}

/* Homepage - hide footer when hero section exists */
/* Using :has() selector for modern browsers */
body:has(.page-content .hero) footer.footer-main,
body:has(.hero) footer.footer-main {
    display: none !important;
}

/* Fallback: hide footer if it comes after page-content with hero */
.page-content:has(.hero) ~ footer.footer-main {
    display: none !important;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

.footer-title {
    color: white;
    font-size: var(--font-size-base);
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: var(--space-sm);
}

.footer-links a {
    color: #9ca3af;
    text-decoration: none;
    font-size: var(--font-size-sm);
}

.footer-links a:hover {
    color: white;
    text-decoration: none;
}

.footer-bottom {
    border-top: 1px solid #374151;
    padding-top: var(--space-lg);
    font-size: var(--font-size-sm);
    color: #9ca3af;
}

/* ============================================
   7. BUTTONS & FORMS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--font-size-base);
    font-weight: 500;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.1s;
    color: var(--color-text, #374151);
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background-color: var(--color-brand);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-brand-dark);
    color: white;
}

.btn-secondary {
    background-color: var(--color-bg);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

/* Smaller buttons in detail tables */
.detail-table .btn {
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
}

.btn-secondary:hover {
    background-color: var(--color-border);
    color: var(--color-text);
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

/* Form elements */
.form-group {
    margin-bottom: var(--space-md);
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-xs);
    color: var(--color-text-dark);
}

.form-input {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-base);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-brand);
    box-shadow: 0 0 0 3px rgba(51, 102, 153, 0.1);
}

/* ============================================
   8. CARDS & SECTIONS
   ============================================ */
.card {
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-lg);
    border: 1px solid var(--color-border);
}

.card-highlight {
    border-left: 4px solid var(--color-brand);
}

.section {
    padding: var(--space-md) 0;
}

.section-title {
    text-align: center;
    margin-bottom: var(--space-xl);
}

/* Hero section */
.hero {
    padding: var(--space-2xl) 0;
}

.hero-title {
    font-size: 2.5rem;
    margin-bottom: var(--space-sm);
}

.hero-subtitle {
    font-size: var(--font-size-lg);
    color: var(--color-text-light);
    margin-bottom: var(--space-lg);
}

/* Statistics */
.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-brand);
}

/* Images */
.img-rounded {
    border-radius: var(--radius-lg);
    width: 100%;
    height: auto;
}

/* ============================================
   9. UTILITIES
   ============================================ */
.hidden { display: none !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Spacing utilities */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.py-sm { padding-top: var(--space-sm); padding-bottom: var(--space-sm); }
.py-md { padding-top: var(--space-md); padding-bottom: var(--space-md); }
.py-lg { padding-top: var(--space-lg); padding-bottom: var(--space-lg); }

/* Text alignment */
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Background colors */
.bg-white { background-color: var(--color-bg-white); }
.bg-light { background-color: var(--color-bg); }

/* ============================================
   10. UI COMPONENTS
   ============================================ */

/* Peak Value Badge - site-wide colored badge for EMF values */
.peak-value-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 8px;
    font-weight: 400; /* Default weight - children override */
    font-size: 0.8125rem;
    color: white;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.peak-value-badge__number {
    font-weight: 600; /* Bold number */
}

.peak-value-badge__unit {
    font-weight: 400; /* Regular unit */
}

.peak-value-badge--small {
    padding: 2px 6px;
    font-size: 0.6875rem;
}

.peak-value-badge--large {
    padding: 6px 14px;
    font-size: 1rem;
    font-weight: 700;
}

/* ============================================
   11. PAGE LAYOUTS
   ============================================ */

/* Measurement Detail Page */
.content-container {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-dark);
}

.meta {
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Details Grid (max 3 columns) */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
    align-items: start; /* Allow cards to have their own height */
}

@media (min-width: 1200px) {
    .details-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Mobile: Vertical snap scroll for focused card viewing */
@media (max-width: 768px) {
    .content-container {
        scroll-snap-type: y proximity;
        overflow-y: auto;
        padding: 1rem 0; /* Remove horizontal padding, minimal vertical */
    }
    
    .details-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem; /* Smaller gap between cards on mobile */
    }
    
    .details-grid .card {
        scroll-snap-align: start;
        scroll-snap-stop: normal;
        min-height: auto; /* Let cards size to their content */
        padding: 1rem; /* Reduce card padding on mobile */
        border-radius: 0; /* Full width cards without rounded corners */
    }
}

/* Details Grid with max 2 columns */
.details-grid-max-2 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    max-width: 100%;
}

@media (min-width: 769px) {
    .details-grid-max-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Section title (for additional measurements) */
.section-title {
    font-size: 1.5rem;
    margin: 2rem 0 1.5rem 0;
    color: var(--color-text-dark);
    border-bottom: 2px solid var(--color-brand);
    padding-bottom: 0.5rem;
}

/* Measurements Chart Component */
.chart-info {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 1rem;
}

.measurements-chart-container {
    display: grid;
    grid-template-columns: 80px 1fr;
    grid-template-rows: 1fr auto;
    gap: 0.5rem;
    margin-top: 1rem;
    min-height: 300px;
    padding-right: 1.5rem;
}

/* Y-axis */
.chart-y-axis {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-right: 0.75rem;
    grid-row: 1;
    grid-column: 1;
    text-align: right;
}

.chart-y-label {
    font-size: 0.75rem;
    color: var(--color-text-light);
    text-align: right;
}

/* Chart area */
.chart-area {
    position: relative;
    grid-row: 1;
    grid-column: 2;
    background: #fafafa;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

/* Grid lines */
.chart-grid {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.chart-grid-line {
    border-top: 1px solid #e0e0e0;
}

/* Line connecting points */
.chart-line-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.chart-line {
    fill: none;
    stroke: #999;
    stroke-width: 1;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Data points */
.chart-points {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.chart-point {
    position: absolute;
    transform: translate(-50%, 50%);
    cursor: pointer;
    transition: transform 0.2s;
    z-index: 10;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
}

.chart-point:hover {
    transform: translate(-50%, 50%) scale(1.3);
    z-index: 20;
}

.chart-point svg {
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

/* X-axis */
.chart-x-axis {
    position: relative;
    grid-row: 2;
    grid-column: 2;
    height: 40px;
}

.chart-x-label {
    position: absolute;
    transform: translateX(-50%);
    text-align: center;
    font-size: 0.75rem;
    white-space: nowrap;
}

.chart-x-date {
    color: var(--color-text);
    font-weight: 600;
    white-space: nowrap;
}

.chart-x-time {
    color: var(--color-text-light);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .measurements-chart-container {
        min-height: 250px;
    }
    
    .chart-y-axis {
        width: 50px;
    }
    
    .chart-x-label {
        font-size: 0.65rem;
    }
    
    .chart-point svg {
        width: 1.2rem;
        height: 1.2rem;
    }
}

/* Card component */
.card {
    background: var(--color-bg-white);
    border-radius: var(--radius-md, 8px);
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    position: relative;
}

/* Card with navigation */
.card.has-nav {
    /* No extra padding needed - nav is absolute positioned */
}

.card.has-nav h2 {
    padding-right: 200px; /* Space for nav buttons + issue button */
}

.card-title-with-nav {
    margin-bottom: 0;
}

/* Entity Navigation Component */
.entity-nav {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}

.entity-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--color-bg-light);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.entity-nav-btn:hover:not(.entity-nav-disabled):not([data-disabled="true"]) {
    background: var(--color-brand);
    border-color: var(--color-brand);
    color: white;
    transform: scale(1.1);
}

.entity-nav-btn:active:not(.entity-nav-disabled):not([data-disabled="true"]) {
    transform: scale(0.95);
}

.entity-nav-disabled,
.entity-nav-btn[data-disabled="true"] {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.entity-nav-btn svg {
    display: block;
}

@media (max-width: 768px) {
    .entity-nav {
        top: 0.5rem;
        right: 0.5rem;
    }
    
    .entity-nav-btn {
        width: 28px;
        height: 28px;
    }
}

/* Single card outside grid - limit width for better readability */
.content-container > .card {
    max-width: 600px;
}

/* Component divider - HR above secondary sections */
.component-divider {
    border: none;
    border-top: 2px solid var(--color-border);
    margin: 0 0 1rem 0;
}

.card h2 {
    font-size: 1.1rem;
    margin-bottom: 0;
    color: var(--color-text-dark);
    border-bottom: 1px solid var(--color-border, #eee);
    padding: 0.5rem 0 0.75rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card h2 svg {
    flex-shrink: 0;
    vertical-align: baseline;
}

/* Tabel, foto's en spectrum direct na h2 - geen marge */
.card h2 + table,
.card h2 + .detail-table,
.card h2 + .image-grid,
.card h2 + .spectrum-chart,
.card h2 + .spectrum-container,
.card h2 + div {
    margin-top: 0;
}

.card dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem 1rem;
}

.card dt {
    font-weight: 600;
    color: var(--color-text-light);
}

.card dd {
    color: var(--color-text);
}

/* Data tables */
/* Detail table - used in all detail components */
.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--color-border);
    vertical-align: top;
}

.detail-table td:first-child {
    color: var(--color-text-light);
    font-weight: 500;
    width: 40%;
}

.detail-table td:last-child {
    color: var(--color-text);
}

/* Remove border from last row by default */
.detail-table tr:last-child td,
.measurement-table tr:last-child td {
    border-bottom: none;
}

/* But keep border for rows with border-bottom-row class (like ID rows) */
.detail-table tr.border-bottom-row td,
.measurement-table tr.border-bottom-row td {
    border-bottom: 1px solid var(--color-border, #e5e7eb) !important;
}

/* Only rows with bg-row class get background color */
.detail-table tr.bg-row td {
    background: var(--color-bg, #e4ebfc);
}

/* Measurement table */
.measurement-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.measurement-table th,
.measurement-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.measurement-table th:first-child,
.measurement-table td:first-child {
    text-align: left;
    width: 30%;
}

.measurement-table th:nth-child(2),
.measurement-table td:nth-child(2) {
    text-align: right;
    width: 35%;
}

.measurement-table th:nth-child(3),
.measurement-table td:nth-child(3) {
    text-align: right;
    width: 35%;
}

.measurement-table th {
    background: var(--color-bg, #e4ebfc);
    font-weight: 600;
}

.measurement-table tr.summary {
    font-weight: 600;
    background: var(--color-bg, #e4ebfc);
}

/* Badges in summary row should align with numbers above */
.measurement-table tr.summary td {
    vertical-align: middle;
}

/* Make badges in table use same font-size as regular numbers */
.measurement-table tr.summary .peak-value-badge {
    font-size: 1rem;
    font-weight: 600;
    padding: 2px 8px;
    /* Badge extends beyond the number but number aligns */
    position: relative;
    display: inline-block;
}

/* Ensure the number inside badge has same styling as numbers above */
.measurement-table tr.summary .peak-value-badge__number {
    font-size: 1rem;
    font-weight: 600;
}

.measurement-table tr.summary .peak-value-badge__unit {
    font-size: 1rem;
    font-weight: 400;
}

/* Value variants */
.value-high { color: #dc3545; font-weight: 600; }
.value-medium { color: #fd7e14; }
.value-low { color: #28a745; }

/* Media section */
.media-section {
    background: var(--color-bg-white);
    border-radius: var(--radius-md, 8px);
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

/* Measurements chart (for location pages with multiple measurements) */
.measurements-chart {
    background: var(--color-bg-white);
    border-radius: var(--radius-md, 8px);
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.measurements-chart > h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--color-text-dark);
    border-bottom: 2px solid var(--color-brand);
    padding-bottom: 0.5rem;
}

/* Measurements section (for location pages) */
.measurements-section {
    background: var(--color-bg-white);
    border-radius: var(--radius-md, 8px);
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.measurements-section > h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--color-text-dark);
    border-bottom: 2px solid var(--color-brand);
    padding-bottom: 0.5rem;
}

/* Measurement divider */
.measurement-divider {
    border: none;
    border-top: 2px solid var(--color-border);
    margin: 2rem 0;
}

/* Images component */
.image-count {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}

/* Spectrum component */
.spectrum-count {
    font-size: 0.875rem;
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}

.spectrum-single {
    margin-top: 1rem;
}

.spectrum-single img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    background: #000;
}

.spectrum-caption {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-light);
    font-style: italic;
}

.spectrum-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.spectrum-item {
    position: relative;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: #000;
}

.spectrum-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.2s;
}

.spectrum-item:hover img {
    transform: scale(1.05);
}

.spectrum-item-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    text-align: center;
}

.spectrum-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 600;
}

.image-single {
    margin-top: 1rem;
}

.image-single img {
    width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    max-height: 400px;
    object-fit: contain;
}

.image-caption {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--color-text-light);
    font-style: italic;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 1rem;
}

.image-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: #f0f0f0;
}

.image-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.image-item:hover img {
    transform: scale(1.05);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 600;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
}

.lightbox-close:hover {
    color: #ccc;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: var(--radius-md);
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-size: 30px;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.4);
}

.lightbox-prev {
    left: -60px;
}

.lightbox-next {
    right: -60px;
}

.lightbox-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.lightbox-caption {
    color: white;
    font-size: 1rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-close {
        right: 20px;
        top: 10px;
    }
}

.measurement-block-title {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--color-text-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* Media within measurement block */
.measurement-media {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.measurement-media h4 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--color-text-dark);
}

/* Small media grid (preview) */
.media-grid-small {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.media-item-small {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: #f0f0f0;
}

.media-item-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-more {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-brand);
    color: white;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.media-item img {
    width: 100%;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

/* Debug section */
.debug {
    background: #f8f8f8;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 1rem;
    margin: 2rem 0;
    font-size: 0.85rem;
}

.debug summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.debug pre {
    overflow: auto;
    max-height: 400px;
    background: white;
    padding: 1rem;
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .meta { flex-direction: column; align-items: flex-start; }
}

/* ============================================
   12. UTILITY CLASSES (additional)
   ============================================ */

/* Button group */
.btn-group {
    display: flex;
    gap: 0.5rem;
}

/* External link */
.link-external {
    display: inline-block;
    color: var(--color-brand);
    text-decoration: none;
}

.link-external:hover {
    text-decoration: underline;
}

/* List utilities */
.list-plain {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-item-bordered {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

/* Map loading overlay */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 999;
    background: var(--color-bg-white);
    padding: 20px 30px;
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    text-align: center;
}

.map-loading.hidden { display: none; }

/* Spinner animation */
.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 10px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--color-brand);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Map loading indicator */
.map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    text-align: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.map-loading.hidden {
    display: none;
}

.map-loading .spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 1rem;
    border: 3px solid #e5e7eb;
    border-top-color: #336699;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.map-loading p {
    margin: 0;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Map container (detail pages) */
#map-container {
    position: relative;
    width: 100%;
    height: 50vh;
    min-height: 350px;
    max-height: 500px;
}

/* MapLibre text labels - prevent large text during loading */
.maplibregl-canvas-container {
    font-size: 12px !important;
}

.maplibregl-canvas-container canvas {
    font-size: inherit;
}
