/* ============================================================
   delcorral-robos — Estilos
   ============================================================ */

:root {
  --primary: #1a3a5c;
  --primary-light: #2d5a8c;
  --accent: #e74c3c;
  --accent-light: #ff6b5a;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #2c3e50;
  --text-light: #7f8c8d;
  --border: #e1e8ed;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Header */
.header {
  background: var(--primary);
  color: white;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo {
  font-size: 1.4rem;
  font-weight: 700;
  color: white;
  text-decoration: none;
}
.logo span { font-weight: 400; font-size: 0.9rem; opacity: 0.8; }
.nav { display: flex; gap: 8px; }
.nav-btn {
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.nav-btn:hover { background: rgba(255,255,255,0.15); }
.nav-btn.active { background: var(--accent); border-color: var(--accent); }
.hidden { display: none !important; }

/* Views */
.view { max-width: 1400px; margin: 0 auto; padding: 24px; }

/* Demo hero */
.demo-hero { text-align: center; margin-bottom: 24px; }
.demo-hero h1 { font-size: 1.8rem; color: var(--primary); margin-bottom: 8px; }
.demo-hero p { color: var(--text-light); max-width: 600px; margin: 0 auto; }

/* Controls */
.demo-controls {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.control-group { display: flex; flex-direction: column; gap: 4px; }
.control-group label { font-size: 0.8rem; color: var(--text-light); font-weight: 600; }
.control-group select, .control-group input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  min-width: 180px;
}

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-light); }

/* Demo layout */
.demo-layout {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 20px;
  height: 600px;
}
.map-container {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  height: 100%;
}
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}
.stats-panel, .incident-list {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.stats-panel h3, .incident-list h3 {
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 12px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 8px;
}
.hint { color: var(--text-light); font-size: 0.85rem; font-style: italic; }

/* Stats */
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.stat-row:last-child { border: none; }
.stat-count {
  background: var(--accent);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* Incident list */
.incident-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}
.incident-item:last-child { border: none; }
.incident-cat {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: white;
  margin-bottom: 4px;
}
.cat-robo_vivienda { background: #8e44ad; }
.cat-robo_vehiculo { background: #2980b9; }
.cat-robo_comercio { background: #d35400; }
.cat-hurto { background: #f39c12; }
.cat-asalto { background: #c0392b; }
.cat-sustraccion { background: #16a085; }
.incident-loc { font-weight: 600; color: var(--text); }
.incident-date { color: var(--text-light); }
.incident-status {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.68rem;
  font-weight: 600;
}
.status-verified { background: #d4edda; color: #155724; }
.status-pending { background: #fff3cd; color: #856404; }
.status-rejected { background: #f8d7da; color: #721c24; }

/* Auth */
.auth-card {
  max-width: 400px;
  margin: 40px auto;
  background: var(--card-bg);
  padding: 32px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.auth-card h2 { color: var(--primary); margin-bottom: 20px; text-align: center; }
.auth-card form { display: flex; flex-direction: column; gap: 12px; }
.auth-card input {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.95rem;
}
.auth-card input:focus { outline: none; border-color: var(--primary-light); }
.error-msg { color: var(--danger); font-size: 0.85rem; margin-top: 8px; text-align: center; }

/* Dashboard */
.dashboard { max-width: 900px; margin: 0 auto; }
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.dash-header h2 { color: var(--primary); }
.user-info { text-align: right; font-size: 0.85rem; }
.user-info .points { font-weight: 700; color: var(--accent); font-size: 1.1rem; }

.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.dash-stat {
  background: var(--card-bg);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
}
.dash-stat .value { font-size: 2rem; font-weight: 700; color: var(--primary); }
.dash-stat .label { font-size: 0.8rem; color: var(--text-light); }

.dash-section {
  background: var(--card-bg);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.dash-section h3 { color: var(--primary); margin-bottom: 16px; }

/* Incident form */
.incident-form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row > div { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 0.8rem; color: var(--text-light); font-weight: 600; }
.form-row input, .form-row select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
}
.incident-form > div > label { font-size: 0.8rem; color: var(--text-light); font-weight: 600; display: block; margin-bottom: 4px; }
.incident-form input, .incident-form select, .incident-form textarea {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  width: 100%;
}
.incident-form textarea { resize: vertical; }

/* Reward cards */
.reward-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.reward-card .reward-name { font-weight: 600; }
.reward-card .reward-desc { font-size: 0.8rem; color: var(--text-light); }
.reward-card .reward-cost { font-weight: 700; color: var(--accent); }
.reward-card button { margin-left: 12px; }

/* Leaderboard */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.leaderboard-item:last-child { border: none; }
.leaderboard-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
}
.leaderboard-rank.gold { background: #f1c40f; color: #333; }
.leaderboard-rank.silver { background: #bdc3c7; color: #333; }
.leaderboard-rank.bronze { background: #cd7f32; }
.leaderboard-points { margin-left: auto; font-weight: 700; color: var(--accent); }

/* Footer */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-light);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* Responsive */
@media (max-width: 768px) {
  .demo-layout { grid-template-columns: 1fr; height: auto; }
  .map-container { height: 400px; }
  .form-row { grid-template-columns: 1fr; }
  .dash-stats { grid-template-columns: 1fr; }
  .demo-controls { flex-direction: column; align-items: stretch; }
}

/* Leaflet marker custom */
.custom-marker {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.marker-robo_vivienda { background: #8e44ad; }
.marker-robo_vehiculo { background: #2980b9; }
.marker-robo_comercio { background: #d35400; }
.marker-hurto { background: #f39c12; }
.marker-asalto { background: #c0392b; }
.marker-sustraccion { background: #16a085; }

/* Popup */
.leaflet-popup-content {
  font-size: 0.85rem;
  min-width: 200px;
}
.popup-category { font-weight: 700; margin-bottom: 4px; }
.popup-loc { color: var(--text-light); margin-bottom: 4px; }
.popup-desc { margin: 6px 0; font-size: 0.8rem; }
.popup-date { font-size: 0.75rem; color: var(--text-light); }
.popup-source a { color: var(--primary-light); font-size: 0.75rem; }