:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; background: var(--gray-50); color: var(--gray-900); min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; background: white; border-right: 1px solid var(--gray-200); z-index: 40; overflow-y: auto; }
.main-content { margin-left: 260px; min-height: 100vh; }
.page-header { background: white; border-bottom: 1px solid var(--gray-200); padding: 1rem 2rem; }
.page-body { padding: 1.5rem 2rem; }

/* Sidebar */
.sidebar-logo { padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--gray-200); font-size: 1.25rem; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 0.5rem; }
.sidebar-nav { padding: 1rem 0; }
.sidebar-nav a { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.5rem; color: var(--gray-600); font-size: 0.9rem; transition: all 0.15s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: var(--primary-light); color: var(--primary); text-decoration: none; }
.sidebar-nav a.active { border-right: 3px solid var(--primary); font-weight: 600; }
.sidebar-divider { height: 1px; background: var(--gray-200); margin: 0.5rem 1.5rem; }
.sidebar-section { padding: 0.75rem 1.5rem 0.25rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-400); font-weight: 600; }

/* Cards */
.card { background: white; border-radius: 0.5rem; border: 1px solid var(--gray-200); }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-100); font-weight: 600; }
.card-body { padding: 1.25rem; }

/* Tables */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--gray-100); }
th { font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--gray-500); background: var(--gray-50); }
tr:hover td { background: var(--gray-50); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 0.15rem 0.6rem; border-radius: 9999px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.375rem; color: var(--gray-700); }
.form-input, .form-select, .form-textarea { width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--gray-300); border-radius: 0.375rem; font-size: 0.9rem; transition: border-color 0.15s; outline: none; font-family: inherit; }
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1); }
.form-textarea { min-height: 100px; resize: vertical; }
.form-error { color: var(--danger); font-size: 0.8rem; margin-top: 0.25rem; }
.form-input.error { border-color: var(--danger); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.5rem 1rem; border-radius: 0.375rem; font-size: 0.875rem; font-weight: 500; border: 1px solid transparent; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-secondary { background: white; color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-50); }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-icon { padding: 0.4rem; border-radius: 0.375rem; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal { background: white; border-radius: 0.5rem; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; }
.modal-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 1.25rem; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 0.5rem; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: white; border-radius: 0.5rem; border: 1px solid var(--gray-200); padding: 1.25rem; }
.stat-card .stat-label { font-size: 0.8rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 0.25rem; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); }
.stat-card .stat-sub { font-size: 0.8rem; color: var(--gray-500); margin-top: 0.25rem; }

/* Toast */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: 0.5rem; }
.toast { padding: 0.75rem 1rem; border-radius: 0.375rem; color: white; font-size: 0.875rem; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: slideIn 0.3s ease; min-width: 280px; }
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-info { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Map */
.map-container { height: 400px; border-radius: 0.375rem; border: 1px solid var(--gray-300); z-index: 1; }
.map-container-full { height: 500px; }

/* Loading */
.loading { display: flex; align-items: center; justify-content: center; padding: 3rem; }
.spinner { width: 2rem; height: 2rem; border: 3px solid var(--gray-200); border-top: 3px solid var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Utility */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.text-gray-500 { color: var(--gray-500); }
.w-full { width: 100%; }
.hidden { display: none; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.25rem; padding: 1rem 0; }
.pagination button { padding: 0.375rem 0.75rem; border: 1px solid var(--gray-300); background: white; border-radius: 0.25rem; cursor: pointer; font-size: 0.85rem; }
.pagination button:hover:not(:disabled) { background: var(--gray-50); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination .page-info { padding: 0 0.5rem; font-size: 0.85rem; color: var(--gray-500); }

/* Login page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%); }
.login-card { background: white; border-radius: 0.75rem; padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo h1 { font-size: 1.5rem; color: var(--primary); }
.login-logo p { font-size: 0.875rem; color: var(--gray-500); margin-top: 0.25rem; }
.login-error { background: #fee2e2; color: #991b1b; padding: 0.75rem; border-radius: 0.375rem; margin-bottom: 1rem; font-size: 0.875rem; }

/* Landing */
.landing { min-height: 100vh; display: flex; flex-direction: column; }
.landing-header { background: white; padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--gray-200); }
.landing-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 4rem 2rem; }
.landing-hero h1 { font-size: 2.5rem; font-weight: 800; color: var(--gray-900); margin-bottom: 1rem; }
.landing-hero p { font-size: 1.125rem; color: var(--gray-500); max-width: 600px; margin-bottom: 2rem; }
.landing-options { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }

/* Notification type indicators */
.type-indicator { display: inline-flex; align-items: center; gap: 0.25rem; }
.type-promo .badge { background: #dcfce7; color: #166534; }
.type-emergency .badge { background: #fee2e2; color: #991b1b; }
.type-general .badge { background: #dbeafe; color: #1e40af; }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { width: 60px; }
  .sidebar-logo span, .sidebar-nav a span, .sidebar-section, .sidebar-divider { display: none; }
  .sidebar-nav a { justify-content: center; padding: 0.75rem; }
  .main-content { margin-left: 60px; }
  .page-body { padding: 1rem; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
