/* ========================================
   TIPOGRAFÍA LOCAL
   ======================================== */
@font-face {
  font-family: 'Aventa';
  src: url('../assets/fonts/Aventa-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Aventa';
  src: url('../assets/fonts/Aventa-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ========================================
   VARIABLES CSS
   ======================================== */
:root {
  /* Colores primarios */
  --primary-red: #cb2028;
  --primary-red-dark: #a81a21;
  --primary-red-light: #e63940;
  
  /* Colores de fondo */
  --background-white: #fefefe;
  --background-cream: #faf9f7;
  
  /* Colores de texto */
  --text-gray: #666;
  --text-dark: #333;
  --dark-gray: #010101;
  --light-gray: #f8f9fa;
  
  /* Efectos visuales */
  --border-subtle: rgba(0, 0, 0, 0.06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
  --shadow-primary: 0 4px 16px rgba(203, 32, 40, 0.2);
  
  /* Tipografía */
  --aventa-font: 'Aventa', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
}

/* ========================================
   ANIMACIONES KEYFRAMES
   ======================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes threadPull {
  0%, 100% {
    transform: scaleX(1);
  }
  50% {
    transform: scaleX(1.02);
  }
}

@keyframes subtleGlow {
  0%, 100% {
    text-shadow: 0 0 10px rgba(203, 32, 40, 0.1);
  }
  50% {
    text-shadow: 0 0 20px rgba(203, 32, 40, 0.2);
  }
}

@keyframes subtlePulse {
  0%, 100% {
    opacity: 1;
    transform: scaleY(1);
  }
  50% {
    opacity: 0.6;
    transform: scaleY(0.98);
  }
}

@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(15px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes loading-shimmer {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

@keyframes navSlideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

/* ========================================
   ESTILOS BASE
   ======================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--aventa-font);
  color: var(--text-gray);
  background: var(--background-cream);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: 90px;
  background-image: 
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,0.01) 2px, rgba(0,0,0,0.01) 4px),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,0.01) 2px, rgba(0,0,0,0.01) 4px);
}

/* ========================================
   NAVBAR
   ======================================== */
.project-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to bottom, var(--background-white) 0%, var(--background-cream) 100%);
  border-bottom: 4px solid transparent;
  border-image: repeating-linear-gradient(
    90deg,
    var(--primary-red) 0px,
    var(--primary-red) 6px,
    transparent 6px,
    transparent 12px
  ) 4;
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.1),
    0 2px 8px rgba(203, 32, 40, 0.08);
  z-index: 1000;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  animation: navSlideDown 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.project-navbar.hidden {
  transform: translateY(-100%);
  opacity: 0;
}

.navbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  gap: 2rem;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
  min-width: 0;
}

.navbar-brand-image {
  height: 60px;
  width: auto;
  flex-shrink: 0;
  transition: transform 0.3s ease;
}

.navbar-brand-image:hover {
  transform: scale(1.05);
}

.navbar-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.navbar-title {
  font-size: clamp(1.2rem, 2vw, 1.8rem);
  font-weight: 700;
  color: var(--primary-red);
  margin: 0;
  letter-spacing: -0.3px;
  line-height: 1.2;
  text-transform: lowercase;
  font-variant: small-caps;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: subtleGlow 4s ease-in-out infinite;
}

.navbar-subtitle {
  font-size: clamp(0.8rem, 1vw, 1rem);
  font-weight: 600;
  color: var(--text-gray);
  letter-spacing: 0.2px;
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================================
   HAMBURGER BUTTON
   ======================================== */
.hamburger-btn {
  background: transparent;
  border: 2px solid var(--primary-red);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-red);
  font-weight: 600;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.hamburger-btn:hover {
  background: var(--primary-red);
  color: white;
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary);
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 20px;
}

.hamburger-icon span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger-btn.active .hamburger-icon span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.active .hamburger-icon span:nth-child(2) {
  opacity: 0;
}

.hamburger-btn.active .hamburger-icon span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ========================================
   DROPDOWN MENU
   ======================================== */
.nav-dropdown {
  position: absolute;
  top: 100%;
  right: 2rem;
  background: var(--background-white);
  border-radius: 12px;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.15),
    0 2px 8px rgba(203, 32, 40, 0.1);
  border: 2px solid var(--primary-red);
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  margin-top: 0.5rem;
  overflow: hidden;
}

.nav-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown a {
  display: block;
  padding: 1rem 1.5rem;
  color: var(--text-dark);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
  border-bottom: 1px solid var(--border-subtle);
}

.nav-dropdown a:last-child {
  border-bottom: none;
}

.nav-dropdown a:hover {
  background: rgba(203, 32, 40, 0.08);
  color: var(--primary-red);
  padding-left: 2rem;
}

.nav-dropdown a i {
  margin-right: 0.5rem;
  color: var(--primary-red);
}

/* ========================================
   SECCIONES PRINCIPALES
   ======================================== */
.section-superior,
.section-intermedia,
.section-inferior {
  animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
}

.section-superior {
  padding: 1.5rem 0 1rem;
  background: var(--background-cream);
  animation-delay: 0.1s;
}

.section-intermedia {
  padding: 1rem 0;
  background: linear-gradient(to bottom, var(--background-cream) 0%, var(--background-white) 100%);
  animation-delay: 0.2s;
}

.section-inferior {
  padding: 1rem 0 4rem;
  background: var(--background-white);
  animation-delay: 0.3s;
}

/* ========================================
   MAPA PRINCIPAL
   ======================================== */
.map-container {
  background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    0 2px 8px rgba(203, 32, 40, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(203, 32, 40, 0.2);
  position: relative;
  transition: 
    transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background-image: 
    linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%),
    repeating-linear-gradient(90deg, transparent, transparent 3px, rgba(0,0,0,0.1) 3px, rgba(0,0,0,0.1) 6px);
}

.map-container:hover {
  box-shadow: 
    0 12px 40px rgba(0, 0, 0, 0.4),
    0 4px 16px rgba(203, 32, 40, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform: translateY(-3px) scale(1.002);
}

.map-chart {
  height: 650px;
  width: 100%;
  position: relative;
}

/* Botón para limpiar filtro de estado en el mapa */
.clear-state-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--primary-red);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  color: var(--primary-red);
  font-weight: 600;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  font-family: var(--aventa-font);
}

.clear-state-btn:hover {
  background: var(--primary-red);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(203, 32, 40, 0.3);
}

.clear-state-btn i {
  font-size: 0.9rem;
}

/* ========================================
   CONTROLES DEL MAPA
   ======================================== */
.map-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: linear-gradient(to right, #1a1a1a, #252525);
  border-top: 2px solid rgba(203, 32, 40, 0.3);
  gap: 20px;
  flex-wrap: nowrap;
}

.map-controls-bar .map-legend {
  background: rgba(255, 255, 255, 0.05);
  border-left: 3px solid #cb2028;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  color: #e0e0e0;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.map-controls-bar .map-legend::before {
  display: none;
}

.map-controls-bar .map-legend i {
  color: #cb2028;
  font-size: 16px;
}

.temporal-control {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  justify-content: flex-end;
  min-width: 320px;
  flex-wrap: nowrap;
}

.year-slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  max-width: 450px;
  flex-wrap: nowrap;
}

.year-slider {
  flex: 1;
  height: 8px !important;
  border-radius: 4px;
  background: linear-gradient(to right, #cb2028, #a81a21) !important;
  outline: none;
}

.year-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #cb2028;
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4), 0 0 0 2px rgba(203, 32, 40, 0.3);
  transition: all 0.2s ease;
}

.year-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 3px 10px rgba(203, 32, 40, 0.6);
}

.year-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #cb2028;
  cursor: pointer;
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: all 0.2s ease;
}

.year-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 3px 10px rgba(203, 32, 40, 0.6);
}

.year-label {
  font-size: 13px;
  color: #ccc;
  font-weight: 600;
  min-width: 40px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.current-year-badge {
  background: #cb2028;
  color: white;
  padding: 6px 16px;
  border-radius: 6px;
  font-size: 15px;
  min-width: 60px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(203, 32, 40, 0.4);
}

.current-year-badge strong {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.temporal-control .btn-outline-danger {
  white-space: nowrap;
  border-color: #cb2028;
  color: #cb2028;
  background: white;
  font-weight: 600;
  padding: 6px 18px;
  transition: all 0.3s ease;
}

.temporal-control .btn-outline-danger:hover {
  background-color: #cb2028;
  color: white;
  border-color: #cb2028;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(203, 32, 40, 0.4);
}

/* ========================================
   LEYENDAS INFORMATIVAS
   ======================================== */
.table-legend {
  background: linear-gradient(135deg, rgba(203, 32, 40, 0.05) 0%, rgba(203, 32, 40, 0.02) 100%);
  border-left: 3px solid var(--primary-red);
  padding: 0.875rem 0.875rem;
  margin-bottom: 1.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-gray);
  display: flex;
  align-items: center;
  gap: 0.625rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.table-legend::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--primary-red);
  animation: subtlePulse 4s ease-in-out infinite;
}

.table-legend:hover {
  box-shadow: var(--shadow-md);
  transform: translateX(3px);
  background: linear-gradient(135deg, rgba(203, 32, 40, 0.08) 0%, rgba(203, 32, 40, 0.03) 100%);
}

.table-legend i {
  color: var(--primary-red);
  font-size: 1.15rem;
  opacity: 0.9;
}

/* ========================================
   TARJETAS DE CONTENIDO
   ======================================== */
.chart-card,
.controls-card,
.table-card {
  background: var(--background-white);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.08),
    0 1px 3px rgba(0, 0, 0, 0.06);
  border: 1px solid var(--border-subtle);
  height: 100%;
  transition: 
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.3s ease;
  position: relative;
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(203, 32, 40, 0.01) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, rgba(203, 32, 40, 0.01) 0%, transparent 50%);
}

.chart-card::before,
.controls-card::before,
.table-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(203, 32, 40, 0.1), transparent 50%, rgba(203, 32, 40, 0.05));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-card:hover,
.controls-card:hover,
.table-card:hover {
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(203, 32, 40, 0.08);
  transform: translateY(-6px) scale(1.005);
  border-color: rgba(203, 32, 40, 0.15);
}

.chart-card:hover::before,
.controls-card:hover::before,
.table-card:hover::before {
  opacity: 1;
}

.chart-card {
  animation: cardAppear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
}

.chart-card:nth-child(1) { animation-delay: 0.1s; }
.chart-card:nth-child(2) { animation-delay: 0.2s; }
.chart-card:nth-child(3) { animation-delay: 0.3s; }

/* ========================================
   TÍTULOS Y CONTENEDORES DE GRÁFICOS
   ======================================== */
.chart-title,
.controls-title,
.table-title {
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 1.25rem;
  font-size: 1.15rem;
  letter-spacing: -0.3px;
  position: relative;
  padding-bottom: 0.75rem;
}

.chart-title::after,
.controls-title::after,
.table-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-red) 0%, transparent 100%);
  border-radius: 2px;
}

.chart-title::after {
  animation: threadPull 3s ease-in-out infinite;
}

.chart-container {
  height: 300px;
  width: 100%;
}

.chart-controls {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

/* ========================================
   CONTROLES DE FILTROS
   ======================================== */
.control-group {
  margin-bottom: 1.75rem;
}

.control-label {
  display: block;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 0.625rem;
  font-size: 0.95rem;
  letter-spacing: 0.2px;
}

.form-range {
  accent-color: var(--primary-red);
  height: 6px;
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  background: var(--primary-red);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(203, 32, 40, 0.3);
  width: 20px;
  height: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.form-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(203, 32, 40, 0.4);
}

.form-range::-moz-range-thumb {
  background: var(--primary-red);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(203, 32, 40, 0.3);
  width: 20px;
  height: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.form-range::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 3px 10px rgba(203, 32, 40, 0.4);
}

.time-control span {
  font-size: 0.875rem;
  color: var(--text-gray);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.form-select {
  border-color: var(--border-subtle);
  transition: all 0.2s ease;
  background-color: var(--background-white);
}

.form-select:focus {
  border-color: var(--primary-red);
  box-shadow: 0 0 0 0.2rem rgba(203, 32, 40, 0.12);
  background-color: var(--background-white);
}

/* ========================================
   BOTONES
   ======================================== */
.btn-outline-primary {
  color: var(--primary-red);
  border-color: var(--primary-red);
  border-width: 2px;
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--background-white);
}

.btn-outline-primary:hover {
  background: var(--primary-red);
  color: #fff;
  border-color: var(--primary-red);
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary);
}

.btn-outline-primary.active {
  background: var(--primary-red);
  color: #fff;
  border-color: var(--primary-red);
  box-shadow: var(--shadow-primary);
}

.btn-primary {
  background: var(--primary-red);
  border-color: var(--primary-red);
  font-weight: 600;
  padding: 0.5rem 1.25rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
  background: var(--primary-red-dark);
  border-color: var(--primary-red-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-primary);
}

.btn-primary:active {
  transform: translateY(0);
}

.clear-filters {
  width: 100%;
  background: transparent;
  border: 2px dashed var(--primary-red);
  color: var(--primary-red);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
}

.clear-filters:hover {
  background: rgba(203, 32, 40, 0.08);
  border-style: solid;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.clear-filters:active {
  transform: translateY(0);
}

/* ========================================
   TABLA DE PROYECTOS
   ======================================== */
.search-input {
  max-width: 320px;
  border-color: var(--border-subtle);
  border-radius: 10px;
  padding: 0.625rem 1rem;
  transition: all 0.2s ease;
  background-color: var(--background-white);
}

.search-input:focus {
  border-color: var(--primary-red);
  box-shadow: 0 0 0 0.25rem rgba(203, 32, 40, 0.12);
}

.table-responsive {
  max-height: 450px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  background: var(--background-white);
}

.table {
  margin-bottom: 0;
}

.table th {
  position: sticky;
  top: 0;
  background: linear-gradient(to bottom, #f8f9fa 0%, #f0f1f2 100%);
  border-bottom: 3px solid var(--primary-red);
  font-weight: 700;
  color: var(--text-dark);
  z-index: 10;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 1rem 0.75rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.table tbody tr {
  transition: all 0.2s ease;
}

.table tbody tr:hover {
  background: rgba(203, 32, 40, 0.06);
  cursor: pointer;
  transform: scale(1.002);
}

.table td {
  vertical-align: middle;
  font-size: 0.95rem;
  padding: 0.875rem 0.75rem;
}

.table td:last-child,
#year-current,
.modal-body p span {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.table-responsive::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-responsive::-webkit-scrollbar-track {
  background: #f8f9fa;
  border-radius: 5px;
}

.table-responsive::-webkit-scrollbar-thumb {
  background: var(--primary-red);
  border-radius: 5px;
  border: 2px solid #f8f9fa;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
  background: var(--primary-red-dark);
}

/* ========================================
   PAGINACIÓN
   ======================================== */
.pagination {
  margin-top: 1.75rem;
  gap: 0.375rem;
}

.page-link {
  color: var(--primary-red);
  border-color: var(--border-subtle);
  border-radius: 8px;
  padding: 0.5rem 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  background: var(--background-white);
}

.page-link:hover {
  background-color: rgba(203, 32, 40, 0.08);
  border-color: var(--primary-red);
  color: var(--primary-red);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.page-item.active .page-link {
  background-color: var(--primary-red);
  border-color: var(--primary-red);
  box-shadow: var(--shadow-primary);
}

.page-item.disabled .page-link {
  opacity: 0.5;
}

/* ========================================
   MODALES
   ======================================== */
.modal-content {
  border-radius: 20px;
  border: none;
  overflow: hidden;
  box-shadow: 
    0 20px 60px rgba(0, 0, 0, 0.25),
    0 4px 16px rgba(203, 32, 40, 0.1);
  background-image: 
    repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,0.005) 2px, rgba(0,0,0,0.005) 4px);
}

.modal-header {
  border-bottom: 3px dashed var(--primary-red);
  background: linear-gradient(to bottom, var(--background-white) 0%, var(--background-cream) 100%);
  padding: 1.75rem 2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  box-shadow: inset 0 -1px 0 rgba(203, 32, 40, 0.1);
}

.modal-header .btn-close {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
}

.modal-title {
  color: var(--primary-red);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.3px;
  text-align: center;
  flex: 1;
  margin: 0;
}

.modal-body {
  padding: 2.25rem;
  background: var(--background-white);
}

/* Grid de información del modal */
.modal-info-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-info-grid p {
  margin-bottom: 0;
  line-height: 1.6;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-info-grid p:last-child {
  border-bottom: none;
}

.modal-info-grid strong {
  color: var(--text-dark);
  font-weight: 700;
  display: inline-block;
  min-width: 140px;
}

/* Sección de descripción horizontal */
.modal-description-section {
  background: linear-gradient(135deg, rgba(203, 32, 40, 0.03) 0%, rgba(203, 32, 40, 0.01) 100%);
  border-left: 4px solid var(--primary-red);
  padding: 1.5rem;
  border-radius: 10px;
  margin-top: 1rem;
}

.modal-description-section h6 {
  color: var(--primary-red);
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-description-text {
  color: var(--text-gray);
  line-height: 1.8;
  font-size: 0.95rem;
  text-align: justify;
}

/* Imagen del modal */
.modal-body img {
  border-radius: 12px;
  box-shadow: 
    0 4px 16px rgba(0, 0, 0, 0.12),
    0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  width: 100%;
  height: auto;
  object-fit: cover;
  position: relative;
  border: 2px solid rgba(203, 32, 40, 0.1);
  outline: 1px dashed rgba(203, 32, 40, 0.2);
  outline-offset: 4px;
}

.modal-body img:hover {
  box-shadow: 
    0 8px 24px rgba(0, 0, 0, 0.16),
    0 2px 8px rgba(203, 32, 40, 0.12);
  transform: scale(1.02);
  outline-color: rgba(203, 32, 40, 0.4);
}

.modal-footer {
  border-top: 1px solid var(--border-subtle);
  background: #fafbfc;
  padding: 1.25rem 2rem;
}

/* Modal de metodología */
#methodologyModal .modal-body,
#aboutModal .modal-body {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-gray);
  text-align: justify;
  padding: 2rem;
}

#methodologyModal .modal-body p,
#aboutModal .modal-body p {
  margin-bottom: 1.25rem;
}

#methodologyModal .modal-body p:last-child,
#aboutModal .modal-body p:last-child {
  margin-bottom: 0;
}

#methodologyModal .modal-title,
#aboutModal .modal-title {
  font-size: 1.3rem;
  color: var(--primary-red);
  font-weight: 700;
}

/* ========================================
   FOOTER
   ======================================== */
.project-footer {
  background: linear-gradient(to bottom, var(--background-cream) 0%, #f5f3f0 100%);
  border-top: 2px solid rgba(203, 32, 40, 0.15);
  padding: 2.5rem 0;
  margin-top: 4rem;
  position: relative;
}

.project-footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    var(--primary-red) 0px,
    var(--primary-red) 4px,
    transparent 4px,
    transparent 8px
  );
  opacity: 0.4;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,0.05));
}

.credits {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-gray);
  font-weight: 400;
  opacity: 0.9;
  padding-top: 0.5rem;
  line-height: 2;
  letter-spacing: 0.3px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.credits span {
  display: block;
  transition: opacity 0.3s ease;
}

.credits span:hover {
  opacity: 1;
}

.credits strong {
  font-weight: 700;
  color: var(--text-dark);
  position: relative;
}

.credits strong::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary-red), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.credits strong:hover::after {
  opacity: 0.5;
}

.credits a {
  color: var(--text-gray);
  text-decoration: none;
  transition: color 0.3s ease;
}

.credits a:hover {
  color: var(--primary-red);
}

.methodology-link {
  margin-top: 1rem;
  text-align: center;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.methodology-link .separator {
  color: var(--text-gray);
  opacity: 0.5;
  font-weight: 300;
}

.methodology-link a {
  font-size: 0.8rem;
  color: var(--text-gray);
  text-decoration: none;
  font-weight: 400;
  transition: all 0.3s ease;
  display: inline-block;
  position: relative;
}

.methodology-link a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--primary-red);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.methodology-link a:hover {
  color: var(--primary-red);
}

.methodology-link a:hover::after {
  transform: scaleX(1);
}

/* ========================================
   ESTADO DE CARGA
   ======================================== */
.loading {
  opacity: 0.6;
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent 0 10px,
    rgba(203, 32, 40, 0.02) 10px 20px
  );
  animation: loading-shimmer 2s infinite;
}

/* ========================================
   MEDIA QUERIES - RESPONSIVIDAD
   ======================================== */

/* Grid de dos columnas fijo para escritorio */
@media (min-width: 992px) {
  .row-fixed-2col {
    display: grid !important;
    grid-template-columns: minmax(260px, 25%) 1fr;
    column-gap: var(--bs-gutter-x, 1.5rem);
    row-gap: var(--bs-gutter-y, 1.5rem);
    align-items: start;
  }

  .row-fixed-2col > [class*="col-"] {
    width: auto !important;
    max-width: none !important;
    min-width: 0 !important;
    flex: initial !important;
  }
}

/* Pantallas grandes */
@media (max-width: 1366px) {
  .map-chart {
    height: 580px;
  }
  
  .chart-container {
    height: 280px;
  }
}

/* Tablets */
@media (max-width: 1199px) {
  .map-chart {
    height: 550px;
  }
  
  .chart-container {
    height: 280px;
  }
  
  .chart-card,
  .controls-card,
  .table-card {
    padding: 1.5rem;
  }
  
  .modal-info-grid strong {
    min-width: 120px;
  }
}

/* Tablets pequeñas - Controles del mapa */
@media (max-width: 991px) {
  .navbar-container {
    padding: 0.75rem 1.5rem;
  }

  .navbar-brand-image {
    height: 50px;
  }

  .hamburger-btn span.text {
    display: none;
  }

  .nav-dropdown {
    right: 1.5rem;
  }

  .map-controls-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 16px 20px;
    flex-wrap: wrap;
  }
  
  .map-controls-bar .map-legend {
    justify-content: center;
    text-align: center;
  }
  
  .temporal-control {
    flex-direction: column;
    gap: 12px;
    min-width: 100%;
  }
  
  .year-slider-container {
    max-width: 100%;
    width: 100%;
  }
  
  .temporal-control .btn-outline-danger {
    width: 100%;
  }
  
  .current-year-badge {
    width: 100%;
  }
}

/* Móviles */
@media (max-width: 768px) {
  body {
    padding-top: 75px;
  }

  .navbar-container {
    padding: 0.5rem 1rem;
    gap: 1rem;
  }

  .navbar-brand {
    gap: 0.75rem;
  }

  .navbar-brand-image {
    height: 45px;
  }

  .navbar-title {
    font-size: 1rem;
  }

  .navbar-subtitle {
    font-size: 0.75rem;
  }

  .hamburger-btn {
    padding: 0.4rem 0.6rem;
  }

  .nav-dropdown {
    right: 1rem;
    min-width: 200px;
  }
  
  .map-chart {
    height: 480px;
  }
  
  .section-superior,
  .section-intermedia,
  .section-inferior {
    padding: 2.5rem 0;
  }
  
  .chart-card,
  .controls-card,
  .table-card {
    padding: 1.25rem;
  }
  
  .modal-body {
    padding: 1.5rem;
  }
  
  .modal-info-grid {
    gap: 0.5rem;
  }
  
  .modal-info-grid strong {
    display: block;
    min-width: auto;
    margin-bottom: 0.25rem;
  }
  
  .modal-description-section {
    padding: 1rem;
    margin-top: 0.75rem;
  }
  
  .temporal-control .btn-outline-danger {
    width: 100%;
  }
  
  .current-year-badge {
    width: 100%;
  }
  
  /* Paginación responsiva en móvil */
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25rem;
  }
  
  .page-item {
    margin: 0;
  }
  
  .page-link {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    min-width: 38px;
    text-align: center;
  }
  
  /* Ocultar números intermedios en móvil, mostrar solo primero, último, actual y adyacentes */
  .page-item:not(.active):not(:first-child):not(:last-child):not(.page-item-prev):not(.page-item-next) {
    display: none;
  }
  
  /* Mostrar página actual y sus vecinas inmediatas */
  .page-item.active,
  .page-item.active + .page-item,
  .page-item.active + .page-item + .page-item,
  .page-item:has(+ .page-item.active),
  .page-item:has(+ .page-item + .page-item.active) {
    display: inline-block !important;
  }
}

/* Móviles pequeños */
@media (max-width: 576px) {
  body {
    padding-top: 65px;
  }

  .navbar-titles {
    display: flex;
  }

  .navbar-title {
    font-size: 0.85rem;
  }

  .navbar-subtitle {
    font-size: 0.65rem;
  }

  .navbar-brand-image {
    height: 40px;
  }

  .map-chart {
    height: 440px;
  }
}

@media (max-width: 480px) {
  .pagination {
    gap: 0.2rem;
  }
  
  .page-link {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    min-width: 34px;
  }
  
  /* En pantallas muy pequeñas, mostrar solo controles de navegación y página actual */
  .page-item:not(.active):not(:first-child):not(:last-child):not(.page-item-prev):not(.page-item-next) {
    display: none !important;
  }
  
  .page-item.active {
    display: inline-block !important;
  }
}