:root {
    --bg: #111113;
    --bg-card: #1a1a1d;
    --bg-card-hover: #222225;
    --accent: #6366f1;
    --accent2: #252530;
    --text: #e4e4e7;
    --text-muted: #71717a;
    --border: #27272a;
    --success: #22c55e;
    --warning: #eab308;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navigation */
.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    height: 52px;
    position: sticky;
    top: 0;
    z-index: 1000;
    gap: 0.5rem;
    overflow: hidden;
}
.navbar .brand {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-right: 1.5rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}
.navbar .brand span { color: var(--text-muted); font-weight: 400; }
.navbar nav {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    flex: 1;
    min-width: 0;
}
.navbar nav a {
    color: var(--text-muted);
    padding: 0.5rem 0.6rem;
    font-size: 0.82rem;
    font-weight: 500;
    transition: color 0.15s;
    white-space: nowrap;
    border-radius: 6px;
}
.navbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
    white-space: nowrap;
}
.navbar nav a:hover {
    color: var(--text);
    text-decoration: none;
    background: var(--accent2);
}
.navbar nav a.active {
    color: var(--text);
    text-decoration: none;
    background: var(--accent2);
}

/* Search bar */
.search-bar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1.5rem;
    position: sticky;
    top: 52px;
    z-index: 999;
}

/* Layout */
.container { max-width: 1400px; margin: 0 auto; padding: 1.5rem 2rem; }
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.5rem; font-weight: 600; }

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1rem;
}
.card:hover { border-color: #3f3f46; }
.card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 0.8rem; color: var(--text-muted); }

/* Grid */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* Stat cards */
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.2rem;
    text-align: center;
    transition: border-color 0.15s;
}
.stat-card:hover { border-color: #3f3f46; }
.stat-card .value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text);
}
.stat-card .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
th, td {
    padding: 0.6rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th {
    background: var(--bg-card);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
tr:hover { background: var(--bg-card-hover); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    font-weight: 500;
}
input, select, textarea {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
    width: 100%;
    font-family: inherit;
    font-size: 0.875rem;
    transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.45rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.btn:hover { opacity: 0.9; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--accent2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: #3f3f46; }
.btn-success { background: var(--success); color: #000; }
.btn-sm { padding: 0.25rem 0.7rem; font-size: 0.78rem; }

/* Filters bar */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: end;
}
.filters .form-group { margin-bottom: 0; }
.filters input, .filters select { width: auto; min-width: 150px; }

/* Tags/badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-2019 { background: #ef4444; color: #fff; }
.badge-2021 { background: #3b82f6; color: #fff; }
.badge-2022 { background: #22c55e; color: #fff; }
.badge-2023 { background: #f59e0b; color: #fff; }
.badge-2025 { background: #8b5cf6; color: #fff; }

/* Photo gallery */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.8rem;
}
.photo-thumb {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--border);
    position: relative;
    cursor: pointer;
}
.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-thumb .overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
}

/* Map */
#map { height: 600px; border-radius: 10px; border: 1px solid var(--border); }
.map-controls {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.92);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}
.lightbox.active { display: flex; }
.lightbox img { max-width: 90%; max-height: 90%; object-fit: contain; }
.lightbox .close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
}

/* Sortable column headers */
th.sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
th.sortable a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
th.sortable a:hover { color: var(--accent); text-decoration: none; }
th.sortable .sort-arrow {
    font-size: 0.7rem;
    opacity: 0.3;
}
th.sortable.sorted .sort-arrow { opacity: 1; color: var(--accent); }

/* Scrollable table wrapper */
.table-wrapper { overflow-x: auto; }

/* Detail sections */
.detail-grid {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 0.5rem 1rem;
}
.detail-grid dt {
    color: var(--text-muted);
    font-size: 0.85rem;
}
.detail-grid dd { margin: 0; }

/* Query box */
.query-box textarea {
    font-family: 'Cascadia Code', 'Fira Code', monospace;
    font-size: 0.85rem;
    min-height: 120px;
}

/* Lightbox navigation */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    color: #fff;
    cursor: pointer;
    padding: 0.5rem 1rem;
    user-select: none;
    z-index: 1001;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.lightbox-nav:hover { opacity: 1; }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

/* Breadcrumbs */
.breadcrumbs {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    padding: 0.3rem 0;
}
.breadcrumbs a {
    color: var(--text-muted);
    text-decoration: none;
}
.breadcrumbs a:hover {
    color: var(--text);
    text-decoration: underline;
}
.breadcrumbs .sep {
    margin: 0 0.4rem;
    color: var(--text-muted);
}

/* Hamburger toggle (hidden on desktop) */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s, transform 0.25s;
    pointer-events: auto;
    max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-error { border-left: 4px solid #ef4444; }
.toast.toast-info { border-left: 4px solid var(--accent); }

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 0.4rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Mobile responsive */
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .navbar {
        flex-wrap: wrap;
        height: auto;
        padding: 0.5rem 1rem;
    }
    .navbar nav {
        display: none;
        width: 100%;
        flex-direction: column;
        padding: 0.5rem 0;
    }
    .navbar nav.open { display: flex; }
    .navbar nav a {
        padding: 0.6rem 0;
        border-bottom: 1px solid var(--border);
    }
    .navbar nav a.active { border-bottom-color: var(--accent); }
    .container { padding: 1rem; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
    .page-header h1 { font-size: 1.3rem; }
    .table-wrapper { overflow-x: auto; }
    .grid.grid-2 { grid-template-columns: 1fr; }
    .filters { flex-direction: column; }
    #map { height: 400px !important; }
}
