    /* Reset and Base Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --secondary: #64748b;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --surface: #1e293b;
  --surface-dark: #0f172a;
  --surface-darker: #334155;
  --surface-light: #475569;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: #334155;
  --border-light: #475569;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.4);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.5);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: var(--surface-dark); color: var(--text-primary); line-height: 1.6; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow: hidden; }

/* Navigation Bar */
.navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; background: rgba(30, 41, 59, 0.95); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding: 0 1.5rem; display: flex; justify-content: space-between; align-items: center; height: 4rem; }
.nav-brand { font-size: 1.5rem; font-weight: 700; color: var(--primary); letter-spacing: -0.025em; }
.nav-links { display: flex; align-items: center; gap: 1rem; }
.nav-links a { color: var(--text-secondary); text-decoration: none; font-weight: 500; font-size: 0.875rem; padding: 0.5rem 1rem; border-radius: var(--radius); transition: var(--transition); display: flex; align-items: center; gap: 0.5rem; }
.nav-links a:hover { background: var(--surface-darker); color: var(--text-primary); }
.nav-links a.active { background: var(--primary); color: white; }
.nav-links a i { font-size: 0.875rem; }

/* Map Container */
#map { position: fixed; top: 0; left: 0; width: 100%; height: 100vh; z-index: 1; }

/* Leaflet Control Positioning */
.leaflet-top { top: 4rem !important; }
.leaflet-control-zoom { margin-top: 10px !important; margin-left: 10px !important; }
.leaflet-control-layers { margin-top: 10px !important; }

/* Advanced Location Marker */
.advanced-location-marker-container { background: transparent !important; border: none !important; }

.advanced-location-marker { position: relative; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }

.location-pulse { position: absolute; width: 100%; height: 100%; border-radius: 50%; background: rgba(59, 130, 246, 0.4); animation: locationPulseEffect 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

@keyframes locationPulseEffect {
  0% { transform: scale(0.8); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.5; }
  100% { transform: scale(1.5); opacity: 0; }
}

.location-dot { position: relative; z-index: 2; width: 24px; height: 24px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4)); transition: transform 0.3s ease; }

.advanced-location-marker:hover .location-dot { transform: scale(1.15); }

/* Advanced Location Popup */
.advanced-location-popup { font-family: 'Inter', sans-serif; min-width: 200px; }

.location-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.location-header h4 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text-primary); }

.accuracy-badge-inline { padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }

.location-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }

.stat-item { display: flex; flex-direction: column; padding: 8px; background: var(--surface-dark); border-radius: 6px; border: 1px solid var(--border-light); }

.stat-label { font-size: 11px; color: var(--text-muted); margin-bottom: 2px; }

.stat-value { font-size: 16px; font-weight: 700; color: var(--text-primary); }

.location-time { font-size: 11px; color: var(--text-muted); text-align: center; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

/* Map Control Buttons */
.map-type-control { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); display: flex; overflow: hidden; margin-top: 10px !important; }
.map-type-btn { background: none; border: none; padding: 0.75rem; cursor: pointer; transition: var(--transition); color: var(--text-secondary); border-right: 1px solid var(--border); }
.map-type-btn:last-child { border-right: none; }
.map-type-btn:hover { background: var(--surface-darker); }
.map-type-btn.active { background: var(--primary); color: white; }

/* Location Refresh Control */
.location-refresh-control { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-top: 10px !important; }
.location-refresh-btn { background: var(--primary); color: white; border: none; padding: 0.75rem; cursor: pointer; border-radius: var(--radius-lg); transition: var(--transition); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.location-refresh-btn:hover { background: var(--primary-dark); transform: scale(1.05); }
.location-refresh-btn:active { transform: scale(0.95); }

/* Map Action Buttons */
.map-button { position: fixed; background: var(--primary); color: white; border: none; padding: 1rem 1.5rem; border-radius: var(--radius-xl); font-weight: 600; font-size: 0.875rem; cursor: pointer; z-index: 30; box-shadow: var(--shadow-lg); transition: var(--transition); display: flex; align-items: center; gap: 0.5rem; }
.map-button:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow-xl); }
.map-button:active { transform: translateY(0); }
#recommendBtn { bottom: 2rem; right: 2rem; background: var(--success); }
#recommendBtn:hover { background: #047857; }
#loginBtn { bottom: 2rem; right: 2rem; background: var(--warning); }
#loginBtn:hover { background: #b45309; }

/* Emergency Alert */
.emergency-alert { position: fixed; top: 4rem; left: 0; right: 0; z-index: 40; background: var(--danger); color: white; padding: 1rem 1.5rem; text-align: center; font-weight: 600; font-size: 0.875rem; border-bottom: 1px solid rgba(0, 0, 0, 0.1); animation: emergencyPulse 2s infinite; display: none; }

@keyframes emergencyPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.9; } }

/* Disaster Selection Panel */
.disaster-selection { position: fixed; top: 5rem; left: 1.5rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 2rem; box-shadow: var(--shadow-xl); z-index: 40; width: 24rem; max-height: 75vh; overflow-y: auto; display: none; }
.disaster-selection.show { display: block; animation: slideInLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

@keyframes slideInLeft { from { transform: translateX(-1rem); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.disaster-selection h3 { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--text-primary); line-height: 1.2; }
.disaster-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1.5rem; }

/* Disaster Type List */
.disaster-types-list { margin-bottom: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.disaster-checkbox-item { display: flex; align-items: center; padding: 1rem; border-radius: var(--radius-lg); cursor: pointer; transition: var(--transition); border: 1px solid var(--border-light); background: var(--surface-dark); }
.disaster-checkbox-item:hover { background: rgba(59, 130, 246, 0.1); border-color: var(--accent); }
.disaster-checkbox-item:has(.disaster-checkbox:checked) { background: rgba(59, 130, 246, 0.15); border-color: var(--primary); }
.disaster-checkbox { position: absolute; opacity: 0; pointer-events: none; }
.checkmark { width: 1.25rem; height: 1.25rem; background: var(--surface); border: 2px solid var(--border); border-radius: 0.375rem; margin-right: 0.75rem; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.disaster-checkbox:checked ~ .checkmark { background: var(--primary); border-color: var(--primary); }
.disaster-checkbox:checked ~ .checkmark::after { content: "✓"; color: white; font-size: 0.75rem; font-weight: 600; }
.disaster-label { font-size: 0.875rem; font-weight: 500; color: var(--text-primary); line-height: 1.3; flex: 1; }

/* Selected Disasters */
.selected-disasters { margin-bottom: 1.25rem; padding: 1rem; background: rgba(59, 130, 246, 0.1); border-radius: var(--radius-lg); border: 1px solid rgba(59, 130, 246, 0.2); }
.selected-title { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.selected-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.selected-tag { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.375rem 0.75rem; background: var(--primary); color: white; border-radius: 9999px; font-size: 0.75rem; font-weight: 500; }
.tag-remove { background: none; border: none; color: rgba(255, 255, 255, 0.8); font-size: 1rem; cursor: pointer; padding: 0; width: 1rem; height: 1rem; display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: var(--transition); }
.tag-remove:hover { background: rgba(255, 255, 255, 0.2); color: white; }

/* Action Buttons */
.disaster-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.disaster-btn { padding: 0.75rem 1rem; border: none; border-radius: var(--radius-lg); font-weight: 600; font-size: 0.875rem; cursor: pointer; transition: var(--transition); display: flex; align-items: center; justify-content: center; gap: 0.375rem; }
.disaster-btn.primary { background: var(--primary); color: white; grid-column: 1 / -1; }
.disaster-btn.primary:hover:not(:disabled) { background: var(--primary-dark); transform: translateY(-1px); }
.disaster-btn.primary:disabled { background: var(--secondary); cursor: not-allowed; transform: none; }
.disaster-btn.secondary { background: var(--surface-light); color: var(--text-primary); border: 1px solid var(--border); }
.disaster-btn.secondary:hover { background: var(--surface-darker); }
.disaster-btn.tertiary { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.disaster-btn.tertiary:hover { background: var(--surface-light); }
.no-disasters { text-align: center; padding: 2rem 1rem; color: var(--text-muted); font-style: italic; font-size: 0.875rem; }

/* Modal Styles */
.modal { display: none; position: fixed; z-index: 85; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(8px); }
.modal-content { position: relative; background: var(--surface); margin: 5% auto; padding: 0; width: 90%; max-width: 32rem; border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); border: 1px solid var(--border); max-height: 110vh; display: flex; flex-direction: column; animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1); }

@keyframes modalSlideIn { from { opacity: 0; transform: scale(0.95) translateY(-2rem); } to { opacity: 1; transform: scale(1) translateY(0); } }

.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 2rem 2rem 1rem; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); }
.close-modal { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; padding: 0.5rem; border-radius: var(--radius); transition: var(--transition); }
.close-modal:hover { background: var(--surface-light); color: var(--text-primary); }
.modal-body { padding: 2rem; overflow-y: auto; flex: 1;}

/* Form Toggle */
.form-toggle { display: flex; background: var(--surface-light); border-radius: var(--radius-lg); margin-bottom: 1.5rem; padding: 0.25rem; }
.form-toggle button { flex: 1; background: none; border: none; color: var(--text-secondary); padding: 0.75rem 1rem; border-radius: var(--radius); font-weight: 600; font-size: 0.875rem; cursor: pointer; transition: var(--transition); }
.form-toggle button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* Form Styles */
.form-container { display: none; }
.form-container.active { display: flex; flex-direction: column; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: 0.5rem; font-weight: 500; color: var(--text-primary); font-size: 0.875rem; }
.form-group input, .form-group select { width: 100%; padding: 0.75rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text-primary); font-size: 0.875rem; transition: var(--transition); }
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1); }
.form-group input::placeholder { color: var(--text-muted); }
.form-group select option { background: var(--surface); color: var(--text-primary); }
.password-hint { color: #6b7280; font-size: 12px; display: block; margin-top: 4px; }
.btn-submit { width: 100%; background: var(--primary); color: white; border: none; padding: 1rem 1.5rem; border-radius: var(--radius-lg); font-weight: 600; font-size: 0.875rem; cursor: pointer; transition: var(--transition); margin-top: 0.5rem; }
.btn-submit:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-submit:active { transform: translateY(0); }

/* Messages */
.message { margin-top: 1rem; padding: 0.75rem 1rem; border-radius: var(--radius-lg); font-weight: 500; font-size: 0.875rem; }
.error-message { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); }
.success-message { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, 0.3); }

/* Popup Styles */
.leaflet-popup-content-wrapper { background: var(--surface) !important; border: 1px solid var(--border) !important; border-radius: var(--radius-lg) !important; box-shadow: var(--shadow-xl) !important; }
.leaflet-popup-content { margin: 0 !important; padding: 1rem !important; color: var(--text-primary) !important; font-family: 'Inter', sans-serif !important; min-width: 18rem !important; }
.leaflet-popup-tip { background: var(--surface) !important; border: 1px solid var(--border) !important; }

.center-popup-container { font-family: Inter, sans-serif; }
.center-name { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 16px; font-weight: 600; color: var(--text-primary); }
.center-category-badge { margin: 8px 0; padding: 6px 12px; border-radius: 12px; font-size: 12px; text-align: center; font-weight: bold; }
.center-details { margin: 4px 0; font-size: 14px; color: var(--text-secondary); }

/* Status Badges */
.status-badge { padding: 0.375rem 0.75rem; border-radius: 9999px; font-size: 0.6875rem; font-weight: 600; display: inline-flex; align-items: center; gap: 0.25rem; margin-bottom: 0.625rem; text-transform: uppercase; letter-spacing: 0.025em; }

/* Popup Actions */
.popup-actions { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; }

/* Route Buttons */
.route-button { padding: 8px 12px; border: none; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s; display: flex; align-items: center; gap: 4px; }
.route-button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.route-button:active { transform: translateY(0); }
.route-button.show-route { background: #3b82f6; color: white; }
.route-button.show-route:hover { background: #2563eb; }
.route-button.stop-route { background: #ef4444; color: white; }
.route-button.stop-route:hover { background: #b91c1c; }
.route-button:disabled { background: #9ca3af; color: white; cursor: not-allowed; transform: none !important; }
.route-button.view-needs { background: #8b5cf6; color: white; }
.route-button.view-needs:hover { background: #7c3aed; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4); }
.route-button.view-needs:active { transform: translateY(0); }

/* Legend and Status Elements */
.legend-info { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: 12px; margin-bottom: 16px; font-size: 13px; }
.legend-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.legend-row:last-child { margin-bottom: 0; }
.status-dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid white; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }

/* Enhanced Marker Styles */
.custom-div-icon { background: transparent !important; border: none !important; }
.evacuation-marker { cursor: pointer; transition: all 0.3s ease; }
.evacuation-marker:hover { transform: scale(1.1); box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important; }

/* Occupancy Details */
.occupancy-details { margin-top: 12px; padding: 12px; background: #3b3a3aff; border-radius: 8px; border: 1px solid #000000ff; }
.occupancy-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; font-size: 14px; }
.capacity-bar { width: 100%; height: 20px; background: #dbdde0ff; border-radius: 10px; overflow: hidden; position: relative; margin-bottom: 8px; }
.capacity-fill { height: 100%; transition: all 0.3s ease; }
.capacity-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 12px; font-weight: 600; color: white; text-shadow: 0 1px 2px rgba(0,0,0,0.5); }
.occupancy-row { display: flex; justify-content: space-between; margin: 4px 0; font-size: 13px; }
.occupancy-label { color: var(--text-secondary); }
.occupancy-value { font-weight: 600; color: var(--text-primary); }

/* Barangay Popup Styles */
.barangay-popup { font-family: Inter, sans-serif; }
.barangay-popup-title { margin: 0 0 8px 0; color: #1e3a8a; font-size: 14px; font-weight: 600; }
.barangay-popup-item { margin: 4px 0; font-size: 13px; color: var(--text-primary); }
.barangay-popup-area { margin: 4px 0; font-size: 11px; color: #6b7280; }

/* Hazard Popup Styles */
.hazard-popup { font-family: Inter, sans-serif; }
.hazard-popup-title { margin: 0; font-size: 14px; font-weight: 600; }
.hazard-popup-title.fire { color: #dc2626; }
.hazard-popup-title.flood { color: #0891b2; }
.hazard-popup-title.landslide { color: #92400e; }
.hazard-popup-title.earthquake { color: #7c2d12; }
.hazard-popup-text { margin: 4px 0; font-size: 13px; color: var(--text-secondary); }

/* Barangay Label */
.barangay-label { background: transparent !important; border: none !important; }
.barangay-label-text { font-family: Inter, sans-serif; font-size: 11px; font-weight: 600; color: #1e3a8a; text-shadow: 1px 1px 2px white, -1px -1px 2px white, 1px -1px 2px white, -1px 1px 2px white; white-space: nowrap; pointer-events: none; }

/* Needs Modal Styles */
.needs-modal-content { max-width: 40rem; max-height: 85vh; margin-top:30px}
.needs-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 2rem; padding: 1.5rem; background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%); border-radius: var(--radius-xl); border: 1px solid var(--border); }
.summary-stat { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: var(--surface); border-radius: var(--radius-lg); border: 1px solid var(--border-light); }
.summary-stat i { font-size: 2rem; color: var(--primary); }
.stat-value { font-size: 1.875rem; font-weight: 700; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 0.875rem; color: var(--text-secondary); margin-top: 0.25rem; }

/* Needs Categories */
.needs-categories { display: flex; flex-direction: column; gap: 1.5rem; margin-bottom: 2rem; }
.needs-category { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 1.5rem; }
.category-title { font-size: 1.125rem; font-weight: 700; color: var(--text-primary); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.category-title::before { content: ''; width: 4px; height: 1.125rem; background: var(--primary); border-radius: 2px; }
.needs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }
.need-item { display: flex; align-items: center; gap: 0.75rem; padding: 1rem; background: var(--surface-dark); border: 1px solid var(--border-light); border-radius: var(--radius-lg); transition: var(--transition); animation: fadeInUp 0.3s ease-out; animation-fill-mode: both; }
.need-item:hover { background: var(--surface-light); border-color: var(--primary); transform: translateY(-2px); }
.need-item:nth-child(1) { animation-delay: 0.05s; }
.need-item:nth-child(2) { animation-delay: 0.1s; }
.need-item:nth-child(3) { animation-delay: 0.15s; }
.need-item:nth-child(4) { animation-delay: 0.2s; }
.need-item:nth-child(5) { animation-delay: 0.25s; }
.need-item:nth-child(6) { animation-delay: 0.3s; }
.need-icon { width: 2.5rem; height: 2.5rem; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%); border-radius: var(--radius); color: white; font-size: 1.125rem; flex-shrink: 0; }
.need-info { flex: 1; min-width: 0; }
.need-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.25rem; }
.need-quantity { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }

/* Needs Breakdown */
.needs-breakdown { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 1.5rem; }
.breakdown-list { display: flex; flex-direction: column; gap: 1rem; max-height: 400px; overflow-y: auto; padding-right: 0.5rem; }
.breakdown-list::-webkit-scrollbar { width: 6px; }
.breakdown-list::-webkit-scrollbar-track { background: var(--surface-dark); border-radius: 3px; }
.breakdown-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.breakdown-list::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.breakdown-item { background: var(--surface-dark); border: 1px solid var(--border-light); border-radius: var(--radius-lg); padding: 1rem; transition: var(--transition); animation: fadeInUp 0.3s ease-out; animation-fill-mode: both; }
.breakdown-item:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.breakdown-item:nth-child(1) { animation-delay: 0.05s; }
.breakdown-item:nth-child(2) { animation-delay: 0.1s; }
.breakdown-item:nth-child(3) { animation-delay: 0.15s; }
.breakdown-item:nth-child(4) { animation-delay: 0.2s; }
.breakdown-item:nth-child(5) { animation-delay: 0.25s; }
.breakdown-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
.breakdown-title { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: 0.5rem; }
.breakdown-title i { color: var(--primary); }
.breakdown-date { font-size: 0.75rem; color: var(--text-muted); }
.breakdown-needs { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.breakdown-tag { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.375rem 0.75rem; background: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); border-radius: 9999px; color: var(--text-primary); font-size: 0.75rem; font-weight: 500; }
.breakdown-tag i { color: var(--primary); font-size: 0.625rem; }
.other-needs-section { margin-top: 0.75rem; padding: 0.75rem; background: rgba(139, 92, 246, 0.1); border-radius: var(--radius); font-size: 0.8125rem; color: var(--text-secondary); }
.other-needs-section strong { color: var(--text-primary); }
.no-needs-message { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 4rem 2rem; text-align: center; }
.no-needs-message i { font-size: 48px; color: var(--text-muted); margin-bottom: 16px; }
.no-needs-message p { color: var(--text-secondary); font-size: 1rem; max-width: 24rem; }

/* Real-time Badge */
.real-time-badge { background: #10b981; color: white; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; margin-left: 8px; animation: pulse 2s infinite; }

/* Loading States */
.loading-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.8); display: flex; flex-direction: column; align-items: center; justify-content: center; border-radius: var(--radius-xl); z-index: 10; }
.loading-overlay p { margin-top: 10px; color: #6b7280; font-size: 14px; }
.loading-spinner { width: 2.5rem; height: 2.5rem; border: 3px solid rgba(255, 255, 255, 0.2); border-top: 3px solid var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }

/* Notification Styles */
.notification { position: fixed; top: 80px; right: 20px; z-index: 3000; padding: 16px 20px; border-radius: 12px; backdrop-filter: blur(16px); border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); font-weight: 500; max-width: 300px; animation: slideInRight 0.3s ease; font-family: Inter, sans-serif; }
.notification-info { background: rgba(59, 130, 246, 0.95); color: white; }
.notification-success { background: rgba(16, 185, 129, 0.95); color: white; }
.notification-warning { background: rgba(245, 158, 11, 0.95); color: white; }
.notification-error { background: rgba(239, 68, 68, 0.95); color: white; }
.notification-fadeout { animation: slideOutRight 0.3s ease; }

/* Layer Control Panel */
.layer-control-panel-resident { position: absolute; top: 160px; right: 10px; z-index: 1000; background: white; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.25); padding: 0; min-width: 220px; border: 2px solid #1e3a8a; font-family: 'Inter', sans-serif; }

.layer-control-header { font-weight: 700; font-size: 13px; color: white; background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%); padding: 10px 12px; border-radius: 8px 8px 0 0; display: flex; align-items: center; gap: 8px; }

.layer-control-body { padding: 8px; }

.layer-control-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 4px 0; border-radius: 6px; cursor: pointer; transition: all 0.3s ease; border: 1px solid transparent; }

.layer-control-item:hover { background: #f9fafb; border-color: #e5e7eb; }

.layer-control-checkbox { width: 18px; height: 18px; cursor: pointer; accent-color: #1e3a8a; }

.layer-control-label { font-size: 12px; font-weight: 500; color: #111827; cursor: pointer; flex: 1; }

.layer-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 14px; }

.layer-icon.barangay { color: #3b82f6; }
.layer-icon.fire { color: #dc2626; }
.layer-icon.flood { color: #0891b2; }
.layer-icon.landslide { color: #92400e; }
.layer-icon.earthquake { color: #7c2d12; }

/* Focus States for Accessibility */
.form-group input:focus-visible, .form-group select:focus-visible, .btn-submit:focus-visible, .disaster-btn:focus-visible, .map-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Animation Keyframes */
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOutRight { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.85; } }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* Scrollbar Styling */
.disaster-selection::-webkit-scrollbar { width: 4px; }
.disaster-selection::-webkit-scrollbar-track { background: transparent; }
.disaster-selection::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.disaster-selection::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* Mobile Responsive Design */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; height: 3.5rem; }
  .nav-brand { font-size: 1.25rem; }
  .nav-links { gap: 0.5rem; }
  .nav-links a { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
  .nav-links span { display: none; }
  .nav-links a { min-width: 2.5rem; justify-content: center; }
  .leaflet-top { top: 3.5rem !important; }
  .disaster-selection { left: 1rem; right: 1rem; width: auto; top: 4.5rem; padding: 1.5rem; max-height: 70vh; }
  .disaster-checkbox-item { padding: 0.875rem 1rem; }
  .disaster-label { font-size: 0.9375rem; }
  .disaster-actions { grid-template-columns: 1fr; gap: 0.625rem; }
  .disaster-btn { padding: 0.875rem 1rem; font-size: 0.9375rem; }
  .disaster-btn.primary { grid-column: auto; }
  .map-button { bottom: 1.25rem; right: 1.25rem; padding: 0.875rem 1.25rem; font-size: 0.8125rem; }
  .modal-content { margin: 10% auto; width: 95%; border-radius: var(--radius-lg); max-height: 90vh; }
  .modal-header { padding: 1.5rem 1.5rem 1rem; }
  .modal-header h2 { font-size: 1.25rem; }
  .modal-body { padding: 1.5rem; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .form-group { margin-bottom: 1rem; }
  .form-group input, .form-group select { padding: 0.875rem 1rem; font-size: 1rem; }
  .route-button { min-width: auto; font-size: 11px; padding: 6px 10px; }
  .leaflet-popup-content { min-width: 14rem !important; padding: 0.875rem !important; }
  .center-name { font-size: 14px; }
  .center-details { font-size: 12px; }
  .needs-modal-content { max-width: 95%; margin: 5% auto; max-height: 85vh; }
  .needs-summary { grid-template-columns: 1fr; padding: 1rem; margin-bottom: 1.5rem; }
  .summary-stat { padding: 0.75rem; }
  .stat-value { font-size: 1.5rem; }
  .needs-grid { grid-template-columns: 1fr; }
  .needs-category { padding: 1rem; }
  .category-title { font-size: 1rem; }
  .need-item { padding: 0.75rem; }
  .need-icon { width: 2rem; height: 2rem; font-size: 1rem; }
  .needs-breakdown { padding: 1rem; }
  .breakdown-list { max-height: 300px; }
  .breakdown-item { padding: 0.75rem; }
  .breakdown-header { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .breakdown-date { align-self: flex-start; }
  .breakdown-tag { font-size: 0.6875rem; padding: 0.25rem 0.625rem; }
  .other-needs-section { padding: 0.625rem; font-size: 0.75rem; }
  .layer-control-panel-resident { top: 140px; right: 5px; min-width: 180px; }
  .layer-control-header { font-size: 11px; padding: 8px 10px; }
  .layer-control-label { font-size: 11px; }
  .layer-control-checkbox { width: 16px; height: 16px; }
  .notification { top: 60px; right: 10px; max-width: 250px; padding: 12px 16px; font-size: 13px; }
  .advanced-location-marker { width: 32px; height: 32px; }
  .location-dot { width: 20px; height: 20px; }
}

@media (max-width: 480px) {
  .navbar { padding: 0 0.75rem; height: 3rem; }
  .nav-brand { font-size: 1.125rem; }
  .nav-links { gap: 0.25rem; }
  .nav-links a { padding: 0.5rem; font-size: 0.75rem; }
  .leaflet-top { top: 3rem !important; }
  .modal { padding: 0.25rem; }
  .modal-content { border-radius: var(--radius-lg); max-height: 90vh;}
  .modal-header { padding: 1rem 1rem 0.75rem; }
  .modal-header h2 { font-size: 1.125rem; }
  .modal-body { padding: 1rem;}
  .disaster-selection { padding: 1rem; max-height: 60vh; top: 3.5rem; }
  .needs-modal-content { max-width: 100%; margin: 2% auto; border-radius: var(--radius-lg);  }
  .needs-summary { padding: 0.75rem; gap: 0.75rem; }
  .summary-stat { padding: 0.625rem; gap: 0.75rem; }
  .summary-stat i { font-size: 1.5rem; }
  .stat-value { font-size: 1.25rem; }
  .stat-label { font-size: 0.75rem; }
  .needs-category { padding: 0.75rem; }
  .category-title { font-size: 0.9375rem; margin-bottom: 0.75rem; }
  .need-name { font-size: 0.8125rem; }
  .need-quantity { font-size: 0.6875rem; }
  .needs-breakdown { padding: 0.75rem; }
  .breakdown-list { max-height: 250px; }
  .breakdown-title { font-size: 0.8125rem; }
  .breakdown-date { font-size: 0.6875rem; }
  .route-button { font-size: 10px; padding: 5px 8px; }
  .popup-actions { gap: 4px; }
  .center-popup-container { font-size: 12px; }
  .center-name { font-size: 13px; }
  .center-category-badge { font-size: 10px; padding: 4px 8px; }
  .notification { top: 55px; right: 8px; max-width: 220px; padding: 10px 14px; font-size: 12px; }
  .advanced-location-marker { width: 28px; height: 28px; }
  .location-dot { width: 18px; height: 18px; }
  .location-stats { grid-template-columns: 1fr; gap: 8px; }
  .stat-item { padding: 6px; }
  .stat-value { font-size: 14px; }
}

@media (max-height: 600px) {
  .modal-content { margin: 2% auto; max-height: 96vh; }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root { --border: #64748b; --border-light: #94a3b8; --text-muted: #cbd5e1; }
  .need-item { border-width: 2px; }
  .breakdown-tag { border-width: 2px; }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .location-pulse { animation: none; }
  .need-item, .breakdown-item { animation: none; }
  .need-item:hover, .breakdown-item:hover { transform: none; }
}

/* Print styles */
@media print {
  .navbar, .map-button, .disaster-selection, .modal, .notification, .layer-control-panel-resident, .map-type-control, .location-refresh-control { display: none !important; }
  #map { position: relative !important; width: 100% !important; height: 400px !important; }
}

/* Layer Control Panel */
.layer-control-container { position: absolute; top: 70px; right: 10px; z-index: 1000; font-family: 'Inter', sans-serif; }
.layer-toggle-btn { background: white; border: 2px solid #1e3a8a; border-radius: 8px; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 15px rgba(0,0,0,0.25); transition: all 0.3s ease; color: #1e3a8a; font-size: 16px; margin-left: auto; }
.layer-toggle-btn:hover { background: #1e3a8a; color: white; transform: scale(1.05); }
.layer-toggle-btn:active { transform: scale(0.95); }
.layer-control-panel-resident { position: absolute; top: 0; right: 50px; background: white; border-radius: 10px; box-shadow: 0 4px 15px rgba(0,0,0,0.25); padding: 0; min-width: 220px; border: 2px solid #1e3a8a; opacity: 0; visibility: hidden; transform: translateX(10px); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.layer-control-panel-resident.show { opacity: 1; visibility: visible; transform: translateX(0); }
.layer-control-header { font-weight: 700; font-size: 13px; color: white; background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%); padding: 10px 12px; border-radius: 8px 8px 0 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.layer-close-btn { background: none; border: none; color: white; cursor: pointer; padding: 4px; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 4px; transition: all 0.2s ease; }
.layer-close-btn:hover { background: rgba(255, 255, 255, 0.2); }
.layer-control-body { padding: 8px; }
.layer-control-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 4px 0; border-radius: 6px; cursor: pointer; transition: all 0.3s ease; border: 1px solid transparent; }
.layer-control-item:hover { background: #f9fafb; border-color: #e5e7eb; }
.layer-control-checkbox { width: 18px; height: 18px; cursor: pointer; accent-color: #1e3a8a; }
.layer-control-label { font-size: 12px; font-weight: 500; color: #111827; cursor: pointer; flex: 1; }
.layer-icon { width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: 14px; }
.layer-icon.barangay { color: #3b82f6; }
.layer-icon.fire { color: #dc2626; }
.layer-icon.flood { color: #0891b2; }
.layer-icon.landslide { color: #92400e; }
.layer-icon.earthquake { color: #7c2d12; }

/* Map Legend Modal */
.legend-modal { display: none; position: fixed; z-index: 2000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); backdrop-filter: blur(8px); }
.legend-modal-content { position: relative; background: var(--surface); margin: 5% auto; padding: 0; width: 90%; max-width: 500px; border-radius: var(--radius-xl); box-shadow: var(--shadow-xl); border: 1px solid var(--border); animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1); }
.legend-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem 2rem; border-bottom: 1px solid var(--border); }
.legend-modal-header h2 { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.legend-close-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; padding: 0.5rem; border-radius: var(--radius); transition: var(--transition); }
.legend-close-btn:hover { background: var(--surface-light); color: var(--text-primary); }
.legend-modal-body { padding: 2rem; max-height: 70vh; overflow-y: auto; }

/* Legend Sections */
.legend-section { margin-bottom: 2rem; }
.legend-section:last-child { margin-bottom: 0; }
.legend-section-title { font-size: 1.125rem; font-weight: 700; color: var(--text-primary); margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.legend-section-title::before { content: ''; width: 4px; height: 1.125rem; background: var(--primary); border-radius: 2px; }
.legend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.75rem; }
.legend-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; background: var(--surface-dark); border-radius: var(--radius-lg); border: 1px solid var(--border-light); transition: var(--transition); }
.legend-item:hover { background: var(--surface-light); border-color: var(--primary); }
.legend-icon { width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center; border-radius: var(--radius); flex-shrink: 0; }
.legend-text { flex: 1; }
.legend-label { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.125rem; }
.legend-description { font-size: 0.75rem; color: var(--text-secondary); }

/* Welcome Legend Trigger */
.welcome-legend-trigger { position: fixed; bottom: 2rem; left: 2rem; z-index: 1000; background: var(--primary); color: white; border: none; padding: 0.75rem 1.25rem; border-radius: var(--radius-xl); font-weight: 600; font-size: 0.875rem; cursor: pointer; box-shadow: var(--shadow-lg); transition: var(--transition); display: flex; align-items: center; gap: 0.5rem; }
.welcome-legend-trigger:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: var(--shadow-xl); }
.welcome-legend-trigger:active { transform: translateY(0); }

/* Mobile responsive for legend */
@media (max-width: 768px) {
  .legend-modal-content { margin: 10% auto; width: 95%; max-width: 90%; }
  .legend-modal-header { padding: 1.25rem 1.5rem; }
  .legend-modal-header h2 { font-size: 1.25rem; }
  .legend-modal-body { padding: 1.5rem; }
  .legend-grid { grid-template-columns: 1fr; }
  .welcome-legend-trigger { bottom: 1rem; left: 1rem; padding: 0.625rem 1rem; font-size: 0.8125rem; }
}

@media (max-width: 480px) {
  .legend-modal-content { margin: 5% auto; max-height: 85vh; }
  .legend-modal-header { padding: 1rem 1.25rem; }
  .legend-modal-body { padding: 1.25rem; }
  .legend-section-title { font-size: 1rem; }
  .welcome-legend-trigger { bottom: 0.75rem; left: 0.75rem; padding: 0.5rem 0.875rem; font-size: 0.75rem; }
}

    /* Welcome Legend Trigger Button */
    #welcomeLegendTrigger {
      position: fixed;
      bottom: 2rem;
      left: 2rem;
      z-index: 1000;
      background: var(--accent);
      color: white;
      border: none;
      padding: 1rem 1.5rem;
      border-radius: var(--radius-xl);
      font-weight: 600;
      font-size: 0.875rem;
      cursor: pointer;
      box-shadow: var(--shadow-lg);
      transition: var(--transition);
      display: flex;
      align-items: center;
      gap: 0.5rem;
      white-space: nowrap;
    }

    #welcomeLegendTrigger:hover {
      background: var(--primary);
      transform: translateY(-2px);
      box-shadow: var(--shadow-xl);
    }

    #welcomeLegendTrigger:active {
      transform: translateY(0);
    }

    @media (max-width: 768px) {
      .legend-grid {
        grid-template-columns: 1fr;
      }
      
      #welcomeLegendTrigger {
        bottom: 1rem;
        left: 1rem;
        padding: 0.875rem;
        width: 48px;
        height: 48px;
        border-radius: 50%;
        justify-content: center;
      }
      
      #welcomeLegendTrigger .legend-text {
        display: none;
      }
      
      #welcomeLegendTrigger span {
        display: none;
      }
    }

    @media (max-width: 480px) {
      .legend-section-title {
        font-size: 1rem;
      }
      
      #welcomeLegendTrigger {
        bottom: 0.75rem;
        left: 0.75rem;
        padding: 0.75rem;
        width: 44px;
        height: 44px;
      }
    }

    .hazard-levels {
      display: none;
      margin-top: 0.75rem;
      padding-top: 0.75rem;
      border-top: 1px solid var(--border-light);
    }

    .hazard-levels.show {
      display: block;
      animation: fadeIn 0.3s ease;
    }

    .hazard-level-item {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0.5rem 0.5rem 0.5rem 1.5rem;
      margin: 0.25rem 0;
      border-radius: var(--radius);
      background: rgba(255, 255, 255, 0.05);
      transition: var(--transition);
    }

    .hazard-level-color {
      width: 16px;
      height: 16px;
      border-radius: 4px;
      border: 2px solid white;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    .hazard-level-info {
      flex: 1;
    }

    .hazard-level-name {
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--text-primary);
      margin-bottom: 0.125rem;
    }

    .hazard-level-desc {
      font-size: 0.7rem;
      color: var(--text-secondary);
    }

    .hazard-expand-btn {
      background: none;
      border: none;
      color: var(--text-muted);
      cursor: pointer;
      padding: 0.25rem;
      border-radius: var(--radius);
      transition: var(--transition);
      margin-left: auto;
    }

    .hazard-expand-btn:hover {
      background: var(--surface-light);
      color: var(--text-primary);
    }

    .hazard-expand-btn i {
      transition: transform 0.3s ease;
    }

    .hazard-expand-btn.expanded i {
      transform: rotate(180deg);
    }

    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(-5px); }
      to { opacity: 1; transform: translateY(0); }
    }

    @media (max-width: 768px) {
      .hazard-levels {
        margin-top: 0.5rem;
        padding-top: 0.5rem;
      }
      
      .hazard-level-item {
        padding: 0.375rem 0.375rem 0.375rem 1rem;
      }
      
      .hazard-level-name {
        font-size: 0.75rem;
      }
      
      .hazard-level-desc {
        font-size: 0.65rem;
      }
      
      .hazard-level-color {
        width: 14px;
        height: 14px;
      }
    }

    @media (max-width: 480px) {
      .legend-grid {
        gap: 0.5rem;
      }
      
      .legend-item {
        padding: 0.625rem;
      }
      
      .hazard-levels {
        margin-top: 0.375rem;
        padding-top: 0.375rem;
      }
    }

