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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    background: #2c3e50;
    color: white;
    padding: 1rem 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

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

.header h1 {
    font-size: 1.5rem;
    margin: 0;
}

.filter-toggle {
    display: none; /* Hidden on desktop */
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.filter-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.filter-toggle svg {
    display: block;
}

.stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.stat-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* Controls Panel */
.controls-panel {
    background: #ecf0f1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    z-index: 999;
    padding: 0.75rem 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.quick-filters {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.advanced-filters {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex: 1;
}

.advanced-filters.collapsed {
    display: none;
}

.control-group {
    display: flex;
}

.control-group select,
.control-group input {
    padding: 0.5rem;
    border: 1px solid #bdc3c7;
    border-radius: 4px;
    font-size: 0.9rem;
    background: white;
    min-width: 150px;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: #3498db;
}

.btn-primary,
.btn-secondary {
    padding: 0.5rem 1.2rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
}

/* Map */
#map {
    flex: 1;
    z-index: 1;
}

/* Details Panel */
.details-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 400px;
    background: white;
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
    z-index: 2000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.details-panel.hidden {
    transform: translateX(100%);
}

.close-btn {
    position: absolute;
    right: 1rem;
    top: 1rem;
    background: #e74c3c;
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding-bottom: 2px;
}

.close-btn:hover {
    background: #c0392b;
}

#details-content {
    padding: 2rem;
}

.detail-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #ecf0f1;
}

.detail-title {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.detail-park {
    font-size: 1rem;
    color: #7f8c8d;
    margin-bottom: 0.3rem;
}

.detail-category {
    display: inline-block;
    padding: 0.3rem 0.8rem;
    background: #3498db;
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.detail-section {
    margin: 1.5rem 0;
}

.detail-section h3 {
    font-size: 1rem;
    color: #34495e;
    margin-bottom: 0.5rem;
}

.detail-section p {
    color: #555;
    line-height: 1.6;
}

.detail-grid {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.8rem;
    margin-top: 1rem;
}

.detail-label {
    font-weight: 600;
    color: #34495e;
}

.detail-value {
    color: #555;
}

.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-closed {
    background: #e74c3c;
    color: white;
}

.status-part-closed {
    background: #f39c12;
    color: white;
}

.status-open {
    background: #27ae60;
    color: white;
}

/* Custom Marker Clusters */
.marker-cluster-small {
    background-color: rgba(52, 152, 219, 0.6);
}

.marker-cluster-medium {
    background-color: rgba(241, 196, 15, 0.6);
}

.marker-cluster-large {
    background-color: rgba(231, 76, 60, 0.6);
}

/* Custom Popup Styles */
.leaflet-popup-content {
    margin: 0.8rem;
    min-width: 250px;
    max-width: 350px;
}

.popup-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: #2c3e50;
    margin-bottom: 0.3rem;
}

.popup-subtitle {
    color: #7f8c8d;
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}

.popup-view-all-btn {
    width: 100%;
    padding: 0.6rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.popup-view-all-btn:hover {
    background: #2980b9;
}

/* Popup Alerts List */
.popup-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.popup-more-alerts {
    padding: 0.8rem;
    text-align: center;
    background: #f8f9fa;
    border-radius: 6px;
    color: #7f8c8d;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.popup-more-alerts:hover {
    background: #e9ecef;
    border-color: #3498db;
    color: #2c3e50;
}

.popup-alert-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.6rem;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.popup-alert-item:hover {
    background: #e9ecef;
    border-color: #3498db;
}

.popup-alert-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1rem;
    flex-shrink: 0;
}

.alert-icon-closed {
    background: #e74c3c;
}

.alert-icon-warning {
    background: #f39c12;
}

.alert-icon-info {
    background: #3498db;
}

.popup-alert-content {
    flex: 1;
    min-width: 0;
}

.popup-alert-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2c3e50;
    margin-bottom: 0.2rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.popup-alert-category {
    font-size: 0.75rem;
    color: #7f8c8d;
}

/* Alert Navigation */
.alert-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.nav-btn {
    background: #3498db;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-weight: bold;
}

.nav-btn:hover:not(:disabled) {
    background: #2980b9;
    transform: scale(1.1);
}

.nav-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    opacity: 0.5;
}

.alert-counter {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.95rem;
}

/* Sidebar Alerts List */
.sidebar-alerts-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.sidebar-alert-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem;
    background: #f8f9fa;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.sidebar-alert-item:hover {
    background: #e9ecef;
    border-color: #3498db;
}

.sidebar-alert-item.active {
    background: #e3f2fd;
    border-color: #3498db;
}

.sidebar-alert-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-alert-title {
    flex: 1;
    font-size: 0.9rem;
    color: #2c3e50;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Compact Header */
    .header {
        padding: 0.5rem 1rem;
    }

    .header-content {
        margin-bottom: 0;
    }

    .header h1 {
        font-size: 1rem;
    }

    .filter-toggle {
        display: block; /* Show on mobile */
    }

    .stats {
        display: none; /* Hide stats on mobile to save space */
    }

    /* Mobile Controls */
    .controls-panel {
        padding: 0.5rem 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .quick-filters {
        width: 100%;
        gap: 0.5rem;
    }

    .quick-filters .control-group {
        flex: 1;
    }

    .quick-filters .control-group select {
        width: 100%;
        min-width: 0;
    }

    .advanced-filters {
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
    }

    .advanced-filters.collapsed {
        display: none;
    }

    .advanced-filters .control-group {
        width: 100%;
    }

    .advanced-filters .control-group input {
        width: 100%;
        min-width: 0;
    }

    .advanced-filters .btn-secondary {
        width: 100%;
    }

    .details-panel {
        width: 100%;
        max-width: 100%;
    }

    /* Larger touch targets on mobile */
    .popup-alert-item {
        padding: 1rem;
        min-height: 60px;
    }

    .sidebar-alert-item {
        padding: 1rem;
        min-height: 60px;
    }

    .nav-btn {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
    }

    .close-btn {
        width: 40px;
        height: 40px;
        font-size: 1.8rem;
        top: 0.8rem;
        right: 0.8rem;
    }

    #details-content {
        padding: 1.5rem 1rem;
    }

    .leaflet-popup-content {
        max-width: 90vw;
    }
}

/* Loading Spinner */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 9999;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #2c3e50;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast-show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-error {
    background: #e74c3c;
}

@media (max-width: 768px) {
    .toast {
        bottom: 1rem;
        max-width: 90vw;
        font-size: 0.9rem;
    }
}
