/* Main Styles - Based on Pico CSS Framework with Custom Colors */
:root {
    --pico-font-family-sans-serif: Inter, system-ui, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, Helvetica, Arial, "Helvetica Neue", sans-serif, var(--pico-font-family-emoji);
    --pico-font-size: 16px;
    --pico-line-height: 1.25;
    --pico-form-element-spacing-vertical: 0.5rem;
    --pico-form-element-spacing-horizontal: 1.0rem;
    --pico-border-radius: 0.375rem;
    --pico-outline-width: 0.2rem;
    --pico-primary-focus: #202632 !important;
    
    /* Custom colors that work with light theme */
    --primary-color: #714a6d;
    --secondary-color: #31a354;
    --accent-color: #3388ff;
    --danger-color: #e34a33;
    --panel-background: #f8f9fa;
    --panel-border: #e9ecef;
}

/* Force light theme colors */
[data-theme="light"],
:root:not([data-theme="dark"]) {
    --pico-background-color: #ffffff;
    --pico-color: #1f2937;
    --pico-muted-color: #6b7280;
    --pico-muted-border-color: #d1d5db;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: transparent;
}

/* Navigation Bar */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: white;
    border-bottom: 1px solid var(--muted-border-color);
    padding: 0.1rem 1rem;
    height: 2rem;
    display: flex;
    align-items: center;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1rem;
    align-items: center;
    margin: 0;
    width: 100%;
}

nav a {
    text-decoration: none;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
    font-size: 1rem;
    /* color: var(--primary-color); */
}

nav a:hover {
    background-color: var(--muted-color);
    /* color: white; */
}

nav strong {
    margin-right: auto;
    font-size: 1.25rem;
    color: var(--primary-color);
}

/* Nav button styling */
.nav-button {
    all: unset;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    transition: background-color 0.2s ease;
    font-size: 1rem;
    cursor: pointer;
    color: var(--primary-color);
    background-color: transparent;
}

.nav-button:hover {
    background-color: var(--secondary-color);
    color: white;
}

.nav-button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Layer toggle in navbar */
.nav-toggle {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    padding-left: 1rem;
    border-left: 1px solid var(--muted-border-color);
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    margin: 0;
}

.toggle-label input[type="checkbox"] {
    margin: 0;
}

/* Map Container */
main {
    position: fixed;
    top: 2rem;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100%;
    height: calc(100vh - 2rem);
}

#map {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Floating Sidebar */
aside {
    position: fixed;
    top: 2.75rem;
    left: 1rem;
    z-index: 999;
    background-color: white;
    border: 1px solid var(--muted-border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
    width: 280px;
    max-height: calc(100vh - 4.5rem);
    overflow-y: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

aside h2 {
    margin-top: 0;
    font-size: 1rem;
    margin-bottom: 0.7rem;
    color: var(--form-element-valid-border-color);
}

aside ul {
    padding-left: 0;
}

/* Legend Sidebar (Right) */
.legend-sidebar {
    left: auto;
    right: 1rem;
    width: 280px;
}

/* Accessible Accordion Styles */
.accordion {
    width: 100%;
}

.accordion h2 {
    margin: 0;
}

.accordion-trigger {
    all: unset;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0;
    margin: 0;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--form-element-valid-border-color);
    text-align: left;
    transition: color 0.2s;
}

.accordion-trigger:hover {
    color: var(--primary-color);
}

.accordion-trigger:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 0.25rem;
}

.accordion-title {
    flex: 1;
}

.accordion-icon {
    width: 1rem;
    height: 1rem;
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
    position: relative;
}

.accordion-icon::before,
.accordion-icon::after {
    content: '';
    position: absolute;
    background-color: currentColor;
    transition: transform 0.3s ease;
}

/* Horizontal line */
.accordion-icon::before {
    width: 100%;
    height: 2px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

/* Vertical line */
.accordion-icon::after {
    width: 2px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

/* When expanded, hide the vertical line to create a minus sign */
.accordion-trigger[aria-expanded="true"] .accordion-icon::after {
    transform: translateX(-50%) rotate(90deg) scaleX(0);
}

.accordion-panel {
    padding-top: 0.75rem;
    transition: height 0.3s ease, opacity 0.3s ease;
}

.accordion-panel[hidden] {
    display: none;
}

/* Legend Content Styles */
.legend-section {
    margin-bottom: 1rem;
}

.legend-section h3 {
    font-size: 0.9rem;
    margin: 0 0 0.75rem 0;
    color: var(--pico-color);
    font-weight: 600;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.legend-marker {
    display: flex;
    align-items: center;
    justify-content: center;
}

.legend-label {
    font-size: 0.9rem;
    font-weight: 500;
}

.legend-details ul {
    list-style: none;
    padding-left: 0;
    margin: 0.5rem 0;
}

.legend-details li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
}

.legend-color-box {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    border: 1px solid var(--muted-border-color);
}

.legend-color-box.inactive {
    background-color: #d1d5db;
    opacity: 0.4;
}

/* Legend Grid for Quarter Explanations */
.legend-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--muted-border-color);
    border: 1px solid var(--muted-border-color);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.legend-grid-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0.5rem;
}

.legend-quarter-example {
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-color);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    flex-shrink: 0;
}

.legend-quarter-example .quarter {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
}

.legend-quarter-example .quarter.active {
    background-color: var(--primary-color);
}

/* Colorbar styling for legend */
.legend-colorbar-container {
    margin: 0.5rem 0 1rem 0;
    padding: 0.5rem;
    background-color: var(--panel-background);
    border-radius: 0.25rem;
}

.legend-colorbar {
    width: 100%;
    margin-bottom: 0.25rem;
}

.legend-colorbar svg {
    display: block;
    width: 100%;
    height: 20px;
    border-radius: 2px;
}

.legend-colorbar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--muted-color);
    font-style: italic;
}

/* Layer toggle in sidebar */
.basemap-toggle {
    display: flex;
    /* align-items: center; */
    /* gap: 1.5rem; */
    /* margin-left: auto; */
    padding-left: 0;
    border-left: 3px solid var(--muted-border-color);
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 1rem;
    /* margin-left: auto; */
    padding-left: 0;
    /* padding-left: 1rem; */
    /* border-left: 1px solid var(--muted-border-color); */
}

/* Control Group */
.control-group {
    margin-bottom: 1.5rem;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.control-group input[type="checkbox"] {
    cursor: pointer;
    width: auto;
    margin: 0;
}

.control-group p {
    margin: 0.5rem 0 0 0;
    font-size: 0.875rem;
    color: var(--muted-color);
}

/* Button Styles */
button {
    width: 100%;
    margin-bottom: 0.5rem;
}

button:last-child {
    margin-bottom: 0;
}

/* Floating attribution (Leaflet-like) */
.floating-attribution {
    position: fixed;
    left: 0.5rem;
    bottom: 0.5rem;
    z-index: 1100;
    background: rgba(255,255,255,0.9);
    color: var(--muted-color);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    line-height: 1;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.floating-attribution a {
    color: inherit;
    text-decoration: underline;
}

.floating-attribution a:hover {
    text-decoration: none;
}

/* Center and fix the Leaflet zoom control buttons */
.leaflet-control-zoom {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 0.5em;
    overflow: hidden;
}

.leaflet-control-zoom a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 2rem; /* Adjust as needed */
    font-weight: bold;
    width: 2.5em;
    height: 2.5em;
    background: #fff;
    color: #333;
    border: 1px solid #bbb;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border-radius: 0;
    transition: background 0.2s, color 0.2s;
}

.leaflet-control-zoom a:hover,
.leaflet-control-zoom a:focus {
    background: #f0f0f0;
    color: var(--pico-primary-border);
    outline: 2px solid var(--pico-primary-border);
}

/* Prevent Pico CSS from styling custom leaflet markers */
.custom-bench-marker,
.custom-lighting-marker {
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.custom-bench-marker svg,
.custom-lighting-marker svg {
    display: block;
    background: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Park Popup Styles */
.park-popup {
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 300px;
}

.park-popup h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.park-details {
    margin-bottom: 0.75rem;
}

.park-details p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.park-details strong {
    color: var(--pico-color);
}

.park-features {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--muted-border-color);
}

.park-features p {
    margin: 0 0 0.5rem 0;
    font-weight: 600;
}

.park-features ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.park-features li {
    padding: 0.25rem 0.5rem;
    margin: 0.25rem 0;
    background-color: var(--panel-background);
    border-radius: 0.25rem;
    font-size: 0.85rem;
}

.park-link {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--muted-border-color);
}

.park-link a {
    display: inline-block;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

.park-link a:hover {
    text-decoration: underline;
}

/* Custom Park Marker - Square with 4 Quarters */
.custom-park-marker {
    border: none;
    background: transparent;
}

.park-marker-square {
    width: 24px;
    height: 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    background: white;
    padding: 2px;
    border: 2px solid white;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.2s;
}

.park-marker-square:hover {
    transform: scale(1.15);
    z-index: 1000;
}

/* Map markers only - position to align with focus indicator */
.custom-park-marker .park-marker-square {
    position: absolute;
    top: 0px;
    left: 2px;
}

.park-marker-square .quarter {
    width: 100%;
    height: 100%;
    border-radius: 1px;
}

.park-marker-square .quarter.active {
    background-color: var(--primary-color);
}

.park-marker-square .quarter.inactive {
    background-color: #d1d5db;
    opacity: 0.4;
}

/* Specific quadrant positions for color coding (optional future enhancement) */
.park-marker-square .top-left.active {
    /* Café - could use different color like #8B4513 (brown) */
}

.park-marker-square .top-right.active {
    /* Playground - could use different color like #31a354 (green) */
}

.park-marker-square .bottom-left.active {
    /* Accessibility - could use different color like #3388ff (blue) */
}

.park-marker-square .bottom-right.active {
    /* Toilet - could use different color like #9b59b6 (purple) */
}

/* Park Tooltip Styles */
.park-tooltip {
    background-color: white;
    border: 2px solid var(--primary-color);
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.park-tooltip::before {
    border-top-color: var(--primary-color);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid var(--muted-border-color);
}

.modal-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.modal-close {
    all: unset;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 2rem;
    line-height: 1;
    color: var(--muted-color);
    transition: background-color 0.2s, color 0.2s;
}

.modal-close:hover {
    background-color: var(--panel-background);
    color: var(--pico-color);
}

.modal-close:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    position: relative;
}

/* Custom scrollbar styling */
.modal-body::-webkit-scrollbar {
    width: 12px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--panel-background);
    border-radius: 0.5rem;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 0.5rem;
    border: 2px solid var(--panel-background);
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #5a3a57;
}

/* Scroll indicator */
/* .modal-body::after {
    content: '↓ Scroll for more';
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    display: block;
    text-align: center;
    padding: 1rem;
    background: linear-gradient(to top, rgba(255,255,255,0.95) 60%, transparent);
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s;
} */

.modal-body.scrolled-to-bottom::after {
    opacity: 0;
}

.modal-body section {
    margin-bottom: 1rem;
}

.modal-body section:last-child {
    margin-bottom: 0;
}

.modal-body h3 {
    color: var(--primary-color);
    font-size: 1.1rem;
    margin: 0 0 1rem 0;
}

.modal-body ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.modal-body ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
    font-size: 1.1rem;
}

.modal-body li {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.modal-body strong {
    color: var(--pico-color);
}

.modal-legend {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem;
    background: var(--panel-background);
    border-radius: 0.5rem;
}

.modal-legend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-marker-example {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    flex-shrink: 0;
}

.modal-marker-example .quarter {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
}

.modal-marker-example .quarter.active {
    background-color: var(--primary-color);
}

.modal-note {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--muted-color);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--muted-border-color);
    display: flex;
    justify-content: flex-end;
}

.modal-close-btn {
    all: unset;
    padding: 0.5rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 600;
    transition: opacity 0.2s;
}

.modal-close-btn:hover {
    opacity: 0.9;
}

.modal-close-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Floating Scale Bar Styling */
.leaflet-control-scale {
    position: fixed !important;
    bottom: 0.5rem !important; /* Align with bottom of copyright section */
    left: 50% !important;
    transform: translateX(-50%);
    margin-left: 200px !important; /* Offset to move right of copyright */
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 4px 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    font-family: var(--pico-font-family);
    z-index: 400;
}

.leaflet-control-scale-line {
    border: 2px solid #333;
    border-top: none;
    color: #333;
    font-size: 11px;
    line-height: 1.1;
    padding: 2px 5px 1px;
    background: transparent;
    text-shadow: none;
}
/* Hide elements during map export */
@media print {
    nav,
    aside:not(.legend-sidebar),
    .leaflet-control-zoom {
        display: none !important;
    }
}

.leaflet-easyPrint-button {
    display: none !important;
}

/* Legend styling */
.legend-label-link {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

.legend-label-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Action buttons in modals */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin: 1rem 0;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
    background-color: var(--panel-background);
    border: 2px solid var(--panel-border);
    border-radius: var(--pico-border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.action-btn:hover {
    background-color: var(--muted-color);
    border-color: var(--primary-color);
}

.action-btn strong {
    color: var(--primary-color);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.action-btn small {
    color: var(--pico-muted-color);
    font-size: 0.875rem;
}

.action-note {
    margin-top: 1rem;
    padding: 0.75rem;
    background-color: rgba(51, 136, 255, 0.05);
    border-left: 3px solid var(--accent-color);
    border-radius: var(--pico-border-radius);
    font-size: 0.9rem;
}

.bench-marker::selection {
    background-color: transparent !important;
}

.bench-marker div::selection {
    background-color: transparent !important;
}
