/* styles.css - Application Styles */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

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

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

.header p {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

/* Main container */
.main-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Sidebar styles */
.sidebar {
    width: 320px;
    background: #f8f9fa;
    padding: 1.5rem;
    overflow-y: auto;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
}

.section {
    margin-bottom: 2rem;
}

.section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #2c3e50;
}

/* City selector */
.city-selector {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.city-btn {
    flex: 1;
    padding: 0.5rem 1rem;
    border: 2px solid #3498db;
    background: white;
    color: #3498db;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.city-btn:hover {
    background: #2980b9;
    color: white;
    border-color: #2980b9;
}

/* Layer controls */
.layer-group {
    margin-bottom: 1.5rem;
}

.layer-group h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #34495e;
}

.layer-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    transition: background 0.2s;
}

.layer-item:hover {
    background: #ecf0f1;
}

.layer-item input[type="checkbox"] {
    margin-right: 0.75rem;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.layer-item label {
    cursor: pointer;
    font-size: 0.9rem;
    flex: 1;
}

.layer-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-left: auto;
}

/* Demographic controls */
.demographic-controls {
    background: white;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* Slider styles */
.slider-container {
    margin-bottom: 1rem;
}

.slider-container label {
    font-size: 0.9rem;
    color: #34495e;
    display: block;
    margin-bottom: 0.5rem;
}

.slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #ddd;
    outline: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    border-radius: 3px;
}

.slider:hover {
    opacity: 1;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #3498db;
    cursor: pointer;
    border-radius: 50%;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #3498db;
    cursor: pointer;
    border-radius: 50%;
}

.slider-value {
    text-align: right;
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 0.25rem;
}

/* Action buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn {
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
    text-align: center;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.btn-primary:hover:not(:disabled) {
    background: #2980b9;
}

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

.btn-secondary:hover:not(:disabled) {
    background: #7f8c8d;
}

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

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

/* Map overlay */
.map-overlay {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: white;
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 280px;
    min-width: 250px;
}

.neighborhood-info h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    color: #34495e;
}

.stat-value {
    font-weight: 600;
    color: #2c3e50;
}

/* Access gap color coding */
.gap-high {
    color: #e74c3c !important;
    font-weight: 600;
}

.gap-medium {
    color: #f39c12 !important;
    font-weight: 600;
}

.gap-low {
    color: #27ae60 !important;
    font-weight: 600;
}

/* Additional demographic stats */
.additional-stats {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #ecf0f1;
}

/* Legend */
.legend {
    position: absolute;
    bottom: 2rem;
    right: 1rem;
    background: white;
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
}

.legend h4 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: #2c3e50;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.legend-color {
    width: 20px;
    height: 20px;
    margin-right: 0.5rem;
    border-radius: 3px;
}

/* Popup styles */
.leaflet-popup-content {
    font-size: 0.9rem;
    min-width: 200px;
}

.popup-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2c3e50;
}

.popup-detail {
    font-size: 0.85rem;
    color: #7f8c8d;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal {
    background: white;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #ecf0f1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #2c3e50;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

/* Report styles */
.report-content h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.report-content h4 {
    color: #34495e;
    margin: 1.5rem 0 0.75rem;
}

.report-content p {
    margin-bottom: 0.5rem;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.report-table th,
.report-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.report-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.gap-high {
    color: #e74c3c;
    font-weight: 600;
}

.gap-medium {
    color: #f39c12;
    font-weight: 600;
}

.gap-low {
    color: #27ae60;
    font-weight: 600;
}

.report-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Comparison styles */
.comparison-content h3 {
    color: #2c3e50;
    margin-bottom: 1rem;
}

.neighborhood-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.comparison-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
}

.comparison-item:hover {
    background: #ecf0f1;
}

.comparison-item input[type="checkbox"] {
    margin-right: 0.5rem;
}

.comparison-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Export styles */
.export-content h3 {
    color: #2c3e50;
    margin-bottom: 1.5rem;
}

.export-options {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.export-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem;
    text-align: center;
}

.export-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.export-option small {
    display: block;
    margin-top: 0.25rem;
    color: #7f8c8d;
}

/* Density statistics panel */
.density-stats-panel {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 280px;
    display: none;
}

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

.stats-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.stats-content {
    margin-bottom: 1rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}

.stat-label {
    color: #7f8c8d;
}

.stat-value {
    font-weight: 600;
    color: #2c3e50;
}

.stat-value.good {
    color: #27ae60;
}

.stat-value.poor {
    color: #e74c3c;
}

.density-legend {
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
}

.legend-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.density-legend .legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
}

.density-legend .legend-color {
    width: 20px;
    height: 12px;
    margin-right: 0.5rem;
    border: 1px solid #ddd;
}

/* Update slider container for density threshold */
.slider-container:last-child {
    background: #fef5e7;
    border: 1px solid #f39c12;
}

.slider-container:last-child label {
    color: #d68910;
}

/* Radius analysis panel */
.radius-analysis-panel {
    position: absolute;
    bottom: 2rem;
    left: 1rem;
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-width: 320px;
    display: none;
}

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

.analysis-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    color: #2c3e50;
}

.analysis-location,
.analysis-radius {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: #34495e;
}

.analysis-summary {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
    margin: 1rem 0;
}

.total-services {
    display: flex;
    flex-direction: column;
}

.big-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #3498db;
    line-height: 1;
}

.label {
    font-size: 0.85rem;
    color: #7f8c8d;
    margin-top: 0.5rem;
}

.service-breakdown {
    margin-top: 1rem;
}

.service-breakdown h5 {
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: #2c3e50;
}

.category-count {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
}

.category-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.category-name {
    flex: 1;
    color: #34495e;
}

.category-value {
    font-weight: 600;
    color: #2c3e50;
}

.analysis-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #ecf0f1;
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

/* Radius center marker */
.radius-center-marker {
    background: transparent;
    border: none;
}

.pulse {
    width: 20px;
    height: 20px;
    background: #3498db;
    border-radius: 50%;
    position: relative;
}

.pulse::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #3498db;
    border-radius: 50%;
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

/* Update slider styles to be more prominent */
.slider-container {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #e8f4f8;
    border-radius: 6px;
}

.slider-container label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #2c3e50;
    display: block;
    margin-bottom: 0.5rem;
}

/* Notification styles */
.notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 3000;
    transition: transform 0.3s;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
}

/* Responsive design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: fixed;
        bottom: 0;
        height: 50vh;
        z-index: 1500;
        transform: translateY(calc(100% - 60px));
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateY(0);
    }
    
    .map-container {
        width: 100%;
    }
    
    .map-overlay,
    .legend {
        max-width: 200px;
        font-size: 0.85rem;
    }
    
    .neighborhood-selector {
        grid-template-columns: 1fr;
    }
}
