:root {
  --primary: #d32f2f;
  --primary-dark: #b71c1c;
  --bg-color: #f5f5f5;
  --text-main: #333333;
  --text-muted: #888888;
  --card-bg: #ffffff;
  --radius: 20px;
  --shadow: 0 4px 20px rgba(0,0,0,0.05);
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--primary);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

/* APP CONTAINER */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  margin: 0 auto;
  background-color: var(--bg-color);
  position: relative;
  overflow: hidden;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  background-color: var(--bg-color);
  padding-bottom: 70px;
  height: 100%;
}

.view-section {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.hidden {
  display: none !important;
}

/* NAV */
.main-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
  z-index: 1000;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  transition: all 0.3s ease;
  gap: 4px;
}

.nav-item.active, .nav-item:hover {
  color: var(--primary);
}


/* FEED HEADER */
.red-header {
  background-color: var(--primary);
  color: white;
  padding: 30px 20px 60px;
  position: relative;
  border-bottom-left-radius: 40px;
  border-bottom-right-radius: 40px;
  z-index: 10;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.location {
  font-weight: 600;
  font-size: 16px;
  background: rgba(0,0,0,0.15);
  padding: 6px 14px;
  border-radius: 20px;
}

.live-badge {
  font-size: 12px;
  font-weight: 700;
  background-color: white;
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 12px;
  animation: pulse-live 1.5s infinite;
}

@keyframes pulse-live {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.8; }
  100% { transform: scale(1); opacity: 1; }
}

.red-header h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 20px;
  letter-spacing: -1px;
}

.stats-row {
  display: flex;
  gap: 20px;
}

.stat { display: flex; flex-direction: column; }
.stat-value { font-size: 24px; font-weight: 700; }
.stat-label { font-size: 13px; opacity: 0.8; }

.content-area {
  flex: 1;
  padding: 20px;
  margin-top: -30px;
  position: relative;
  z-index: 20;
}

.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 15px 0;
}

.filter-bar h3 {
  font-size: 16px;
  color: var(--text-main);
}

.filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1px solid #e0e0e0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn:hover { background: #f9f9f9; }
.loading, .empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  background: white;
  border-radius: var(--radius);
  margin-top: 20px;
}

/* SISMO CARD TICKET STYLE */
.sismos-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.sismo-card {
  background-color: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.sismo-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.recent-pulse { animation: pulse-border 2s infinite; }

@keyframes pulse-border {
  0% { box-shadow: 0 0 0 0 rgba(230, 46, 45, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(230, 46, 45, 0); }
  100% { box-shadow: 0 0 0 0 rgba(230, 46, 45, 0); }
}

.card-top { padding-bottom: 15px; }
.card-header { display: flex; justify-content: space-between; align-items: center; }
.location-info h3 { font-size: 18px; font-weight: 700; margin: 0 0 4px 0; color: var(--text-main); }
.location-info .reference { font-size: 13px; color: var(--text-muted); margin: 0; }

.mag-badge {
  background: var(--bg-color);
  padding: 8px 12px;
  border-radius: 12px;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.mag-badge span { font-size: 24px; font-weight: 800; }
.mag-badge small { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.mag-badge.low span { color: #4caf50; }
.mag-badge.moderate span { color: #ff9800; }
.mag-badge.high { background: #ffebee; }
.mag-badge.high span { color: var(--primary); }

.card-divider {
  position: relative;
  height: 20px;
  margin: 0 -20px;
  display: flex;
  align-items: center;
}
.line-dashed {
  flex: 1; height: 1px;
  background-image: linear-gradient(to right, #e0e0e0 50%, transparent 50%);
  background-size: 8px 1px; background-repeat: repeat-x;
}
.notch-left, .notch-right {
  width: 20px; height: 20px;
  background-color: var(--bg-color);
  border-radius: 50%; position: absolute;
}
.notch-left { left: -10px; }
.notch-right { right: -10px; }

.card-bottom { padding-top: 5px; display: flex; justify-content: space-between; align-items: center; }
.time-info { display: flex; flex-direction: column; }
.relative-time { font-size: 14px; font-weight: 600; color: var(--text-main); }
.exact-time { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.status-badge {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  background: #f9f9f9; padding: 6px 12px; border-radius: 20px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.low { background-color: #4caf50; }
.status-dot.moderate { background-color: #ff9800; }
.status-dot.high { background-color: var(--primary); }

/* MAPA */
.map-header { padding: 20px; background-color: white; box-shadow: 0 2px 10px rgba(0,0,0,0.05); z-index: 10; }
.map-header h2 { font-size: 24px; font-weight: 800; color: var(--text-main); margin-bottom: 4px; }
.map-header p { font-size: 14px; color: var(--text-muted); }
.map-container-wrapper { flex: 1; position: relative; min-height: 400px; display: flex; flex-direction: column; }
#map-container { flex: 1; width: 100%; z-index: 1; }

.sismo-popup .leaflet-popup-content-wrapper { border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
.sismo-popup .popup-content { text-align: center; }
.sismo-popup h4 { margin: 0 0 5px; color: var(--primary); font-size: 16px; font-weight: 800; }
.sismo-popup p { margin: 0 0 5px; font-size: 13px; color: var(--text-main); }
.sismo-popup small { color: var(--text-muted); font-size: 11px; }

/* PRONÓSTICO */
.pronostico-page { padding: 20px; background-color: var(--bg-color); min-height: 100%; }
.p-header { margin-bottom: 25px; }
.p-header h2 { font-size: 26px; font-weight: 800; color: var(--text-main); margin-bottom: 5px; }
.p-header p { color: var(--text-muted); font-size: 14px; }

.stats-container { display: flex; flex-direction: column; gap: 15px; }
.stat-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 20px;
  display: flex; align-items: center; gap: 15px; box-shadow: var(--shadow);
}
.stat-card.highlight { border-left: 4px solid var(--primary); }
.stat-icon { background: #f9f9f9; padding: 12px; border-radius: 16px; display: flex; align-items: center; justify-content: center; }
.stat-info h3 { font-size: 14px; color: var(--text-muted); font-weight: 500; margin: 0 0 5px 0; }
.stat-info .value { font-size: 22px; font-weight: 800; color: var(--text-main); margin: 0; }
.stat-info .desc { font-size: 12px; color: var(--text-muted); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.stat-grid .stat-card { flex-direction: column; align-items: flex-start; gap: 10px; }

.info-box {
  background: #e3f2fd; border-radius: 12px; padding: 20px; margin-top: 15px; border-left: 4px solid #2196f3;
}
.info-box h4 { color: #1976d2; margin: 0 0 10px 0; font-size: 16px; }
.info-box p { color: #0d47a1; font-size: 13px; line-height: 1.5; margin: 0; }
