:root {
    --bg-base: #0f172a;
    --bg-glass: rgba(15, 23, 42, 0.7);
    --border-glass: rgba(255, 255, 255, 0.1);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #2dd4bf;
    --accent-hover: #14b8a6;
    --accent-glow: rgba(45, 212, 191, 0.4);
    --card-bg: rgba(30, 41, 59, 0.8);
    --card-hover: rgba(51, 65, 85, 0.9);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    overflow: hidden;
    line-height: 1.5;
}

/* App Layout */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar Dashboard (Glassmorphism) */
.dashboard {
    width: 400px;
    height: 100%;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}

.dashboard header {
    padding: 32px 24px 16px;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.dashboard header p {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.controls {
    padding: 0 24px 16px;
}

.search-container input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-container input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: rgba(255, 255, 255, 0.08);
}

.search-container input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.stats {
    padding: 0 24px 16px;
    display: flex;
    gap: 12px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 12px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.list-container {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Custom Scrollbar for list */
.list-container::-webkit-scrollbar {
    width: 6px;
}
.list-container::-webkit-scrollbar-track {
    background: transparent;
}
.list-container::-webkit-scrollbar-thumb {
    background: var(--border-glass);
    border-radius: 10px;
}
.list-container::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.competition-item {
    background: var(--card-bg);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeIn 0.5s ease backwards;
}

.competition-item:hover {
    background: var(--card-hover);
    transform: translateY(-2px);
    border-color: rgba(45, 212, 191, 0.5);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.comp-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
}

.comp-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.comp-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--accent);
    font-weight: 600;
}

.comp-loc {
    font-size: 0.85rem;
    color: var(--text-main);
    opacity: 0.8;
}

.dashboard footer {
    padding: 16px;
    text-align: center;
    border-top: 1px solid var(--border-glass);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Map Area */
.map-view {
    flex: 1;
    height: 100%;
    background-color: #000;
}

/* Premium Map Popups (Leaflet Overrides) */
.leaflet-popup-content-wrapper {
    background: rgba(30, 41, 59, 0.95) !important;
    backdrop-filter: blur(8px) !important;
    border: 1px solid var(--border-glass) !important;
    color: var(--text-main) !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5) !important;
    font-family: 'Outfit', sans-serif !important;
}

.leaflet-popup-tip {
    background: rgba(30, 41, 59, 0.95) !important;
    border-color: var(--border-glass) !important;
}

.leaflet-popup-content {
    margin: 16px 20px !important;
}

.map-popup h3 {
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    color: #fff;
}

.map-popup .popup-date {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.map-popup .popup-loc {
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.map-popup a.popup-btn {
    display: inline-block;
    background: var(--accent);
    color: #000;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    width: 100%;
    text-align: center;
}

.map-popup a.popup-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.02);
}

/* Custom Marker styling */
.custom-marker {
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(30, 41, 59, 1), 0 0 10px var(--accent-glow);
    display: flex;
    justify-content: center;
    align-items: center;
}
.custom-marker::after {
    content: '';
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
}

.marker-cluster-custom {
    background-color: var(--accent-glow) !important;
}
.marker-cluster-custom div {
    background-color: var(--accent) !important;
    color: #000 !important;
    font-weight: 800 !important;
    font-family: 'Outfit', sans-serif;
    border: 2px solid rgba(30, 41, 59, 1);
}

/* Loader */
.loader-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-base);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.loader-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-glass);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin { 100% { transform: rotate(360deg); } }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column-reverse;
    }
    .dashboard {
        width: 100%;
        height: 40vh;
        border-right: none;
        border-top: 1px solid var(--border-glass);
        border-radius: 24px 24px 0 0;
    }
    .map-view {
        height: 60vh;
    }
}

/* Filter Options Styling */
.mt-3 {
    margin-top: 16px;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
    user-select: none;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 18px;
    width: 18px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.custom-checkbox:hover input ~ .checkmark {
    background-color: rgba(255, 255, 255, 0.1);
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: var(--accent);
    border-color: var(--accent);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 6px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: "▼";
    font-size: 0.7rem;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
}

#timeRange {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

#timeRange:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

#timeRange option {
    background-color: var(--bg-base);
    color: var(--text-main);
}

