/**
 * Autocomplete de Direcciones - Estilos
 * ──────────────────────────────────────
 * Tema oscuro — basado en MapasAPI / index.html
 * Prefijo .ac- para no colisionar con otros frameworks.
 * Compatible con autocomplete.html + autocomplete.js
 *
 * Variables de color:
 *   --ac-accent : #3b82f6  (azul)
 *   --ac-dark   : #0d1424
 *   --ac-dark3  : #111827
 *   --ac-text   : #e2e8f0
 *   --ac-muted  : #94a3b8
 */

/* ── Wrapper principal ─────────────────────────────── */
.ac-wrap {
  position: relative;
  width: 100%;
  margin-bottom: .8rem;
}

/* ── Input + botón limpiar ─────────────────────────── */
.ac-input-group {
  display: flex;
  align-items: stretch;
  width: 100%;
}

.ac-input {
  flex: 1;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, .1);
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: .7rem 1rem;
  font-size: .9rem;
  color: #e2e8f0;
  outline: none;
  transition: border-color .2s;
  font-family: inherit;
  min-width: 0;
}

.ac-input::placeholder {
  color: #94a3b8;
}

.ac-input:focus {
  border-color: #3b82f6;
}

.ac-clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  background: #111827;
  border: 1px solid rgba(255, 255, 255, .1);
  border-left: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  color: #94a3b8;
  transition: background .2s, color .2s, border-color .2s;
  padding: 0;
  flex-shrink: 0;
}

.ac-clear-btn:hover {
  background: rgba(239, 68, 68, .15);
  color: #f87171;
  border-color: rgba(239, 68, 68, .3);
}

/* Cuando el input tiene foco, el botón acompaña el borde */
.ac-input:focus + .ac-clear-btn {
  border-color: #3b82f6;
}

/* ── Lista de sugerencias ──────────────────────────── */
.ac-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 100;
  background: #0d1424;
  border: 1px solid rgba(59, 130, 246, .4);
  border-radius: 8px;
  overflow: hidden;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}

/* ── Item individual ───────────────────────────────── */
.ac-item {
  padding: .65rem 1rem;
  cursor: pointer;
  font-size: .85rem;
  color: #e2e8f0;
  border-bottom: 1px solid rgba(255, 255, 255, .05);
  transition: background .15s;
}

.ac-item:last-child {
  border-bottom: none;
}

.ac-item:hover {
  background: rgba(59, 130, 246, .15);
}

.ac-item strong {
  color: #fff;
  display: block;
  font-size: .87rem;
}

.ac-item small,
.ac-item span {
  color: #94a3b8;
  font-size: .78rem;
  line-height: 1.4;
}

/* ── Coordenadas ───────────────────────────────────── */
.ac-coords {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.ac-coord-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(59, 130, 246, .1);
  border: 1px solid rgba(59, 130, 246, .3);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: .82rem;
  color: #e2e8f0;
}

.ac-coord-pill strong {
  color: #60a5fa;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* ── Scrollbar lista (WebKit) ──────────────────────── */
.ac-list::-webkit-scrollbar {
  width: 4px;
}
.ac-list::-webkit-scrollbar-track {
  background: #0d1424;
}
.ac-list::-webkit-scrollbar-thumb {
  background: rgba(59, 130, 246, .4);
  border-radius: 4px;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 480px) {
  .ac-input {
    font-size: 16px; /* evita zoom en iOS */
  }
}
