/* =========================================================
   Estilos de la Herramienta de Localización por Coordenadas (IDESA)
   ========================================================= */

/* Botón en la barra superior de herramientas de Leaflet */
#coordinateLocator a {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#coordinateLocator i {
  font-size: 15px;
  color: #333333;
}

#coordinateLocator:hover i {
  color: #680205;
}

#coordinateLocator[hidden] {
  display: none !important;
}

/* Contenedor Flotante del Modal */
#coord-locator-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: transparent;
  pointer-events: none;
  z-index: 99986;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  box-sizing: border-box;
}

.coord-dialog {
  pointer-events: auto;
  background: #ffffff;
  width: 95%;
  max-width: 460px;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: #2c3e50;
  animation: coordFadeIn 0.2s ease-out;
}

@keyframes coordFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* Cabecera */
.coord-header {
  background: #680205;
  color: #ffffff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: move;
  user-select: none;
}

.coord-header h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.coord-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.coord-close-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 1;
}

.coord-close-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Cuerpo del diálogo */
.coord-body {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fdfdfd;
}

/* Pestañas de Formato (GMS / Decimal) */
.coord-tabs {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
  gap: 4px;
}

.coord-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.coord-tab-btn:hover {
  color: #0f172a;
}

.coord-tab-btn.active {
  color: #680205;
  border-bottom-color: #680205;
}

/* Sección de coordenadas */
.coord-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.coord-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.coord-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Cajitas para Grados, Minutos, Segundos */
.coord-gms-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr 1.1fr;
  gap: 6px;
  align-items: center;
}

.coord-input-box {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 6px;
  height: 34px;
  box-sizing: border-box;
}

.coord-input-box:focus-within {
  border-color: #680205;
  box-shadow: 0 0 0 2px rgba(104, 2, 5, 0.15);
}

.coord-input-box input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 0.9rem;
  color: #1e293b;
  text-align: right;
  padding-right: 4px;
}

.coord-unit {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
  user-select: none;
}

.coord-select {
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 6px;
  font-size: 0.85rem;
  color: #1e293b;
  background: #ffffff;
  outline: none;
  font-weight: 500;
  cursor: pointer;
}

.coord-select:focus {
  border-color: #680205;
}

/* Inputs para formato decimal */
.coord-dec-input {
  height: 34px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 10px;
  font-size: 0.9rem;
  color: #1e293b;
  background: #ffffff;
  outline: none;
  box-sizing: border-box;
  width: 100%;
}

.coord-dec-input:focus {
  border-color: #680205;
  box-shadow: 0 0 0 2px rgba(104, 2, 5, 0.15);
}

/* Ayuda / Centro del mapa */
.coord-quick-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 4px;
}

.coord-link-btn {
  background: transparent;
  border: none;
  color: #0284c7;
  font-size: 0.78rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.coord-link-btn:hover {
  color: #0369a1;
}

/* Pie del modal */
.coord-footer {
  padding: 10px 18px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.coord-btn-primary {
  background: #680205;
  color: #ffffff;
  border: none;
  padding: 7px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.coord-btn-primary:hover {
  background: #850307;
}

.coord-btn-secondary {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 7px 12px;
  font-size: 0.88rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.coord-btn-secondary:hover {
  background: #e2e8f0;
}

/* Marcador Pulsante Personalizado en el Mapa */
.coord-pin-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.coord-pin-icon {
  font-size: 28px;
  color: #680205;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45));
  animation: coordPinDrop 0.35s ease-out;
  transform-origin: bottom center;
}

@keyframes coordPinDrop {
  0% { transform: translateY(-20px) scale(0.6); opacity: 0; }
  60% { transform: translateY(4px) scale(1.1); opacity: 1; }
  100% { transform: translateY(0) scale(1); }
}

.coord-pin-pulse {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 14px;
  background: rgba(104, 2, 5, 0.4);
  border-radius: 50%;
  animation: coordPulse 1.6s infinite ease-out;
}

@keyframes coordPulse {
  0% { transform: translateX(-50%) scale(0.6); opacity: 1; }
  100% { transform: translateX(-50%) scale(3.2); opacity: 0; }
}

/* Popup de Coordenadas */
.coord-popup-box {
  min-width: 220px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 12px;
}

.coord-popup-title {
  margin: 0 0 6px 0;
  color: #680205;
  font-weight: 700;
  font-size: 13px;
  border-bottom: 1.5px solid #680205;
  padding-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.coord-popup-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 8px;
}

.coord-popup-table td {
  padding: 3px 2px;
  vertical-align: top;
}

.coord-popup-table td.label {
  font-weight: 600;
  color: #475569;
  width: 75px;
}

.coord-popup-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.coord-popup-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.coord-popup-btn:hover {
  background: #e2e8f0;
}

.coord-popup-btn.danger {
  color: #b91c1c;
  border-color: #fca5a5;
  background: #fef2f2;
}

.coord-popup-btn.danger:hover {
  background: #fee2e2;
}
