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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

.header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  backdrop-filter: blur(10px);
  padding: 0.8rem 2rem;
  box-shadow: 0 2px 20px rgba(0,0,0,0.1);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.header-content {
  display: flex;
  justify-content: center;
  align-items: center;
  max-width: 1400px;
  margin: 0 auto;
}

.header-logo h1 {
  color: white;
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0;
  text-align: center;
}

.header-logo p {
  color: rgba(255, 255, 255, 0.9);
  margin-top: 0.2rem;
  margin-bottom: 0;
  font-size: 0.9rem;
  text-align: center;
}

.main-container {
  display: flex;
  margin-top: 80px;
  height: calc(100vh - 80px);
}

.map-container {
  flex: 1;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}



.aliado-info {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

.aliado-price {
  color: #667eea;
  font-weight: 600;
  font-size: 1.1rem;
}

.controls {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.control-group {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.15);
  min-width: 200px;
}

/* Estilos para los botones de capas */
.layer-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.layer-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.layer-btn:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a5acd 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.layer-btn.active {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  border-color: #28a745;
  color: white;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.layer-btn.active:hover {
  background: linear-gradient(135deg, #20c997 0%, #28a745 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(40, 167, 69, 0.5);
}

/* Estilos para botón de filtros activo */
.control-btn.filters-active {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
}

/* Estilos para botón de filtros activo en hover */
.control-btn.filters-active:hover {
  background: linear-gradient(135deg, #20c997 0%, #28a745 100%) !important;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(40, 167, 69, 0.5);
}

.control-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border: none;
  border-radius: 8px;
  padding: 0.75rem;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  font-weight: 600;
  width: 100%;
  justify-content: center;
}

.control-btn:hover {
  background: linear-gradient(135deg, #5a6fd8 0%, #6a5acd 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 2rem;
  border-radius: 15px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #eee;
}

.close {
  color: #aaa;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close:hover {
  color: #333;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

.btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
  background: #6c757d;
}

.btn-secondary:hover {
  box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4);
}

.loading {
  text-align: center;
  padding: 2rem;
  color: #666;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 10px;
  border: 1px solid #dee2e6;
}

.loading i {
  font-size: 2rem;
  color: #667eea;
  margin-bottom: 1rem;
}

.error {
  background: #f8d7da;
  color: #721c24;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
}

.success {
  background: #d4edda;
  color: #155724;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
}

.info {
  background: #d1ecf1;
  color: #0c5460;
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
}

.legend {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(255, 255, 255, 0.95);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  z-index: 1000;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.legend-color {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  margin-right: 0.5rem;
}

/* Estilos para marcadores de aliados */
.aliado-marker {
  background: transparent;
  border: none;
}

.aliado-marker div {
  transition: all 0.3s ease;
}

.aliado-marker:hover div {
  transform: scale(1.2);
  box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

/* Mejorar popups de Leaflet */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.leaflet-popup-content {
  margin: 10px;
  line-height: 1.4;
}

/* Estilos para tooltips personalizados */
.custom-tooltip {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  padding: 0;
}

.custom-tooltip::before {
  border-top-color: #ddd;
}

/* Estilos para popups de aliados */
.aliado-popup .leaflet-popup-content-wrapper {
  border-radius: 10px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.aliado-popup .leaflet-popup-content {
  margin: 0;
  padding: 0;
}

.aliado-popup .leaflet-popup-tip {
  background: white;
}

/* Estilos para el panel de estadísticas de filtros */
.filter-stats-panel {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #dee2e6;
  border-radius: 10px;
  padding: 15px;
  margin: 15px 0;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  animation: slideIn 0.3s ease;
}

.filter-stats-panel h4 {
  margin: 0 0 10px 0;
  color: #333;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-stats-panel .stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  font-size: 12px;
}

.filter-stats-panel .stats-grid strong {
  color: #495057;
  font-weight: 600;
}

.filter-stats-panel .stats-grid div {
  padding: 5px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 5px;
  border-left: 3px solid #667eea;
}

/* Estilos para el rango de precios */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-track {
  background: #ddd;
  height: 6px;
  border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  background: #667eea;
  height: 18px;
  width: 18px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input[type="range"]::-moz-range-track {
  background: #ddd;
  height: 6px;
  border-radius: 3px;
  border: none;
}

input[type="range"]::-moz-range-thumb {
  background: #667eea;
  height: 18px;
  width: 18px;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}



/* Estilos para filtros */
.filter-section {
  margin-bottom: 15px;
}

.filter-section label {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  color: #666;
}

.filter-section select {
  font-size: 12px;
  padding: 5px;
}

.price-range-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.price-range-container input[type="range"] {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: #ddd;
  outline: none;
}

.price-value {
  font-size: 11px;
  color: #666;
  min-width: 80px;
  text-align: right;
}

.price-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #999;
  margin-top: 2px;
}

.active-filters-count {
  background: #667eea;
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 10px;
  margin-left: 5px;
}

.active-filters-count.active {
  background: #28a745;
}

/* Estilos para detalles de aliados */
.details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.details-grid h4 {
  color: #333;
  margin-bottom: 10px;
}

.details-grid h4 i {
  color: #28a745;
}

.details-grid p {
  margin: 5px 0;
  font-size: 16px;
}

.details-grid strong {
  color: #333;
}

.details-grid a {
  color: #007bff;
  text-decoration: none;
  font-size: 18px;
}

.details-grid a:hover {
  text-decoration: underline;
}

/* Estilos para botones de acción */
.action-buttons {
  margin-top: 30px;
  text-align: center;
}

.action-buttons .btn {
  margin-right: 10px;
}

.action-buttons .btn:last-child {
  margin-right: 0;
}

/* Estilos para mensajes de estado */
.status-message {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 8px;
  font-weight: 600;
}

.status-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.status-message.info {
  background: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

/* Estilos para botones de filtro */
.filter-buttons {
  margin-top: 10px;
}

.filter-buttons .btn {
  width: 100%;
  font-size: 12px;
  padding: 8px;
  margin-bottom: 5px;
}

.filter-buttons .btn:last-child {
  margin-bottom: 0;
}

/* Estilos para el sidebar colapsado en móvil */
@media (max-width: 768px) {
  .header {
    padding: 0.6rem 1rem;
  }
  
  .header-logo h1 {
    font-size: 1.3rem;
  }
  
  .header-logo p {
    font-size: 0.8rem;
  }
  
  .controls {
    bottom: 15px;
    right: 15px;
    gap: 12px;
  }
  
  .control-group {
    padding: 12px;
    min-width: 180px;
  }
  
  .layer-controls h4 {
    font-size: 11px;
    margin-bottom: 6px;
  }
  
  .layer-buttons {
    gap: 6px;
  }
  
  .layer-btn {
    padding: 6px 8px;
    font-size: 10px;
  }
  
  .layer-controls {
    padding: 12px;
  }
  
  .layer-buttons {
    flex-direction: row;
    gap: 8px;
  }
  
  .layer-btn {
    padding: 6px 8px;
    font-size: 10px;
  }
  


  .controls {
    top: 10px;
    right: 10px;
  }

  .control-btn {
    padding: 0.5rem;
    font-size: 0.9rem;
  }
  
  .control-btn span {
    display: none;
  }
  
  .legend {
    bottom: 10px;
    left: 10px;
    padding: 0.5rem;
    font-size: 0.8rem;
  }
  
  .legend h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
  }
  
  .legend-item {
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .header {
    padding: 0.5rem 0.8rem;
  }
  
  .header-logo h1 {
    font-size: 1.1rem;
  }
  
  .header-logo p {
    font-size: 0.7rem;
  }
  
  .controls {
    bottom: 10px;
    right: 10px;
    gap: 10px;
  }
  
  .control-group {
    padding: 10px;
    min-width: 160px;
  }
  
  .control-group h4 {
    font-size: 10px;
    margin-bottom: 5px;
  }
  
  .layer-buttons {
    gap: 5px;
  }
  
  .layer-btn {
    padding: 5px 6px;
    font-size: 9px;
  }
  
  .layer-buttons {
    gap: 5px;
  }
  
  .control-btn {
    padding: 0.6rem;
    font-size: 0.8rem;
  }
  
  .modal-content {
    margin: 2% auto;
    padding: 1rem;
    width: 95%;
  }
  
  #aliadosModal .modal-content {
    max-width: 95%;
    margin: 5% auto;
  }
  
  .aliados-list-container {
    max-height: 300px;
  }
  
  .aliado-item {
    padding: 12px;
  }
  
  .aliado-details {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  
  .stat-number {
    font-size: 1.5rem;
  }
  
  .details-grid {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  
  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px;
  }
}

/* Estilos específicos para el modal de filtros */
#filtersModal .modal-content {
  max-width: 500px;
}

#filtersModal .search-container {
  padding: 0;
}

#filtersModal .search-box {
  margin-bottom: 0;
}

/* Estilos para campos del modal de filtros */
#filtersModal input[type="text"],
#filtersModal select {
  width: 100%;
  padding: 12px;
  border: 2px solid #e1e5e9;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  background: white;
}

#filtersModal input[type="text"]:focus,
#filtersModal select:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#filtersModal input[type="range"] {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: #ddd;
  outline: none;
  margin: 10px 0;
}

#filtersModal input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  background: #667eea;
  height: 20px;
  width: 20px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#filtersModal label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: #333;
  font-weight: 600;
}

/* Estilos específicos para el modal de aliados */
#aliadosModal .modal-content {
  max-width: 700px;
  max-height: 80vh;
}

.aliados-header {
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}

.stats-summary {
  display: flex;
  justify-content: center;
  gap: 30px;
}

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

.stat-item .stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: #667eea;
  margin-bottom: 5px;
}

.stat-item .stat-label {
  font-size: 1rem;
  color: #666;
  font-weight: 600;
}

.aliados-list-container {
  max-height: 400px;
  overflow-y: auto;
  padding-right: 10px;
}

.aliado-item {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 15px;
  transition: all 0.3s ease;
}

.aliado-item:hover {
  background: #e9ecef;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.aliado-header h3 {
  margin: 0 0 8px 0;
  color: #333;
  font-size: 1.1rem;
  font-weight: 600;
}

.aliado-location {
  color: #666;
  font-size: 0.9rem;
  font-style: italic;
}

.aliado-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #dee2e6;
}

.aliado-contact,
.aliado-price {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.aliado-contact i {
  color: #28a745;
}

.aliado-price i {
  color: #ffc107;
}

.aliado-contact span,
.aliado-price span {
  font-weight: 600;
  color: #333;
}

/* Estilos para loading de aliados */
.loading-aliados {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.loading-aliados i {
  font-size: 2rem;
  color: #667eea;
  margin-bottom: 15px;
}

.loading-aliados p {
  font-size: 1rem;
  margin: 0;
}

/* Estilos para cuando no hay aliados */
.no-aliados {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.no-aliados i {
  font-size: 2rem;
  color: #dc3545;
  margin-bottom: 15px;
}

.no-aliados p {
  font-size: 1rem;
  margin: 0;
}

/* Mejorar el scroll del modal de aliados */
#aliadosModal .modal-content {
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#aliadosModal .modal-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.aliados-list-container {
  flex: 1;
  overflow-y: auto;
  padding-right: 10px;
  max-height: 60vh;
}

/* Estilos para el scrollbar */
.aliados-list-container::-webkit-scrollbar {
  width: 8px;
}

.aliados-list-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.aliados-list-container::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 4px;
}

.aliados-list-container::-webkit-scrollbar-thumb:hover {
  background: #5a6fd8;
}
