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

:root {
    --color-found: #22c55e;
    --color-good: #3b82f6;
    --color-possibly-missing: #f97316;
    --color-destroyed: #6b7280;
    --color-bg: #f8fafc;
    --color-sidebar: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
}

.app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.header {
    background: var(--color-primary);
    color: white;
    padding: 1rem 1.5rem;
    flex-shrink: 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.header-brand h1 a {
    color: white;
    text-decoration: none;
}

.header-brand h1 a:hover {
    opacity: 0.9;
}

.header .subtitle {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.header-nav {
    display: flex;
    gap: 1.5rem;
}

.header-nav a {
    color: white;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    opacity: 0.9;
    transition: opacity 0.15s;
}

.header-nav a:hover {
    opacity: 1;
}

.main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 320px;
    background: var(--color-sidebar);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar section {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.sidebar h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--color-text);
}

.sidebar h3 {
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-bar {
    height: 8px;
    background: var(--color-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--color-found);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.stat-list {
    font-size: 0.875rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.stat-item .label {
    color: var(--color-text-muted);
}

.stat-item .value {
    font-weight: 500;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group > label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-group input[type="text"],
.filter-group select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 0.875rem;
}

.filter-group input[type="text"]:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s;
}

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

.btn-secondary:hover {
    background: #cbd5e1;
}

.recent-list {
    list-style: none;
}

.recent-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.875rem;
}

.recent-list li:last-child {
    border-bottom: none;
}

.recent-list .name {
    font-weight: 500;
}

.recent-list .date {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.map-container {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

#map {
    flex: 1;
}

.map-legend {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: white;
    border-top: 1px solid var(--color-border);
    font-size: 0.75rem;
}

.legend-items {
    display: flex;
    gap: 1rem;
}

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

.footer-right {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.generated {
    color: var(--color-text-muted);
}

.copyright {
    color: var(--color-text-muted);
}

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

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

.marker-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.marker-dot.found { background: var(--color-found); }
.marker-dot.good { background: var(--color-good); }
.marker-dot.possibly-missing { background: var(--color-possibly-missing); }
.marker-dot.destroyed { background: var(--color-destroyed); }

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
    border-radius: 8px;
}

.leaflet-popup-content {
    margin: 0.75rem 1rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

.popup-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.popup-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.25rem 0.75rem;
}

.popup-label {
    color: var(--color-text-muted);
}

.popup-link {
    margin-top: 0.75rem;
}

.popup-link a {
    color: var(--color-primary);
    text-decoration: none;
}

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

.popup-found {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.popup-found-badge {
    display: inline-block;
    background: var(--color-found);
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

/* Custom cluster markers */
.marker-cluster-small {
    background-color: rgba(59, 130, 246, 0.6);
}
.marker-cluster-small div {
    background-color: rgba(59, 130, 246, 0.8);
}

.marker-cluster-medium {
    background-color: rgba(59, 130, 246, 0.6);
}
.marker-cluster-medium div {
    background-color: rgba(59, 130, 246, 0.8);
}

.marker-cluster-large {
    background-color: rgba(59, 130, 246, 0.6);
}
.marker-cluster-large div {
    background-color: rgba(59, 130, 246, 0.8);
}

/* Page content (for non-map pages like About) */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background: var(--color-bg);
}

.about-page {
    max-width: 800px;
    margin: 0 auto;
    background: var(--color-sidebar);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.about-page h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.about-page p {
    margin-bottom: 1rem;
    line-height: 1.7;
    color: var(--color-text);
}

.about-page p:last-child {
    margin-bottom: 0;
}

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

    .sidebar {
        width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
    }

    .map-legend {
        flex-wrap: wrap;
        justify-content: center;
    }

    .page-content {
        padding: 1rem;
    }

    .about-page {
        padding: 1.5rem;
    }
}
