.egnos-availability-map-container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0 20px 20px 20px;
}

.map-info {
  margin-bottom: 20px;
  padding: 10px;
  background: white;
  border-radius: 4px;
}

.map-info p {
  margin: 5px 0;
  font-size: 14px;
  color: #666;
}

.selector-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.selector-group label {
  font-weight: bold;
  margin-right: 5px;
  color: #333;
}

.selector-group select {
  min-width: 100px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: white;
  font-size: 14px;
  width: auto;
}

.selector-group select:focus {
  outline: none;
  border-color: #007cba;
  box-shadow: 0 0 0 1px #007cba;
}

#update-map-btn {
  margin-left: 15px;
  padding: 8px 16px;
  background-color: #007cba;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.2s;
}

#update-map-btn:hover {
  background-color: #005a87;
}

#update-map-btn:active {
  transform: translateY(1px);
}

.map-wrapper {
  position: relative;
  background: white;
  padding: 10px;
  border-radius: 4px;
  text-align: center;
}

.map-container {
  position: relative;
  display: inline-block;
}

.egnos-map {
  max-width: 100%;
  height: auto;
  border: 1px solid #ddd;
  display: block;
}

.map-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: all;
  /*cursor: crosshair;*/
}

.map-tooltip {
  position: absolute;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.map-tooltip::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid rgba(0, 0, 0, 0.9);
}

.tooltip-content {
  line-height: 1.4;
}

.coverage-statistics {
  margin-top: 20px;
  padding: 15px;
  background: white;
  border-radius: 4px;
}

.coverage-statistics h3 {
  margin-top: 0;
  color: #333;
}

.coverage-stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.coverage-stats-table th,
.coverage-stats-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

.coverage-stats-table th {
  background-color: #f0f0f0;
  font-weight: bold;
}

.coverage-stats-table tr:hover {
  background-color: #f9f9f9;
}

.total-row {
  background-color: #f0f0f0;
  font-weight: bold;
}

/* Refresh button */
.egnos-refresh-btn {
  margin-left: 10px;
  padding: 5px 10px;
  background: #0073e6;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.egnos-refresh-btn:hover {
  background: #005bb5;
}

/* Loading animation */
.map-loading {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Leyenda movible */
.map-legend {
  position: absolute;
  top: 50px;
  right: 20px;
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 100;
  min-width: 150px;
  cursor: move;
  user-select: none;
}

.map-legend.dragging {
  opacity: 0.8;
  cursor: grabbing;
}

.legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ddd;
  font-weight: bold;
  font-size: 14px;
}

.legend-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  color: #666;
}

.legend-toggle:hover {
  background-color: #f0f0f0;
  border-radius: 2px;
}

.legend-content {
  display: block;
}

.legend-content.collapsed {
  display: none;
}

.legend-item {
  display: flex;
  align-items: center;
  margin-bottom: 5px;
  font-size: 13px;
}

.legend-color {
  width: 20px;
  height: 16px;
  border: 1px solid #666;
  margin-right: 8px;
  display: inline-block;
}

.legend-label {
  color: #333;
}

/* Opción: Leyenda semi-transparente al pasar el mouse sobre el mapa */
/* .map-wrapper:hover .map-legend:not(.dragging) {
  opacity: 0.3;
  transition: opacity 0.3s;
} */

.map-legend:hover {
  opacity: 1 !important;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
  .egnos-availability-map-container {
    padding: 10px;
  }
  
  .coverage-stats-table {
    font-size: 14px;
  }
  
  .map-tooltip {
    font-size: 11px;
    padding: 6px 10px;
  }
}

.map-tooltip::after {
  display: none;
}

#map-overlay {
  cursor: pointer; 
}

.egnos-map-loader {
  position: absolute;
  inset: 10px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  visibility: hidden;
  opacity: 0;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 4px;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}

.egnos-map-loader.is-visible {
  visibility: visible;
  opacity: 1;
}

.egnos-map-loader__spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(0, 124, 186, 0.2);
  border-top-color: #007cba;
  border-radius: 50%;
  animation: egnos-map-spinner 0.8s linear infinite;
}

.egnos-map-loader__text {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 4px;
  color: #333;
  font-size: 14px;
  font-weight: 600;
}

.egnos-map-loader.is-success
  .egnos-map-loader__spinner {
  display: none;
}

.egnos-map-loader.is-success
  .egnos-map-loader__text {
  color: #1b5e20;
}

.map-wrapper.loading #egnos-map-image {
  opacity: 0.55;
  transition: opacity 0.2s ease;
}

@keyframes egnos-map-spinner {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .egnos-map-loader,
  .map-wrapper.loading #egnos-map-image {
    transition: none;
  }

  .egnos-map-loader__spinner {
    animation-duration: 1.5s;
  }
}


/* ---------------------------------------- */
/* EGNOS map heading and filters.           */
/* ---------------------------------------- */

.egnos-map-header {
  margin-bottom: 15px;
}

.egnos-map-header__title h2 {
  margin-top: 0;
  margin-bottom: 5px;
  color: #333;
  font-size: 26px;
  font-weight: 500;
}

.egnos-map-header__title p {
  margin-bottom: 0;
  font-size: 14px;
}

/*
 * Bootstrap 3 panel customization scoped to the EGNOS component.
 */
.egnos-map-controls {
  margin-bottom: 20px;
  border-color: #d9e2e8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.egnos-map-controls > .panel-heading {
  padding: 12px 15px;
  color: #333;
  background-color: #f8fafb;
  border-color: #d9e2e8;
}

.egnos-map-controls .panel-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 600;
}

.egnos-map-controls .panel-title .glyphicon {
  color: #007cba;
}

.egnos-map-controls > .panel-body {
  padding: 18px 15px 14px;
}

@media (min-width: 768px) {
  .panel-body .row > div {
    margin-right: 10px;
  }
}
/*
 * Remove the bottom margin on desktop because all controls share one row.
 */
.egnos-map-controls .form-group {
  margin-bottom: 10px;
}

.egnos-map-controls label,
.egnos-map-control-label {
  display: block;
  margin-bottom: 6px;
  color: #444;
  font-size: 13px;
  font-weight: 600;
}

.egnos-map-controls .form-control {
  height: 38px;
  border-color: #c7d0d7;
  border-radius: 4px;
  box-shadow: none;
  font-size: 14px;
}

.egnos-map-controls .form-control:hover {
  border-color: #9baab5;
}

.egnos-map-controls .form-control:focus {
  border-color: #007cba;
  box-shadow: 0 0 0 1px rgba(0, 124, 186, 0.2);
}

/*
 * Makes action buttons align vertically with select fields.
 */
.egnos-map-control-action .btn {
  height: 38px;
  overflow: hidden;
  border-color: #c7d0d7;
  background-color: #fff;
  color: #333;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.egnos-map-control-action .btn:hover,
.egnos-map-control-action .btn:focus {
  border-color: #007cba;
  background-color: #f4f9fc;
  color: #005a87;
}

.egnos-map-control-action .btn[aria-pressed="true"] {
  border-color: #007cba;
  background-color: #eaf5fb;
  color: #005a87;
}

.egnos-map-control-action .glyphicon {
  margin-right: 5px;
}

/*
 * Help row under the controls.
 */
.egnos-map-controls__help {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  padding-top: 10px;
  border-top: 1px solid #edf0f2;
  color: #68747c;
  font-size: 12px;
}

.egnos-map-controls__help .glyphicon {
  color: #007cba;
}

/*
 * Disabled state while AJAX map generation is running.
 */
.egnos-map-controls select[disabled] {
  cursor: wait;
  opacity: 0.7;
}

/* ---------------------------------------- */
/* Map structure.                           */
/* ---------------------------------------- */

.map-wrapper {
  position: relative;
}

.map-container {
  position: relative;
  display: inline-block;
  max-width: 100%;
}

.egnos-map {
  display: block;
  max-width: 100%;
  height: auto;
}

.coordinate-axes,
.grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.grid-overlay {
  z-index: 5;
}

/*
 * Information panels below the map.
 */
.grid-overlay-info,
.coordinate-axes-info {
  margin-top: 20px;
  margin-bottom: 0;
}

.grid-overlay-info .panel-body,
.coordinate-axes-info .panel-body {
  font-size: 14px;
}

.grid-overlay-info ul {
  margin-bottom: 10px;
}

/* ---------------------------------------- */
/* Responsive adjustments.                  */
/* ---------------------------------------- */

@media (min-width: 768px) {
  .egnos-map-controls .form-group {
    margin-bottom: 0;
  }
}

@media (max-width: 767px) {
  .egnos-map-header__title h2 {
    font-size: 22px;
  }

  .egnos-map-controls > .panel-body {
    padding: 15px;
  }

  .egnos-map-controls .form-group {
    margin-bottom: 15px;
  }

  .egnos-map-controls__help {
    margin-top: 0;
  }
}