/* ============================================================
   One F Stop — Address / Phone / Country Controls
   ============================================================ */

/* ── Address autocomplete ───────────────────────────────────── */
.address-search-wrap {
  position: relative;
}

.address-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  letter-spacing: 0.04em;
}

.address-suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  z-index: 100;
  max-height: 200px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.address-suggestions.open {
  display: block;
}

.address-suggestion-item {
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
  transition: background var(--transition);
}

.address-suggestion-item:last-child { border-bottom: none; }
.address-suggestion-item:hover,
.address-suggestion-item.focused {
  background: rgba(200,169,110,0.1);
  color: var(--white);
}

.address-suggestion-item strong {
  color: var(--accent);
  font-weight: 600;
}

.address-suggestion-secondary {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.address-loading {
  padding: 0.75rem 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ── Country dropdown ───────────────────────────────────────── */
.country-select-wrap {
  position: relative;
}

.country-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  z-index: 100;
  max-height: 240px;
  overflow-y: auto;
  display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.country-dropdown.open { display: block; }

.country-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.country-option:last-child { border-bottom: none; }
.country-option:hover,
.country-option.focused {
  background: rgba(200,169,110,0.1);
  color: var(--white);
}

.country-flag { font-size: 1.2rem; flex-shrink: 0; }
.country-name { flex: 1; }

/* ── Phone field ────────────────────────────────────────────── */
.phone-wrap {
  display: flex;
  gap: 0;
  align-items: stretch;
}

.phone-code-wrap {
  position: relative;
  flex-shrink: 0;
}

.phone-code-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.75rem;
  height: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: border-color var(--transition), background var(--transition);
  min-width: 90px;
}

.phone-code-btn:hover,
.phone-code-btn:focus-visible {
  border-color: var(--accent);
  background: var(--bg-2);
  outline: none;
}

.phone-flag    { font-size: 1.1rem; }
.phone-code    { color: var(--accent); font-size: 0.82rem; letter-spacing: 0.04em; }
.phone-code-arrow { font-size: 0.65rem; color: var(--text-muted); }

.phone-wrap input[type="tel"] {
  flex: 1;
  border-radius: 0 var(--radius) var(--radius) 0 !important;
}

.phone-code-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 280px;
  background: var(--bg-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  max-height: 300px;
  display: flex;
  flex-direction: column;
}

.phone-code-search-wrap {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.phone-code-search-wrap input {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  outline: none;
}

.phone-code-search-wrap input:focus { border-color: var(--accent); }

.phone-code-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  margin: 0;
  padding: 0;
}

.phone-code-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.phone-code-item:last-child { border-bottom: none; }
.phone-code-item:hover      { background: rgba(200,169,110,0.1); color: var(--white); }

.phone-code-item .flag  { font-size: 1.1rem; flex-shrink: 0; }
.phone-code-item .cname { flex: 1; }
.phone-code-item .dial  { color: var(--accent); font-size: 0.78rem; }

/* ── Mobile fixes ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .phone-code-dropdown {
    width: min(280px, calc(100vw - 4rem));
    left: 0;
  }

  .address-suggestions,
  .country-dropdown {
    max-height: 180px;
  }

  /* Ensure phone wrap stays together */
  .phone-wrap { flex-wrap: nowrap; }

  .phone-code-btn {
    min-height: 44px;
    font-size: 0.78rem;
    min-width: 80px;
  }
}

/* ── Address field grids ─────────────────────────────────────── */
.address-grid-street {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 1rem;
}

.address-grid-plz {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 1rem;
}

.member-complete-form .address-grid-street {
  grid-template-columns: 1fr 130px;
}

.member-complete-form .address-grid-plz {
  grid-template-columns: 140px 1fr;
}

@media (max-width: 480px) {
  .address-grid-street {
    grid-template-columns: 1fr 72px;
    gap: 0.6rem;
  }
  .address-grid-plz {
    grid-template-columns: 80px 1fr;
    gap: 0.6rem;
  }

  .member-complete-form .address-grid-street {
    grid-template-columns: minmax(0, 1fr) 130px;
  }

  .member-complete-form .address-grid-plz {
    grid-template-columns: 140px minmax(0, 1fr);
  }
}
