/* --- CSS Variables (Customize Colors, Fonts) --- */
:root {
    --primary-font: 'Lato', sans-serif;
    --heading-font: 'Merriweather', serif;

    --primary-color: #005A9C; /* Suffolk County Flag Blue */
    --secondary-color: #00A1DE; /* Lighter Blue */
    --accent-color: #FFC107; /* Yellow/Gold */
    --dark-text: #333333;
    --light-text: #ffffff;
    --muted-text: #666666;
    --bg-light: #ffffff;
    --bg-medium: #f9f9f9;
    --bg-accent: #e6f3ff;
    --border-color: #dddddd;

    --container-width: 1140px;
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s ease;
}

/* --- Global Styles --- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--primary-font);
    line-height: 1.7;
    color: var(--dark-text);
    background-color: var(--bg-light);
    font-size: 16px;
}

.container {
    width: 90%;
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 15px;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--heading-font);
    color: var(--primary-color);
    line-height: 1.3;
    margin-bottom: 0.75em;
}

h1 { font-size: 2.8rem; margin-bottom: 0.5em; }
h2 { font-size: 2.2rem; }
h3 { font-size: 1.6rem; }

p {
    margin-bottom: 1em;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color var(--transition-speed);
}

a:hover, a:focus {
    color: var(--primary-color);
    text-decoration: underline;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.section-padding {
    padding: 60px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 40px;
    font-size: 2.5rem;
    position: relative;
}

.bg-medium { background-color: var(--bg-medium); }
.bg-accent { background-color: var(--bg-accent); }

.text-center { text-align: center; }

.sr-only { /* For screen readers */
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

hr.content-divider {
    border: 0; height: 1px; background-color: #e0e0e0; margin: 40px 0;
}
hr.content-divider-minor {
    border: 0; height: 1px; background-color: #eaeaea; margin: 30px auto; width: 80%;
}

/* --- Header --- */
.site-header {
    background-color: var(--bg-light);
    padding: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 3000; /* Keep header z-index lower than map overlays if they are viewport relative, but higher than page content */
    border-bottom: 3px solid var(--primary-color);
}
.header-flex { display: flex; justify-content: space-between; align-items: baseline; }
.logo-container { flex-shrink: 0; }
.site-title {
    font-family: var(--heading-font); font-size: 1.8rem; font-weight: bold;
    color: var(--primary-color); text-decoration: none;
}
.site-title:hover { color: var(--secondary-color); }
.main-nav { margin-left: auto; }
.main-nav ul { list-style: none; display: flex; gap: 25px; }
.main-nav a {
    font-family: var(--primary-font);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--dark-text);
    padding: 5px 5px; /* This padding affects vertical alignment/sizing */
    position: relative;
    letter-spacing: 0.5px;
    border-bottom: 2px solid transparent;
    transition: color var(--transition-speed), border-bottom-color var(--transition-speed);
}
.main-nav a:hover,
.main-nav a.active {
    color: var(--primary-color);
    border-bottom-color: var(--accent-color);
    text-decoration: none;
}
.mobile-nav-toggle { display: none; /* Hidden on desktop */ }

/* --- Hero Section --- */
.hero-section {
    position: relative; min-height: 70vh; display: flex; align-items: center;
    justify-content: center; text-align: center; color: var(--light-text); overflow: hidden;
}
.hero-image-container {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -1;
    background-repeat: no-repeat; background-position: center center; background-size: cover;
}
.hero-image-container::before { /* Darker overlay */
    content: ''; position: absolute; top:0; left:0; width: 100%; height: 100%;
    background-color: rgba(0,30,60,0.55); /* Dark blueish overlay */
}
.hero-content { position: relative; z-index: 1; padding: 20px; }
.hero-content h1 {
    font-size: 3.5rem; color: var(--light-text); text-shadow: 2px 2px 8px rgba(0,0,0,0.7);
    margin-bottom: 0.3em;
}
.hero-content .subtitle {
    font-size: 1.5rem; font-family: var(--primary-font); font-weight: 300;
    color: var(--light-text); text-shadow: 1px 1px 4px rgba(0,0,0,0.6);
    margin-bottom: 1.5em; max-width: 700px; margin-left: auto; margin-right: auto;
}

/* --- Page Hero Section (Simpler) --- */
.page-hero-section {
     position: relative; min-height: 35vh; display: flex; align-items: center;
     justify-content: center; text-align: center; color: var(--light-text);
     background-repeat: no-repeat; background-position: center center; background-size: cover;
     margin-bottom: 40px; /* Add some space below page hero */
 }
.page-hero-section::before { /* Darker overlay */
    content: ''; position: absolute; top:0; left:0; width: 100%; height: 100%;
    background-color: rgba(0, 30, 60, 0.6); /* Darker overlay */
}
.page-hero-content { position: relative; z-index: 1; padding: 20px; }
.page-hero-content h1 { font-size: 2.8rem; color: var(--light-text); text-shadow: 2px 2px 6px rgba(0,0,0,0.6); }
.page-hero-content .subtitle { font-size: 1.2rem; font-weight: 300; color: var(--light-text); text-shadow: 1px 1px 3px rgba(0,0,0,0.5); }

/* --- Buttons --- */
.btn {
    display: inline-block; padding: 12px 28px; font-family: var(--primary-font);
    font-weight: 700; text-decoration: none; border-radius: var(--border-radius);
    transition: background-color var(--transition-speed), transform var(--transition-speed);
    cursor: pointer; font-size: 1rem; text-transform: uppercase;
    letter-spacing: 0.5px; border: 2px solid transparent; margin: 5px;
}
.btn-primary { background-color: var(--accent-color); color: var(--dark-text); border-color: var(--accent-color); }
.btn-primary:hover { background-color: #ffcd38; color: var(--dark-text); transform: translateY(-2px); text-decoration:none; }
.btn-secondary { background-color: transparent; color: var(--light-text); border: 2px solid var(--light-text); }
.btn-secondary:hover { background-color: var(--light-text); color: var(--dark-text); transform: translateY(-2px); text-decoration:none; }
.hero-section .btn-secondary { border-color: var(--light-text); color: var(--light-text); } /* White border on hero */
.hero-section .btn-secondary:hover { background-color: var(--light-text); color: var(--primary-color); }
.call-to-action-gallery .btn-secondary { border-color: var(--primary-color); color: var(--primary-color); } /* Button on light bg */
.call-to-action-gallery .btn-secondary:hover { background-color: var(--primary-color); color: var(--light-text); }
.btn-large { padding: 15px 35px; font-size: 1.1rem; }

/* --- General Sections --- */
.introduction-section h2 { text-align: center; font-size: 2.0rem; margin-bottom: 30px; }
.introduction-section p { font-size: 1.1rem; color: var(--muted-text); text-align: center; max-width: 800px; margin-left: auto; margin-right: auto; }

/* --- Cards (Homepage Key Areas) --- */
.cards-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.card {
    background-color: var(--bg-light); padding: 30px; border-radius: var(--border-radius);
    box-shadow: var(--box-shadow); transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    display: flex; flex-direction: column; text-align: center;
}
.card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }
.card-icon { width: 50px; height: 50px; margin: 0 auto 15px auto; }
.card h3 { font-size: 1.4rem; margin-bottom: 10px; color: var(--primary-color); }
.card p { color: var(--muted-text); font-size: 0.95rem; flex-grow: 1; margin-bottom: 15px; }
.card-link { font-weight: bold; color: var(--secondary-color); text-decoration: none; align-self: center; }
.card-link:hover { color: var(--primary-color); text-decoration: underline; }

/* --- Latest Updates (Homepage) --- */
.updates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 30px; }
.update-item {
    background-color: var(--bg-light); border-radius: var(--border-radius);
    box-shadow: var(--box-shadow); overflow: hidden; display: flex; flex-direction: column;
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}
.update-item:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.12); }
.update-image { width: 100%; height: 200px; object-fit: cover; }
.update-content { padding: 20px; flex-grow: 1; display: flex; flex-direction: column; }
.update-content h3 { font-size: 1.3rem; margin-bottom: 8px; }
.update-content .update-date { font-size: 0.85rem; color: var(--muted-text); margin-bottom: 10px; display: block; }
.update-content p { font-size: 0.95rem; color: var(--muted-text); flex-grow: 1; margin-bottom: 15px; }
.read-more-link { font-weight: bold; color: var(--secondary-color); text-decoration: none; align-self: flex-start; }
.read-more-link:hover { color: var(--primary-color); }

/* --- Quick Poll (Homepage - Structure only) --- */
.quick-poll-section label { margin-left: 5px; }
.quick-poll-section button { margin-top: 10px; }

/* --- Content Article (Issue Explained) --- */
.content-article h2 { margin-top: 40px; }
.content-article h3 { font-size: 1.4rem; margin-top: 30px; color: var(--dark-text); }
.content-article ul { list-style: disc; margin-left: 40px; margin-bottom: 1em; }
.content-article li { margin-bottom: 0.5em; }
.content-article figure { margin-bottom: 1.5em; }
.content-article figure img { border-radius: var(--border-radius); box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.content-article figure figcaption { font-size: 0.85rem; color: var(--muted-text); text-align: center; margin-top: 0.5em; font-style: italic; }
.inline-image-right { float: right; margin-left: 20px; margin-bottom: 10px; max-width: 45%; }
.inline-image-left { float: left; margin-right: 20px; margin-bottom: 10px; max-width: 45%; }
.content-article section::after { content: ""; display: table; clear: both; } /* Clear floats */

/* === ADD THESE NEW STYLES FOR THE HISTORY SECTION LAYOUT === */
#history h2 {
    text-align: center;
    margin-bottom: 25px;
}
.history-layout-container {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    align-items: flex-start;
}
.history-column {
    flex: 1;
    min-width: 300px;
}
.history-column figure img {
    max-width: 100%;
    height: auto;
    display: block;
}
.history-column h3:first-child {
    margin-top: 0;
}
@media (max-width: 768px) {
    .history-layout-container {
        flex-direction: column;
    }
    .history-column {
        min-width: 100%;
        margin-bottom: 30px;
    }
    .history-column:last-child {
        margin-bottom: 0;
    }
}
/* === END OF NEW STYLES FOR HISTORY SECTION LAYOUT === */

/* --- Gallery Page --- */
.gallery-intro p { font-size: 1.05rem; text-align: center; max-width: 800px; margin: 0 auto; }
.gallery-category-title { font-size: 1.8rem; color: var(--primary-color); margin-top: 40px; margin-bottom: 20px; text-align: center; border-bottom: 2px solid var(--bg-accent); padding-bottom: 10px; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-bottom: 30px; }
.gallery-item {
    border: 1px solid var(--border-color); border-radius: var(--border-radius); overflow: hidden;
    background-color: var(--bg-light); box-shadow: 0 2px 5px rgba(0,0,0,0.07);
    transition: transform var(--transition-speed), box-shadow var(--transition-speed); text-align: center;
}
.gallery-item:hover { transform: translateY(-3px); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.gallery-item a { display: block; } /* Make link clickable on whole image area */
.gallery-item img { width: 100%; height: 200px; object-fit: cover; display: block; }
.gallery-item.placeholder img { filter: grayscale(80%) opacity(60%); }
.gallery-item figcaption { padding: 10px; font-size: 0.9rem; color: var(--muted-text); background-color: var(--bg-medium); }

/* --- Visualizations Page --- */
.visualization-article { margin-bottom: 40px; padding: 20px; background-color: var(--bg-medium); border-radius: var(--border-radius); }
.visualization-title { font-size: 1.8rem; color: var(--primary-color); margin-bottom: 20px; text-align: center; padding-bottom: 10px; border-bottom: 2px solid var(--bg-accent); }
.map-container { width: 100%; height: 500px; background-color: #e9e9e9; border-radius: var(--border-radius); margin-bottom: 20px; border: 1px solid var(--border-color); }
.map-container p { line-height: 450px; text-align: center; color: var(--muted-text); } /* Placeholder text */
.map-image {
    display: block;
    max-width: 64.5%;
    height: auto;
    margin-left: auto;
    margin-right: auto;
}
.chart-container { width: 100%; max-width: 800px; margin: 20px auto; padding: 15px; background-color: var(--bg-light); border-radius: var(--border-radius); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }
.chart-container canvas { width: 100% !important; height: auto !important; } /* Ensure canvas is responsive */
.chart-container h3 { text-align: center; font-size: 1.2rem; margin-top: 10px; color: var(--dark-text); }
.pie-chart-container { display: flex; justify-content: space-around; flex-wrap: wrap; gap: 20px; }
.pie-chart { max-width: 1000px; } /* Was 450px, increased for better display if needed */
.analysis-text { margin-top: 15px; }
.analysis-text h3 { font-size: 1.4rem; color: var(--dark-text); margin-bottom: 10px; }
.analysis-text p, .analysis-text ul { font-size: 0.95rem; line-height: 1.6; color: var(--muted-text); }
.analysis-text ul { list-style: disc; margin-left: 20px; margin-bottom: 1em; }
.table-container { margin-top: 30px; }
.styled-table { width: 100%; border-collapse: collapse; margin: 25px 0; font-size: 0.9em; min-width: 400px; border-radius: 5px 5px 0 0; overflow: hidden; box-shadow: 0 0 20px rgba(0, 0, 0, 0.15); }
.styled-table thead tr { background-color: var(--primary-color); color: var(--light-text); text-align: left; font-weight: bold; }
.styled-table th, .styled-table td { padding: 12px 15px; }
.styled-table tbody tr { border-bottom: 1px solid #dddddd; }
.styled-table tbody tr:nth-of-type(even) { background-color: #f3f3f3; }
.styled-table tbody tr:last-of-type { border-bottom: 2px solid var(--primary-color); }
.color-box { display: inline-block; width: 15px; height: 15px; margin-right: 5px; border: 1px solid #ccc; vertical-align: middle; }

@media (max-width: 768px) {
  .chart-container { /* For Plotly charts */
    position: relative;
    width: 100% !important;
    max-width: 100% !important;
    height: 400px; 
    padding: 10px;
    margin: 20px auto;
    box-sizing: border-box;
    overflow-x: auto;
  }
  .chart-container .plot-container,
  .chart-container .js-plotly-plot {
    height: 100% !important;
    width: 100% !important;
  }
  .chart-container canvas { /* For Chart.js if used */
    width: 100% !important;
    height: 100% !important;
  }
}

/* --- Engage Page --- */
.involvement-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.involvement-card {
    background-color: var(--bg-medium); padding: 25px; border-radius: var(--border-radius);
    box-shadow: var(--box-shadow); display: flex; flex-direction: column;
    align-items: center; text-align: center;
}
.involvement-card h3 { font-size: 1.5rem; color: var(--primary-color); margin-bottom: 15px; }
.involvement-icon { width: 60px; height: 60px; margin-bottom: 15px; opacity: 0.7; }
.involvement-card p { font-size: 0.95rem; color: var(--muted-text); margin-bottom: 15px; }
.involvement-card ul { list-style: none; padding-left: 0; text-align: left; width: 100%; }
.involvement-card li { font-size: 0.9rem; color: var(--dark-text); margin-bottom: 8px; line-height: 1.5; }
.involvement-card a { font-weight: bold; }

/* --- Footer --- */
.site-footer-bottom {
    background-color: #2c3e50; color: #bdc3c7; padding: 30px 0;
    text-align: center; font-size: 0.9rem; margin-top: 40px;
}
.site-footer-bottom .footer-nav { margin-bottom: 15px; }
.site-footer-bottom .footer-nav a { color: #ecf0f1; margin: 0 10px; text-decoration: none; }
.site-footer-bottom .footer-nav a:hover { color: var(--light-text); text-decoration: underline; }
.site-footer-bottom p { margin-bottom: 5px; }
.site-footer-bottom .disclaimer { font-size: 0.8rem; font-style: italic; color: #95a5a6; }

/* --- Responsive Design --- */
@media (max-width: 992px) {
    .hero-content h1 { font-size: 2.8rem; }
    .hero-content .subtitle { font-size: 1.3rem; }
    .page-hero-content h1 { font-size: 2.4rem; }
    .page-hero-content .subtitle { font-size: 1.1rem; }
    .cards-container { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));}
}

@media (max-width: 768px) {
    h1 { font-size: 2.3rem; }
    h2 { font-size: 1.8rem; }
    .section-padding { padding: 40px 0; }

    .header-flex { flex-direction: column; align-items: flex-start; }
    .main-nav { width: 100%; margin-top: 15px; display: none; }
    .main-nav.active { display: block; } /* Shown by JS */
    .main-nav ul { flex-direction: column; gap: 0; }
    .main-nav li { width: 100%; }
    .main-nav a { display: block; padding: 12px 15px; border-bottom: 1px solid var(--border-color); }
    .main-nav a::after { display: none; }
    .mobile-nav-toggle {
        display: block; background: none; border: none; font-size: 1.8rem;
        color: var(--primary-color); cursor: pointer; position: absolute;
        top: 20px; right: 20px;
    }

    .hero-section { min-height: 60vh; }
    .hero-content h1 { font-size: 2.2rem; }
    .hero-content .subtitle { font-size: 1.1rem; }
    .btn { padding: 10px 20px; font-size: 0.9rem;}

    .inline-image-right, .inline-image-left {
        float: none; max-width: 90%; margin: 15px auto;
    }

    .cards-container { grid-template-columns: 1fr; }
    .updates-grid { grid-template-columns: 1fr; }
    .involvement-grid { grid-template-columns: 1fr; }
    .pie-chart-container { flex-direction: column; align-items: center; }
    .pie-chart { max-width: 100%; } /* Allow pie chart to fill width */
}


/* === CSS Appended from leaflet.html for Interactive Map === */
#map { 
    height: 75vh; 
    width: 100%; 
    box-shadow: 0 0 10px rgba(0,0,0,0.1); 
    border-radius: var(--border-radius); 
    margin-bottom: 15px; 
    position: relative; /* <<<< ESSENTIAL CHANGE: Make #map the positioning context */
}

/* Info Box - positioned relative to #map */
.info-box {
    position: absolute;
    top: 30px;    /* Adjusted: Simple offset from map top */
    left: 55px;   /* Adjusted: Simple offset from map left */
    background: rgba(255, 255, 255, 0.92);
    padding: 0; 
    border-radius: 6px;
    z-index: 1010; /* Ensure it's above map tiles and most controls */
    max-width: 320px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
    font-size: 0.875em; 
}
.info-box-header {
    padding: 10px 15px;
    font-size: 1.1em;
    color: #2c3e50; 
    border-bottom: 1px solid #e0e0e0; 
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold; 
}
.info-box-header:hover { background-color: #f9f9f9; }
.info-box-toggle-icon { font-size: 0.8em; margin-left: 5px; }
.info-box-content { padding: 0px 15px 12px 15px; line-height: 1.5; }
.info-box-content.collapsed { display: none; }
.info-box-content p { margin-bottom: 6px; color: #34495e; margin-top: 10px; }
.info-box-content p:first-child { margin-top: 8px; }

#server-notice-container div { 
    padding: 10px; 
    background-color: #fffbe6; 
    border: 1px solid #ffe58f; 
    text-align: center; 
    font-family: var(--primary-font); 
    font-size: 0.9em; 
    color: #8a6d3b; 
    margin-bottom:10px;
    border-radius: var(--border-radius);
}

/* Custom Layer Control Container - positioned relative to #map */
.custom-layer-control-container {
    position: absolute;
    top: 10px;   /* Adjusted: Simple offset from map top */
    right: 10px;  /* Adjusted: Simple offset from map right */
    z-index: 1011; /* Above info box and other controls */
    background: rgba(255, 255, 255, 0.92);
    border-radius: 6px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.2);
    font-size: 0.9em;
}
.layer-control-header {
    padding: 8px 12px;
    font-size: 1.05em;
    font-weight: bold;
    color: #2c3e50;
    cursor: pointer;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.layer-control-header:hover { background-color: #f9f9f9; }
.layer-control-toggle-icon { font-size: 0.8em; margin-left: 5px; }
.leaflet-control-layers-host { /* Container for Leaflet's control DOM */ }
.leaflet-control-layers-host.collapsed-control { display: none; }
.custom-layer-control-container .leaflet-control-layers { 
    box-shadow: none; 
    border-radius: 0 0 6px 6px; 
    border-top: none; 
}
.leaflet-control-layers-expanded { padding: 8px 10px; }
.leaflet-control-layers-list { line-height: 1.6; }
.leaflet-control-layers-selector { margin-bottom: 4px; vertical-align: middle; }
.leaflet-control-layers-separator { margin: 5px 0; border-top: 1px solid #e0e0e0; }

.leaflet-popup-content-wrapper { border-radius: 6px; box-shadow: 0 1px 5px rgba(0,0,0,0.15); }
.leaflet-popup-content { font-size: 0.875em; line-height: 1.6; margin: 10px 12px; }
.leaflet-popup-content strong { 
    font-size: 1.05em; 
    color: var(--primary-color); 
    display: block; 
    margin-bottom: 5px; 
    border-bottom: 1px solid #f0f0f0; 
    padding-bottom: 4px; 
    font-family: var(--heading-font); 
}
.leaflet-popup-content em { font-style: normal; font-weight: 500; color: #555; }

.legend {
    color: #444; background-color: rgba(255, 255, 255, 0.93); padding: 0; 
    border-radius: 5px; box-shadow: 0 1px 7px rgba(0,0,0,0.25);
    font-size: 0.825em; min-width: 160px; max-width: 240px; 
    z-index: 1005; /* Default Leaflet controls are around 1000 */
}
.legend-header {
    padding: 8px 12px; font-size: 1.05em; font-weight: bold; color: #2c3e50;
    cursor: pointer; border-bottom: 1px solid #e0e0e0; display: flex;
    justify-content: space-between; align-items: center;
}
.legend-header:hover { background-color: #f9f9f9; }
.legend-toggle-icon { font-size: 0.8em; margin-left: 5px; }
.legend-content { padding: 8px 12px; max-height: 350px; overflow-y: auto; } 
.legend-content.collapsed { display: none; }
.legend h4 { 
    margin: 8px 0 6px; 
    font-size: 0.95em; 
    font-weight: bold; 
    color: var(--primary-color); 
    text-align: left; 
    font-family: var(--heading-font);
}
.legend h4:first-child { margin-top: 0; }
.legend .legend-subtitle { text-align: left; font-size: 0.85em; margin-bottom: 6px; color: #555; display: block; }
.legend .legend-item { display: flex; align-items: center; margin-bottom: 4px; justify-content: space-between;}
.legend .legend-item-main { display: flex; align-items: center; flex-grow: 1;}
.legend i { width: 16px; height: 16px; flex-shrink: 0; margin-right: 8px; opacity: 0.9; border: 1px solid #bbb; }
.legend .legend-item img.legend-swatch-image { width: 18px; height: 18px; margin-right: 8px; border: 1px solid #ddd; }
.legend .legend-text { flex-grow: 1; line-height: 1.3; }
.legend .arcgis-legend-item i { background-color: #eee; border: 1px dashed #999; }
.legend .zoom-to-layer-btn {
    font-size: 0.9em; padding: 1px 4px; margin-left: 8px; cursor: pointer;
    border: 1px solid #ccc; border-radius: 3px; background-color: #f0f0f0;
    white-space: nowrap; 
    color: var(--dark-text);
}
.legend .zoom-to-layer-btn:hover { background-color: #e0e0e0; }

.town-label, .pond-label {
    background-color: transparent; border: none; box-shadow: none;
    font-weight: bold; color: #222; 
    text-shadow: 1px 1px 2px white, -1px -1px 2px white, 1px -1px 2px white, -1px 1px 2px white; 
}
.town-label { font-size: 10px; }
.pond-label { 
    font-size: 11px; 
    font-weight: 500; 
    color: #004C6D; 
    text-shadow: 1px 1px 1px #fff, -1px -1px 1px #fff, 1px -1px 1px #fff, -1px 1px 1px #fff, 0 0 3px #fff; 
}
        
#map-loader {
    position: absolute; 
    top: 50%;  /* Centered on map container */
    left: 50%; 
    transform: translate(-50%, -50%); /* Proper centering */
    z-index: 2000; 
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px 10px; 
    border-radius: 4px; 
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    display: none; 
    font-family: var(--primary-font);
    color: var(--dark-text);
}
.spinner {
    border: 3px solid #f3f3f3; 
    border-top: 3px solid var(--secondary-color); 
    border-radius: 50%; 
    width: 16px; height: 16px;
    animation: spin 1s linear infinite; 
    display: inline-block; 
    margin-right: 5px;
    vertical-align: middle;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.leaflet-control-container .leaflet-control {
    font-family: var(--primary-font); 
}

/* Responsive adjustments for map elements (now relative to map) */
@media (max-width: 768px) {
    #map {
        height: 60vh; 
    }
    .info-box {
        max-width: 280px; 
        font-size: 0.8em; 
        top: 5px;    /* Adjusted: Closer to map edge on mobile */
        left:5px;   /* Adjusted: Closer to map edge on mobile */
    }
    .custom-layer-control-container {
        font-size: 0.85em;
        top: 5px;    /* Adjusted: Closer to map edge on mobile */
        right: 5px;  /* Adjusted: Closer to map edge on mobile */
    }
    .legend {
        font-size: 0.75em; 
        max-width: 200px;
    }
    .legend-content {
         max-height: 200px; 
    }
}
/* === End of Appended CSS for Interactive Map === */