/* CSS Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
}

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

/* Sidebar */
.sidebar {
    width: 360px;
    background: var(--bg-primary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.sidebar-header {
    padding: 32px 24px 24px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.tagline {
    font-size: 14px;
    opacity: 0.9;
    font-weight: 400;
}

/* Controls */
.controls {
    padding: 20px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    gap: 8px;
}

.btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow);
}

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

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

.btn svg {
    flex-shrink: 0;
    display: block;
}

/* Stats Section */
.stats-section {
    padding: 20px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.stat-card {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 4px;
}

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

/* Locations Section */
.locations-section {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
}

.location-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.location-item {
    background: var(--bg-primary);
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all 0.2s;
}

.location-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow);
    transform: translateX(2px);
}

.location-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 14px;
    line-height: 1.4;
}

.location-address {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
}

/* Leaflet Map Customization */
.leaflet-container {
    font-family: 'Inter', sans-serif;
    background: #e5e7eb;
}

/* Cleaner tiles */
.leaflet-tile-pane {
    filter: saturate(0.8) brightness(1.05);
}

/* Custom Popup */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0;
    overflow: hidden;
}

.leaflet-popup-content {
    margin: 0;
    min-width: 240px;
}

.popup-content {
    padding: 20px;
}

.popup-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.popup-address {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.popup-caption {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 16px;
    line-height: 1.5;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.popup-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.popup-link {
    flex: 1;
    padding: 10px 16px;
    text-decoration: none;
    text-align: center;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    color: white;
    background: var(--text-primary);
    transition: all 0.2s;
}

.popup-link:hover {
    background: var(--text-secondary);
    box-shadow: var(--shadow);
}

.leaflet-popup-tip {
    box-shadow: var(--shadow-lg);
}

/* Custom Marker Icons */
.custom-marker {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
}

.user-location-marker {
    background: #10b981 !important;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
}

/* Scrollbar Styling */
.locations-section::-webkit-scrollbar {
    width: 6px;
}

.locations-section::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

.locations-section::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.locations-section::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

/* Loading & Error States */
.loading,
.error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 16px;
    color: var(--text-secondary);
    padding: 40px;
    text-align: center;
}

/* Responsive Design */
@media (max-width: 968px) {
    .sidebar {
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        width: 320px;
        z-index: 2000;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .map-container {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .sidebar {
        width: 100%;
        max-width: 320px;
    }

    .controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}
