:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --secondary: #e11d48;
  --bg-dark: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.9);
  --glass-border: rgba(0, 0, 0, 0.08);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --accent: #0891b2;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.05) 0, transparent 50%), 
    radial-gradient(at 50% 0%, rgba(244, 63, 94, 0.03) 0, transparent 50%);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--glass-border);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(to right, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-decoration: none;
}

.nav-links a {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s;
}

.nav-btn {
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.5);
  font-size: 0.9rem;
}

.nav-btn:hover {
  background: white;
  border-color: var(--primary);
  color: var(--primary) !important;
  transform: translateY(-1px);
}

/* Glass Card */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  margin-bottom: 2rem;
}

/* Hero / Filter Section */
.filter-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  align-items: end;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

input, select {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0.75rem;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, background 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background: white;
  color: var(--primary);
  border: 1px solid var(--primary);
  border-radius: 0.75rem;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-outline:hover {
  background: rgba(79, 70, 229, 0.05);
  border-color: var(--primary-hover);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  text-align: center;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary);
  display: block;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 992px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

.chart-container {
  min-height: 300px;
  display: flex;
  flex-direction: column;
}

.chart-title {
  margin-bottom: 1rem;
  font-size: 1.125rem;
  font-weight: 700;
}

/* Table */
.table-container {
  overflow-x: auto;
  border-radius: 1rem;
  border: 1px solid var(--glass-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: rgba(0, 0, 0, 0.02);
  padding: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

td {
  padding: 1rem;
  border-top: 1px solid var(--glass-border);
  font-size: 0.9375rem;
}

tr:hover td {
  background: rgba(0, 0, 0, 0.01);
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-gray { background: #f1f5f9; color: #334155; }

/* Map */
#map {
  width: 100%;
  height: 400px;
  border-radius: 1.5rem;
  border: 1px solid var(--glass-border);
  margin-bottom: 2rem;
}

/* Loader */
.loader {
  width: 2rem;
  height: 2rem;
  border: 4px solid rgba(0, 0, 0, 0.05);
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: none;
  margin-right: 0.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.crime-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 500;
}

.checkbox-label:hover {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.04);
}

.checkbox-label:has(input:checked) {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.02);
}

.checkbox-label input {
  width: auto;
  padding: 0;
}
