/* ===============================
   VARIABLES GLOBALES MEJORADAS
   =============================== */
:root {
  --primary: #F7921E;
  --primary-dark: #e07d0e;
  --primary-light: #ffb05c;
  --secondary: #8b5cf6;
  --secondary-dark: #7c3aed;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --primary-gradient: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  --success-gradient: linear-gradient(135deg, var(--success) 0%, #34d399 100%);
  
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 0 2px 4px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -1px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.04);
  
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;
}

/* ===============================
   RESET Y BASE MEJORADO
   =============================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===============================
   LAYOUT PRINCIPAL CORREGIDO - SIN ESPACIOS GRISES
   =============================== */
#app {
  display: grid;
  grid-template-columns: 380px 1fr 400px; /* Paneles con ancho fijo, mapa flexible */
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: var(--gray-100);
  margin: 0;
  padding: 0;
}

/* Panel Izquierdo */
#panel-izquierdo {
  background: linear-gradient(135deg, rgba(37,37,37,0.95) 0%, rgba(20,20,20,0.98) 100%), 
              url('assets/parque-sm.jpg') center/cover;
  backdrop-filter: blur(10px);
  overflow-y: auto;
  box-shadow: 4px 0 20px rgba(0,0,0,0.3);
  z-index: 20;
  border-right: 1px solid rgba(255,255,255,0.1);
  height: 100vh; /* Asegurar altura completa */
}

/* Mapa - ocupa exactamente el espacio de su columna */
#map {
  height: 100vh;
  width: 100%;
  background: var(--gray-100);
  z-index: 1;
}

/* Panel Derecho - SIN ESPACIOS VACÍOS */
#panel-derecho {
  background: white;
  border-left: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 20;
  height: 100vh; /* Altura completa */
  width: 400px; /* Ancho fijo */
  margin: 0;
  padding: 0;
}

.panel-derecho {
  height: 100vh;
  width: 400px;
}

.panel-derecho-contenido {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: white; /* Fondo blanco para evitar transparencias */
}

/* Asegurar que no hay márgenes ni paddings que creen espacios */
html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--gray-100);
}

/* Eliminar cualquier posible espacio entre columnas */
#app > div {
  margin: 0;
  padding: 0;
}

/* Cuando el panel derecho tiene clase visible (si la usas) */
#panel-derecho.visible {
  display: flex !important;
}

/* Ajuste para el mapa cuando el panel está visible (si es necesario) */
#map.with-panel {
  width: 100%; /* Ya está en grid, no necesita ajuste */
}
/* Logo y navegación mejorados */
.logo-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.nav-back {
  color: white;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 8px 12px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.1);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-back:hover {
  background: rgba(255,255,255,0.2);
  transform: translateX(-2px);
}

.logo-placeholder {
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-lg);
}

/* Secciones mejoradas */
.seccion {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-xl);
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-lg);
}

.seccion:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary);
}

.seccion h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0 0 16px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: -0.01em;
}

.seccion h3 i {
  color: var(--primary);
  font-size: 18px;
  background: rgba(247,146,30,0.1);
  padding: 6px;
  border-radius: var(--radius-md);
}

/* Buscador mejorado */
.buscador-container {
  margin-bottom: 16px;
}

.buscador-input {
  width: 100%;
  padding: 14px 18px;
  font-size: 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-full);
  background: white;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
}

.buscador-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(247,146,30,0.1);
}

.buscador-input::placeholder {
  color: var(--gray-400);
}

/* Selector de actividades mejorado */
.selector-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stats-badge {
  background: var(--primary-gradient);
  color: white;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.actividades-container {
  max-height: 300px;
  overflow-y: auto;
  border-radius: var(--radius-lg);
  background: var(--gray-50);
  padding: 4px;
}

.actividad-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-lg);
  background: white;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  box-shadow: var(--shadow-xs);
}

.actividad-item:hover {
  border-color: var(--primary);
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.actividad-item input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.actividad-info {
  flex: 1;
}

.actividad-nombre {
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.actividad-badge {
  background: var(--gray-200);
  color: var(--gray-700);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
}

.actividad-detalle {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--gray-500);
}

/* Botones mejorados */
.acciones {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 8px;
  margin-top: 16px;
}

.btn-primario, .btn-secundario {
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.3px;
}

.btn-primario {
  background: var(--primary-gradient);
  color: white;
  box-shadow: 0 4px 12px rgba(247,146,30,0.3);
}

.btn-primario:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(247,146,30,0.4);
}

.btn-primario:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secundario {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

.btn-secundario:hover {
  background: var(--gray-200);
  transform: translateY(-1px);
}

/* Filtros activos mejorados */
.filtros-activos {
  margin-top: 16px;
  padding: 16px;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  border-left: 4px solid var(--primary);
}

.filtros-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.btn-limpiar {
  background: none;
  border: none;
  color: var(--gray-500);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  transition: color 0.2s;
}

.btn-limpiar:hover {
  color: var(--danger);
}

.filtro-seleccionado {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* KPIs mejorados */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.kpi-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.95) 0%, white 100%);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  border: 1px solid rgba(255,255,255,0.3);
  box-shadow: var(--shadow-md);
  transition: all 0.3s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-800);
  line-height: 1.2;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}



.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-200);
  background: linear-gradient(to right, var(--gray-50), white);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.btn-cerrar-panel {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-500);
  transition: all 0.2s;
  background: white;
  border: 1px solid var(--gray-200);
}

.btn-cerrar-panel:hover {
  background: #fee2e2;
  color: var(--danger);
  border-color: #fecaca;
  transform: rotate(90deg);
}

.panel-derecho-contenido {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* KPIs del Buffer Mejorados */
.kpi-grid-buffer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card-buffer {
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--gray-200);
  transition: all 0.3s;
}

.kpi-card-buffer:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: white;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-gradient);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(247,146,30,0.3);
}

.kpi-content {
  flex: 1;
}

.kpi-label {
  font-size: 12px;
  color: var(--gray-600);
  margin-bottom: 4px;
  font-weight: 500;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1;
}

/* Estadísticas de Actividades Mejoradas */
.actividades-stats-section {
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid var(--gray-200);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-weight: 600;
  color: var(--gray-700);
  font-size: 14px;
}

.actividades-stats-list {
  max-height: 200px;
  overflow-y: auto;
}

.actividad-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-200);
  transition: background 0.2s;
}

.actividad-stat-item:hover {
  background: white;
  border-radius: var(--radius-md);
}

.actividad-stat-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.actividad-stat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.actividad-stat-nombre {
  font-size: 13px;
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.actividad-stat-cantidad {
  background: var(--gray-200);
  color: var(--gray-700);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
}

/* Lista de Comercios Mejorada */
.comercios-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 300px;
}

.comercios-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.comercio-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.3s;
  box-shadow: var(--shadow-sm);
}

.comercio-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px) scale(1.01);
  box-shadow: var(--shadow-lg);
}

.comercio-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 8px;
}

.comercio-nombre {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.comercio-badge {
  background: var(--primary-gradient);
  color: white;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(247,146,30,0.3);
}

.comercio-direccion {
  font-size: 12px;
  color: var(--gray-600);
  margin: 6px 0 12px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--gray-200);
}

.comercio-usos {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.comercio-uso-tag {
  background: var(--gray-100);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  border: 1px solid transparent;
  transition: all 0.2s;
  color: var(--gray-700);
}

.comercio-uso-tag:hover {
  background: var(--primary);
  color: white;
  transform: scale(1.05);
}

/* Tags de usos mejorados */
.uso-tag {
  display: inline-block;
  padding: 6px 14px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  color: var(--info);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  margin: 0 8px 8px 0;
  transition: all 0.2s;
  border: 1px solid #c7d2fe;
  box-shadow: var(--shadow-xs);
}

.uso-tag:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.uso-tag.condicional {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border-color: #fcd34d;
}

/* Scrollbar personalizado elegante */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--gray-400) 0%, var(--gray-500) 100%);
  border-radius: var(--radius-full);
  border: 2px solid var(--gray-100);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
}

/* Loading Overlay Mejorado */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-spinner {
  background: white;
  padding: 40px;
  border-radius: var(--radius-2xl);
  text-align: center;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s ease;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Debug panel mejorado */
.debug-panel {
  background: rgba(0,0,0,0.8);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin-top: 16px;
  font-size: 11px;
  color: #4ade80;
  font-family: monospace;
  border: 1px solid rgba(74,222,128,0.3);
  backdrop-filter: blur(4px);
}

.debug-panel strong {
  color: #4ade80;
  display: block;
  margin-bottom: 8px;
}

#debugInfo {
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.4;
}

/* Placeholders mejorados */
.stats-placeholder, .comercios-placeholder {
  padding: 40px 20px;
  text-align: center;
  color: var(--gray-500);
  font-size: 13px;
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--gray-300);
}

.stats-placeholder i, .comercios-placeholder i {
  font-size: 40px;
  margin-bottom: 12px;
  display: block;
  color: var(--gray-400);
}

/* Utilidades adicionales */
.text-gradient {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.bg-gradient {
  background: var(--primary-gradient);
}

.shadow-hover {
  transition: all 0.3s;
}

.shadow-hover:hover {
  box-shadow: var(--shadow-xl);
  transform: translateY(-2px);
}
/* ===============================
   BOTÓN DE COMPETENCIA MEJORADO
   =============================== */
.competencia-button-container {
  margin-bottom: 20px;
  padding: 0 4px;
}

.btn-competencia {
  width: 100%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: var(--radius-xl);
  padding: 18px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
  border: 1px solid rgba(255,255,255,0.2);
}

.btn-competencia:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-competencia i:first-child {
  font-size: 18px;
}

.btn-competencia i:last-child {
  font-size: 14px;
  opacity: 0.8;
  transition: transform 0.2s;
}

.btn-competencia:hover i:last-child {
  transform: translateX(4px);
  opacity: 1;
}

.competencia-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 0 12px;
  font-size: 12px;
  color: var(--gray-500);
}

.competencia-hint i {
  color: var(--primary);
  font-size: 12px;
}

.competencia-hint span {
  font-weight: 600;
  color: var(--primary);
}

/* ===============================
   CONTROLES DEL BUFFER
   =============================== */
.buffer-controls {
  background: var(--gray-50);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 16px 0;
  border: 1px solid var(--gray-200);
}

.buffer-control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--gray-700);
}

.buffer-value {
  background: var(--primary-gradient);
  color: white;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 12px;
}

.buffer-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) 50%, var(--gray-300) 50%);
  -webkit-appearance: none;
  appearance: none;
  outline: none;
  margin: 10px 0;
}

.buffer-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
  margin-top: -8px;
}

.buffer-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: var(--shadow-lg);
}

.buffer-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 10px;
  color: var(--gray-500);
}

/* ===============================
   FILTROS DE COMPETENCIA
   =============================== */
.filtros-competencia {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.btn-filtros-competencia {
  flex: 1;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-full);
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-700);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-filtros-competencia:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--gray-50);
}

.btn-filtros-competencia:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-refrescar, .btn-limpiar-filtros {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  background: white;
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-refrescar:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  transform: rotate(180deg);
}

.btn-limpiar-filtros:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-refrescar:disabled, .btn-limpiar-filtros:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===============================
   INFO SECTION MEJORADA
   =============================== */
.info-section {
  background: linear-gradient(135deg, #f8fafc 0%, white 100%);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 20px;
}

.info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.info-titulo {
  font-weight: 600;
  color: var(--gray-800);
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-badge {
  background: var(--primary-gradient);
  color: white;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(247,146,30,0.3);
}

.parcela-selector {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  font-size: 13px;
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 12px;
}

.parcela-selector:hover {
  border-color: var(--primary);
}

.parcela-selector:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(247,146,30,0.1);
}

.parcelas-stats {
  display: flex;
  gap: 16px;
  padding: 8px 12px;
  background: var(--gray-100);
  border-radius: var(--radius-lg);
  font-size: 12px;
  color: var(--gray-600);
}

/* ===============================
   TRANSICIONES PARA MOSTRAR/OCULTAR
   =============================== */
#bufferKpisContainer,
#actividadesStatsContainer,
#comerciosListContainer {
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform-origin: top;
}

#bufferKpisContainer[style*="display: block"],
#actividadesStatsContainer[style*="display: block"],
#comerciosListContainer[style*="display: block"] {
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* ===============================
   ESTILOS PARA PARCELA SELECCIONADA Y COMERCIOS
   =============================== */

/* Efecto de pulso para la parcela seleccionada (opcional) */
@keyframes pulse-selected {
  0% {
    stroke-width: 5;
    stroke-opacity: 1;
  }
  50% {
    stroke-width: 7;
    stroke-opacity: 0.8;
  }
  100% {
    stroke-width: 5;
    stroke-opacity: 1;
  }
}

.parcela-seleccionada path {
  animation: pulse-selected 1.5s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(247,146,30,0.5));
}

/* Estilos para marcadores de comercios */
.comercio-marker {
  transition: all 0.2s ease;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.comercio-marker:hover {
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
  transform: scale(1.1);
}

/* Categorías específicas (para posibles estilos adicionales) */
.comercio-alimentos-y-bebidas path {
  filter: drop-shadow(0 2px 4px rgba(59,130,246,0.3));
}

.comercio-salud-y-estetica path {
  filter: drop-shadow(0 2px 4px rgba(239,68,68,0.3));
}

.comercio-indumentaria-y-accesorios path {
  filter: drop-shadow(0 2px 4px rgba(139,92,246,0.3));
}

/* Leyenda de comercios */
.comercios-legend {
  margin: 10px;
  z-index: 1000;
}

.comercios-legend:hover {
  transform: translateY(-2px);
  transition: transform 0.2s;
}
/* ===============================
   RESALTADO DE PARCELA SELECCIONADA
   =============================== */

/* Estilo para la parcela seleccionada - usando una clase específica */
.leaflet-interactive.parcela-seleccionada {
  stroke: #F7921E !important;
  stroke-width: 6px !important;
  stroke-opacity: 1 !important;
  fill: #F7921E !important;
  fill-opacity: 0.3 !important;
  filter: drop-shadow(0 0 8px rgba(247,146,30,0.6));
  animation: pulso-parcela 1.5s ease-in-out infinite;
}

/* Animación de pulso para la parcela seleccionada */
@keyframes pulso-parcela {
  0% {
    filter: drop-shadow(0 0 4px rgba(247,146,30,0.4));
  }
  50% {
    filter: drop-shadow(0 0 12px rgba(247,146,30,0.8));
  }
  100% {
    filter: drop-shadow(0 0 4px rgba(247,146,30,0.4));
  }
}

/* Estilo para parcelas no seleccionadas */
.leaflet-interactive.parcela-no-seleccionada {
  stroke: #3b82f6 !important;
  stroke-width: 1.5px !important;
  stroke-opacity: 0.8 !important;
  fill: #3b82f6 !important;
  fill-opacity: 0.1 !important;
}

/* Popup personalizado */
.parcela-popup-selected {
  border-left: 4px solid #F7921E;
}

.parcela-popup-normal {
  border-left: 4px solid #3b82f6;
}
/* ===============================
   RESALTADO DE PARCELA SELECCIONADA - VERSIÓN FUERTE
   =============================== */

/* Estilo para parcela seleccionada - FORZADO */
.parcela-seleccionada {
  stroke: #F7921E !important;
  stroke-width: 8px !important;
  stroke-opacity: 1 !important;
  fill: #F7921E !important;
  fill-opacity: 0.4 !important;
  filter: drop-shadow(0 0 15px rgba(247, 146, 30, 0.8)) !important;
  z-index: 1000 !important;
}

/* Estilo para parcelas normales */
.parcela-normal {
  stroke: #3b82f6 !important;
  stroke-width: 1.5px !important;
  stroke-opacity: 0.6 !important;
  fill: #3b82f6 !important;
  fill-opacity: 0.1 !important;
  filter: none !important;
  z-index: 1 !important;
}

/* Asegurar que la parcela seleccionada esté por encima */
.leaflet-pane.leaflet-overlay-pane path.parcela-seleccionada {
  z-index: 1000 !important;
}

/* Estilo para marcadores de comercios - FIJOS */
.comercio-marker {
  transition: all 0.2s ease;
  cursor: pointer;
  pointer-events: auto !important;
}

.comercio-marker:hover {
  r: 10 !important;
  stroke-width: 3 !important;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

/* Buffer - asegurar que no se deforme */
.buffer-layer {
  stroke: #22c55e !important;
  stroke-width: 3px !important;
  stroke-dasharray: none !important;
  fill: #22c55e !important;
  fill-opacity: 0.15 !important;
  vector-effect: non-scaling-stroke !important;
}

/* Leyenda de comercios */
.comercios-legend {
  background: white;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border: 1px solid #e2e8f0;
  margin: 10px;
  z-index: 1000;
}

.comercios-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
}

.comercios-legend-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-right: 8px;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
/* ===============================
   BUFFER PERFECTO - SIN DEFORMACIÓN
   =============================== */
.buffer-layer {
  stroke: #22c55e !important;
  stroke-width: 3px !important;
  stroke-opacity: 1 !important;
  fill: #22c55e !important;
  fill-opacity: 0.15 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  vector-effect: non-scaling-stroke !important;
}

/* Forzar que Leaflet no deforme los círculos */
.leaflet-overlay-pane path {
  vector-effect: non-scaling-stroke;
}

/* Mejorar la precisión del buffer */
.leaflet-interactive.buffer-layer {
  stroke-dasharray: none !important;
  animation: none !important;
}

/* ===============================
   ESTILOS PARA ZONA SELECCIONADA
   =============================== */
.zona-info {
  background: white;
  border-radius: 16px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.zona-nombre {
  font-size: 18px;
  font-weight: 600;
  color: #F7921E;
  margin-bottom: 4px;
}

.zona-stats {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}

/* Tags de usos */
.uso-tag {
  display: inline-block;
  padding: 8px 16px;
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  color: #1e40af;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #c7d2fe;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
  transition: all 0.2s;
}

.uso-tag:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.uso-tag.condicional {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  border-color: #fcd34d;
}

.usos-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
/* ===============================
   BADGES DE FILTROS ACTIVOS
   =============================== */
.filtros-activos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 12px;
  border-left: 4px solid #F7921E;
  margin: 16px 0;
  animation: slideIn 0.3s ease;
}

.tag-filtro {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 30px;
  font-size: 12px;
  color: #334155;
  transition: all 0.2s;
}

.tag-filtro i {
  font-size: 10px;
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 0.2s;
}

.tag-filtro i:hover {
  opacity: 1;
  color: #ef4444;
}

.tag-filtro:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
/* ===============================
   BUFFER - CÍRCULO PERFECTO
   =============================== */
.buffer-layer {
  stroke: #22c55e !important;
  stroke-width: 3px !important;
  stroke-opacity: 0.8 !important;
  fill: #22c55e !important;
  fill-opacity: 0.15 !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  vector-effect: non-scaling-stroke !important;
}

/* Asegurar que Leaflet renderice correctamente */
.leaflet-overlay-pane path.buffer-layer {
  stroke-dasharray: none !important;
}
/* ===============================
   HOVER Y SELECCIÓN DE PARCELAS
   =============================== */

/* Estilo para parcela seleccionada */
.parcela-seleccionada {
  stroke: #F7921E !important;
  stroke-width: 6px !important;
  stroke-opacity: 1 !important;
  fill: #F7921E !important;
  fill-opacity: 0.4 !important;
  filter: drop-shadow(0 0 10px rgba(247, 146, 30, 0.5)) !important;
  transition: all 0.2s ease;
  z-index: 1000 !important;
  animation: pulse-selected 2s ease-in-out infinite;
}

/* Animación de pulso para parcela seleccionada */
@keyframes pulse-selected {
  0% {
    filter: drop-shadow(0 0 5px rgba(247, 146, 30, 0.4));
  }
  50% {
    filter: drop-shadow(0 0 15px rgba(247, 146, 30, 0.8));
  }
  100% {
    filter: drop-shadow(0 0 5px rgba(247, 146, 30, 0.4));
  }
}

/* Estilo para parcelas normales */
.parcela-normal {
  stroke: #3b82f6 !important;
  stroke-width: 1.5px !important;
  stroke-opacity: 0.6 !important;
  fill: #3b82f6 !important;
  fill-opacity: 0.1 !important;
  transition: all 0.2s ease;
  cursor: pointer;
}

/* Efecto hover para parcelas normales */
.parcela-normal:hover {
  stroke: #F7921E !important;
  stroke-width: 3px !important;
  fill: #F7921E !important;
  fill-opacity: 0.25 !important;
  filter: drop-shadow(0 0 8px rgba(247, 146, 30, 0.4)) !important;
  z-index: 500 !important;
}

/* Asegurar que la parcela seleccionada esté por encima */
.leaflet-overlay-pane path.parcela-seleccionada {
  z-index: 1000 !important;
}

.leaflet-overlay-pane path.parcela-normal {
  z-index: 1 !important;
}

/* Transición suave para todos los cambios de estilo */
.leaflet-overlay-pane path {
  transition: stroke 0.2s ease, 
              stroke-width 0.2s ease, 
              fill 0.2s ease, 
              fill-opacity 0.2s ease,
              filter 0.2s ease;
}

/* Popup personalizado para parcela seleccionada */
.parcela-popup-selected .leaflet-popup-content-wrapper {
  border-left: 4px solid #F7921E;
  border-radius: 12px;
}

.parcela-popup-normal .leaflet-popup-content-wrapper {
  border-left: 4px solid #3b82f6;
  border-radius: 12px;
}
/* ===============================
   FIX PARA PÁGINA EN BLANCO
   =============================== */

/* Asegurar que el body siempre sea visible */
body {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 24px;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

/* Filtros activos */
#filtrosActivosComercios {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 12px;
    border-left: 4px solid #F7921E;
    margin: 16px 0;
}

.tag-filtro {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 30px;
    font-size: 11px;
    cursor: default;
}

.tag-filtro i {
    font-size: 10px;
    cursor: pointer;
    opacity: 0.6;
}

.tag-filtro i:hover {
    opacity: 1;
}

/* Debug panel */
#debugInfo {
    color: #4ade80;
    font-family: monospace;
    font-size: 11px;
    max-height: 100px;
    overflow-y: auto;
    padding: 4px;
}