:root {
    --text-main: #111827;
    --text-muted: #6b7280;
    --primary: #2563eb;
    --secondary: #dd0000;
    --surface: #ffffff;
    --bg-citation: #f3f4f6;
    --border: #e5e7eb;
    --font-main: 'Inter', sans-serif;
    --shadow-lg: 0 10px 24px -3px rgba(0, 0, 0, 0.9), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
    font-family: var(--font-main);
    overflow: hidden;
}

#map {
    position: absolute;
    top: 0; bottom: 0; left: 0; right: 0;
    z-index: 1;
    background: #cad2d3;
}

/* .leaflet-geosearch-bar {
    background: none;
    position: fixed;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: block;
    height: auto;
    width: 400px;
    max-width: calc(100% - 120px);
    margin: 20px auto 0;
    cursor: auto;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
} */

.leaflet-container {
    font-family: 'Inter', sans-serif;
}

.reset {
    display: none;
}

.leaflet-control-minimap {
    border: none !important;
    border-radius: 12px;
    box-shadow: var(--shadow-lg) !important;
    position: fixed;
    right: 2rem;
    bottom: 2rem;
}

.leaflet-control-minimap,
.leaflet-control-minimap .leaflet-container {
    width: 225px !important;
    height: 225px !important;
}

.leaflet-control-minimap .leaflet-interactive {
    stroke: var(--accent) !important;
    stroke-width: 2px !important;
    fill: var(--primary) !important;
}

.leaflet-control-zoom {
    position: fixed;
    top: 2rem;
    right: 2rem;
}

.leaflet-control-layers {
    position: fixed;
    right: 20px;
    top: 20px;
}

.info-panel {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 2rem;
    width: 450px;
    max-height: calc(100vh - 40px);
    background: var(--surface);
    z-index: 1000;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: transform 0.6s ease, opacity 0.6s ease;
    overflow-x: hidden;
}

.panel-header {
    padding: 24px 24px 16px 24px;
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid transparent;
}

.panel-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.author-line {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.author-line a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color 0.6s;
}

.author-line a:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.panel-content {
    padding: 0 24px 24px 24px;
}

.cover-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 5px 12px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #374151;
    margin-bottom: 16px;
}

.citation-box {
    background: var(--bg-citation);
    border-left: 4px solid var(--primary);
    padding: 16px;
    border-radius: 0 8px 8px 0;
    margin: 24px 0;
    box-shadow: 0 5px 12px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

.citation-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 8px;
}

.citation-text {
    font-family: monospace;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 8px 0;
    font-size: 1.1rem;
}

.citation-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    font-style: italic;
}

#use-conditions {
    border-bottom: 1px solid var(--secondary);
    color: var(--secondary);
    cursor: pointer;
    display: inline-block;
}

#modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 2999;
}

#conditions-panel {
    position: fixed;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -48%) scale(0.96);
    width: min(90vw, 640px);
    max-height: 80vh;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    overflow-y: auto;
    z-index: 3000;
}

#conditions-panel.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

#modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

#conditions-panel h2 {
    margin: 0 0 12px;
    padding-right: 40px;
}

#conditions-panel p {
    margin: 0 0 12px;
    line-height: 1.6;
}

.use-contact {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid transparent;
    transition: border-color 0.6s;
}

.use-contact:hover {
    border-color: var(--primary);
    color: var(--primary);
}

#conditions-panel .attribution {
    padding: 12px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-family: monospace;
    text-align: center;
}

#conditions-panel-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    height: 32px;
    width: 32px;
    border-radius: 50%;

    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--text-muted);
}

#conditions-panel-toggle:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--text);
}

.panel-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.6rem;
    color: var(--text-muted);
    background: #f9fafb;
    white-space: nowrap;
}

.panel-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.panel-footer a:hover {
    color: var(--primary);
}

.divider {
    margin: 0 8px;
    color: var(--text-muted);
}

#panel-toggle {
    display: none;
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 2000;
    background: var(--surface);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
}

@media (max-width: 1500px) {
    .leaflet-geosearch-bar {
        display: none;
    }
}

@media (max-width: 1300px) {
    .info-panel {
        position: absolute;
        top: 0;
        transform: translateY(0);
        left: 0;
        width: 450px;
        max-height: 100vh;
        background: var(--surface);
        z-index: 1000;
        border-radius: 0;
        box-shadow: var(--shadow-lg);
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        transition: transform 0.6s ease, opacity 0.6s ease;
        overflow-x: hidden;
    }

    .leaflet-control-minimap {
        display: none;
    }
}

@media (max-width: 900px) {
    .info-panel {
        top: auto;
        bottom: 0;
        left: 0;
        transform: none;
        width: 100%;
        max-height: 60vh;
        border-radius: 20px 20px 0 0;
        margin: 0;
    }

    .cover-image {
        margin-left: 50%;
        transform: translateX(-50%);
        height: 200px;
        width: 90%;
    }
    
    #panel-toggle {
        display: flex;
    }

    .info-panel.hidden {
        transform: translateY(100%);
    }
}