/*
 * Ambulancia Mediks — Estilos del widget
 * Tokens Figma: bg #F4F6FF · navy #324986 · sos #FF5757 · action #FF914D · accent #9FC54D
 * Fuente: Inter (Google Fonts / sistema)
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700;800;900&display=swap');

/* =============================================================================
   Widget — raíz y layout
   ============================================================================= */

.amb-widget {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #F4F6FF !important;
  border-radius: 6px;
  max-width: 420px;
  margin: 0 auto;
  padding: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Refuerzo de fondo para que el tema de WP no lo sobreescriba */
.amb-seccion-sos {
  background: #F4F6FF !important;
}

/* =============================================================================
   Sección SOS (parte superior)
   ============================================================================= */

.amb-seccion-sos {
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 8px;
}

.solicitudes-restantes {
  color: #324986;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  letter-spacing: -0.011em;
  margin: 0 0 10px;
  background: none;
  border: none;
  padding: 0;
}

.limite-alcanzado {
  background: #fee2e2;
  color: #7f1d1d;
  padding: 16px 20px;
  border-radius: 6px;
  border-left: 4px solid #FF5757;
  margin-bottom: 20px;
}

/* ─── Wrapper relativo: SVG ring + botón SOS centrado ─── */
.amb-sos-wrapper {
  position: relative;
  width: 300px;
  height: 300px;
  margin: 4px auto 12px;
  flex-shrink: 0;
}

.amb-sos-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}

.amb-ring-text {
  font-family: 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 800;
  fill: #324986;
  letter-spacing: 2px;
}

/* ─── Botón SOS ─── */
.ambulancia-mediks-sos-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 190px;
  height: 190px;
  background: #FF5757;
  color: #ffffff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  overflow: hidden;
  /* recorta las ondas del SVG de campana en el borde del círculo */
  box-shadow: 0 0 0 0 rgba(255, 87, 87, 0.6);
  animation: amb-pulse-sos 2s infinite;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ambulancia-mediks-sos-button:hover:not(:disabled) {
  transform: translate(-50%, -50%) scale(1.06);
}

.ambulancia-mediks-sos-button:active:not(:disabled) {
  transform: translate(-50%, -50%) scale(0.95);
}

.ambulancia-mediks-sos-button:disabled {
  background: #ffb3b3;
  animation: none;
  cursor: not-allowed;
  box-shadow: none;
}

@keyframes amb-pulse-sos {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 87, 87, 0.6);
  }

  70% {
    box-shadow: 0 0 0 28px rgba(255, 87, 87, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 87, 87, 0);
  }
}

/* Ícono campana SVG blanco dentro del botón SOS */
.sos-bell-icon {
  width: 114px;
  height: 90px;
  display: block;
  flex-shrink: 0;
}

.sos-label {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 4px;
  line-height: 1;
  color: #ffffff;
}

/* =============================================================================
   Sección Ubicación
   ============================================================================= */

.amb-seccion-ubicacion {
  background: #F4F6FF;
  padding: 8px 16px 0;
  text-align: center;
}

.amb-titulo-seccion {
  font-size: 28px;
  font-weight: 700;
  color: #324986;
  letter-spacing: -0.011em;
  margin: 8px 0 14px;
  line-height: 1.2;
}

.amb-ubicacion-status {
  font-size: 13px;
  color: #50575e;
  line-height: 1.6;
  margin-bottom: 10px;
  min-height: 20px;
}

/* Caja de dirección */
.amb-address-box {
  background: #324986;
  border-radius: 6px;
  color: #ffffff;
  display: block;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -0.011em;
  margin: 0 auto 12px;
  padding: 18px 16px;
  text-align: center;
  word-break: break-word;
  max-width: 100%;
}

.amb-address-box--warn {
  background: #b45309;
}

.amb-addr-pin {
  margin-right: 4px;
}

.amb-tag-aproximado {
  display: inline-block;
  background: #FF914D;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 5px;
  vertical-align: middle;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.amb-cargando {
  color: #324986;
  font-style: italic;
}

.amb-aviso-ubicacion-ip {
  color: #b45309;
  display: block;
  margin-top: 4px;
  font-size: 0.875em;
}

.amb-error-inline {
  color: #dc2626;
  display: block;
  font-size: 12px;
  margin-top: 4px;
}

/* Banner confirmación IP */
.amb-confirmacion-ip-banner {
  background: #fffbeb;
  border: 1.5px solid #f59e0b;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 4px 0 10px;
  text-align: left;
}

.amb-confirmacion-ip-texto {
  font-size: 13px;
  color: #78350f;
  margin: 0 0 10px;
  line-height: 1.5;
}

.amb-btn-confirmar-ubicacion {
  background: #16a34a;
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  transition: background 0.2s;
  width: 100%;
}

.amb-btn-confirmar-ubicacion:hover {
  background: #15803d;
}

.amb-btn-confirmar-ubicacion:active {
  background: #166534;
}

/* Mapa de previsualización - siempre visible tras cargar */
.amb-preview-map {
  border-radius: 8px;
  height: 180px;
  margin: 0 0 8px;
  overflow: hidden;
  width: 100%;
  pointer-events: none;
  background: #dde1ef;
  /* placeholder gris mientras carga tiles */
}

/* Botón Cambiar ubicación — naranja, siempre visible */
.amb-btn-cambiar-ubicacion {
  background: #FF914D;
  border: none;
  border-radius: 6px;
  color: rgba(0, 0, 0, 0.80);
  cursor: pointer;
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.011em;
  margin-top: 10px;
  padding: 18px 16px;
  text-align: center;
  transition: background 0.2s, transform 0.15s;
  width: 100%;
}

.amb-btn-cambiar-ubicacion:hover {
  background: #e87d39;
}

.amb-btn-cambiar-ubicacion:active {
  transform: scale(0.98);
}

/* =============================================================================
   SweetAlert2 — branding Mediks
   ============================================================================= */

.amb-swal-popup {
  font-family: 'Inter', sans-serif !important;
  border-radius: 12px !important;
}

.amb-swal-popup .swal2-html-container,
.amb-swal-popup .swal2-textarea {
  font-family: 'Inter', sans-serif;
}

.amb-swal-popup .swal2-textarea {
  border: 1.5px solid #dde1ef;
  border-radius: 6px;
  font-size: 14px;
  color: #2c3338;
}

.amb-swal-popup .swal2-textarea:focus {
  border-color: #324986;
  box-shadow: 0 0 0 3px rgba(50, 73, 134, 0.12);
}

.amb-swal-popup .swal2-validation-message {
  border-radius: 6px;
}

/* =============================================================================
   Modal de mapa — Rappi-style
   ============================================================================= */

.amb-map-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  align-items: flex-end;
  justify-content: center;
}

.amb-map-modal--open {
  display: flex;
}

@media (min-width: 481px) {
  .amb-map-modal {
    align-items: center;
  }
}

.amb-map-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(2px);
}

.amb-map-modal__container {
  position: relative;
  background: #fff;
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 540px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  overflow: visible;
  box-shadow: 0 -4px 32px rgba(50, 73, 134, 0.18);
  animation: ambModalUp 0.28s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@media (min-width: 481px) {
  .amb-map-modal__container {
    border-radius: 14px;
    max-height: 88dvh;
  }
}

@keyframes ambModalUp {
  from {
    transform: translateY(60px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.amb-map-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  flex-shrink: 0;
  border-bottom: 1px solid #eef0f8;
}

.amb-map-modal__title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #324986;
}

.amb-map-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: #324986;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 50%;
  transition: background 0.15s;
}

.amb-map-modal__close:hover {
  background: #f0f3fb;
}

.amb-map-modal__search {
  padding: 12px 14px 8px;
  flex-shrink: 0;
  position: relative;
  z-index: 1000;
}

.amb-search-wrap {
  position: relative;
  border: 1.5px solid #dde1ef;
  border-radius: 8px;
  background: #f8f9fd;
  display: flex;
  align-items: center;
}

.amb-search-wrap:focus-within {
  border-color: #324986;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(50, 73, 134, 0.10);
}

.amb-search-icon {
  padding: 0 8px 0 12px;
  font-size: 15px;
  pointer-events: none;
  flex-shrink: 0;
}

.amb-search-input {
  border: none;
  background: transparent;
  outline: none;
  width: 100%;
  padding: 10px 10px 10px 0;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: #2c3338;
}

.amb-search-input::placeholder {
  color: #a0aab8;
}

.amb-search-results {
  display: none;
  position: fixed;
  background: #fff;
  border: 1.5px solid #dde1ef;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(50, 73, 134, 0.12);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 220px;
  overflow-y: auto;
  z-index: 99999;
  min-width: 280px;
}

.amb-search-result-item {
  padding: 9px 14px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: #2c3338;
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.12s;
}

.amb-search-result-item:hover {
  background: #f4f6ff;
}

.amb-search-no-results {
  color: #9ca3af;
  font-style: italic;
  cursor: default;
  pointer-events: none;
}

.amb-map-modal__map {
  flex: 1;
  min-height: 280px;
  overflow: hidden;
}

.amb-map-modal__footer {
  padding: 12px 14px 14px;
  flex-shrink: 0;
  border-top: 1px solid #eef0f8;
  background: #fff;
}

.amb-modal-address {
  background: #324986;
  color: #fff;
  border-radius: 8px;
  padding: 9px 13px;
  font-size: 13px;
  margin-bottom: 10px;
  word-break: break-word;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.amb-map-modal__actions {
  display: flex;
  gap: 8px;
}

.amb-btn-redetectar {
  flex: 1;
  padding: 12px 8px;
  border: 2px solid #324986;
  background: transparent;
  color: #324986;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.amb-btn-redetectar:hover {
  background: #324986;
  color: #fff;
}

.amb-btn-confirmar-modal {
  flex: 2;
  padding: 12px;
  background: #9FC54D;
  border: none;
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
}

.amb-btn-confirmar-modal:hover {
  background: #8ab43d;
}

.amb-btn-confirmar-modal:active {
  transform: scale(0.97);
}

/* =============================================================================
   Responsive — móvil (< 480px)
   ============================================================================= */

@media (max-width: 480px) {
  .amb-sos-wrapper {
    width: 260px;
    height: 260px;
  }

  .ambulancia-mediks-sos-button {
    width: 160px;
    height: 160px;
  }

  .sos-bell-icon {
    width: 95px;
    height: 75px;
  }

  .sos-label {
    font-size: 24px;
  }

  .amb-ring-text {
    font-size: 16px;
    letter-spacing: 1px;
  }

  .amb-titulo-seccion {
    font-size: 24px;
  }

  .amb-seccion-ubicacion {
    padding: 8px 12px 0;
  }

  .amb-btn-cambiar-ubicacion {
    padding: 14px;
    font-size: 15px;
  }

  .amb-map-modal__container {
    max-height: 100dvh;
    border-radius: 16px 16px 0 0;
  }

  .amb-preview-map {
    height: 150px;
  }
}