/* =============================================================
   Phone Input Component — country flag + dial code + national number
   Wraps a plain <input> (see public/js/phone-input.js). Visually matches
   .form-input (gold/cream light theme). Light theme only — app is light-only.
   ============================================================= */

.phone-input-wrap {
  display: flex;
  align-items: stretch;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-2);
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
  width: 100%;
}
.phone-input-wrap:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}

/* The wrapped native input no longer draws its own box — the wrap does. */
.phone-input-wrap input {
  flex: 1;
  min-width: 0;
  width: auto;
  border: none;
  background: transparent;
  border-radius: 0;
  padding: 8px 12px 8px 6px;
  font: inherit;
  font-size: 13px;
  color: var(--fg);
}
.phone-input-wrap input:focus {
  outline: none;
  box-shadow: none;
  border-color: transparent;
}
.phone-input-wrap input::placeholder { color: var(--fg-dim); }

.phone-input-country {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  border: none;
  border-right: 1px solid var(--border-soft);
  background: transparent;
  padding: 0 8px 0 10px;
  cursor: pointer;
  color: var(--fg);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.phone-input-country:hover { background: var(--bg-elev-3); }
.phone-input-flag { font-size: 15px; line-height: 1; }
.phone-input-country .phone-input-dial {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--fg-muted);
  white-space: nowrap;
}
.phone-input-caret { flex-shrink: 0; color: var(--fg-dim); }

/* Nested inside the Settings-style .text-input wrapper (e.g. #bizPhone):
   the outer .text-input already draws the box, so the phone-input-wrap
   goes flush/transparent to avoid a double border. */
.text-input .phone-input-wrap {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}
.text-input .phone-input-wrap:focus-within { box-shadow: none; border-color: transparent; }
.text-input .phone-input-wrap input { padding: 0; font-size: 13.5px; }
.text-input .phone-input-country { padding: 0 8px 0 0; border-right: 1px solid var(--border-soft); }

/* ── Dropdown — appended to <body>, position:fixed so it's never clipped by
   a scrolling .modal-body and always outranks modal/drawer stacking. ────── */
.phone-input-dropdown {
  position: fixed;
  z-index: var(--z-popover);
  display: flex;
  flex-direction: column;
  min-width: 260px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
/* `display: flex` above beats the UA stylesheet's `[hidden] { display: none }`,
   so closing the dropdown (which only sets the `hidden` property) left the
   panel on screen swallowing clicks. This rule is what actually hides it. */
.phone-input-dropdown[hidden] { display: none; }

.phone-input-search-wrap {
  flex-shrink: 0;
  padding: 8px;
  border-bottom: 1px solid var(--border-soft);
}
.phone-input-search {
  width: 100%;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev-3);
  color: var(--fg);
}
.phone-input-search:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.1);
}
.phone-input-list {
  overflow-y: auto;
  padding: 6px;
}
.phone-input-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--fg);
}
.phone-input-option:hover,
.phone-input-option:focus-visible {
  background: var(--bg-elev-3);
  outline: none;
}
.phone-input-option[aria-selected="true"] { background: rgba(217, 179, 108, 0.12); }
.phone-input-option .phone-input-flag { font-size: 15px; }
.phone-input-option .phone-input-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.phone-input-option .phone-input-dial {
  flex-shrink: 0;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.phone-input-empty {
  padding: 14px 10px;
  text-align: center;
  color: var(--fg-muted);
  font-size: 12.5px;
}

/* Touch targets on phone/tablet, matching the .form-input breakpoints */
@media (max-width: 768px) {
  .phone-input-wrap { min-height: 42px; }
}
