/* Shared phone number field (templates/_phone_input.html, js/phone_input.js).
   One bordered control: country chip on the left, number on the right.
   The page variant only matches height and border to the inputs around it. */
.phone-field {
  --pf-height: 44px;
  --pf-border-width: 1.5px;
  --pf-border: var(--do-border-strong, #e0e0dc);
  --pf-radius: var(--do-radius-sm, 10px);
  --pf-pad: 14px;
  --pf-brand: var(--do-brand, #55987c);
  --pf-bad: var(--do-bad, #ef4444);
  width: 100%;
  min-width: 0;
}
.phone-field--register { --pf-height: 42px; --pf-border: var(--rg-border, #e8ede9); }
.phone-field--account { --pf-height: 40px; --pf-border-width: 1px; --pf-border: var(--do-border, #f0f0ec); --pf-pad: 12px; }

.phone-field__control {
  display: flex;
  align-items: stretch;
  height: var(--pf-height);
  box-sizing: border-box;
  background: var(--do-card, #fff);
  border: var(--pf-border-width) solid var(--pf-border);
  border-radius: var(--pf-radius);
  overflow: hidden;
  transition: border-color var(--do-transition, 150ms ease), box-shadow var(--do-transition, 150ms ease);
}
.phone-field__control:focus-within {
  border-color: var(--pf-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pf-brand) 15%, transparent);
}

/* Country chip: shows "DE +49"; the real <select> lies invisibly on top. */
.phone-field__country {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  margin: 0;
  padding: 0 10px 0 var(--pf-pad);
  background: var(--do-surface, #fafcfb);
  border-right: 1px solid var(--pf-border);
  color: var(--do-ink, #1a1a1a);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--do-transition, 150ms ease);
}
.phone-field__country:hover { background: var(--do-brand-softer, #f4f9f7); }
.phone-field__iso {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--do-muted, #8b8b8b);
}
.phone-field__dial { font-variant-numeric: tabular-nums; }
.phone-field__chevron { width: 14px; height: 14px; color: var(--do-muted, #8b8b8b); flex: 0 0 auto; }
.phone-field__select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 16px; /* no zoom on iOS */
  appearance: none;
  -webkit-appearance: none;
}
.phone-field__country:focus-within { background: var(--do-brand-soft, #eaf4f0); }

.phone-field__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 var(--pf-pad);
  border: 0;
  outline: none;
  background: transparent;
  color: var(--do-ink, #1a1a1a);
  font-family: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}
.phone-field__input::placeholder { color: var(--do-muted, #8b8b8b); opacity: 0.7; letter-spacing: 0; }

/* Quiet confirmation: a check at the end of the field, no sentence. */
.phone-field__ok {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--pf-pad) 0 0;
  color: var(--pf-brand);
}
.phone-field__ok[hidden] { display: none; }
.phone-field__ok svg { width: 18px; height: 18px; }

.phone-field--error .phone-field__control {
  border-color: var(--pf-bad);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pf-bad) 12%, transparent);
}

/* Message line: only for an error or the landline note. */
.phone-field__msg {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--do-muted, #8b8b8b);
}
.phone-field__msg[hidden] { display: none; }
.phone-field__msg::before {
  content: "";
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  margin-top: 1.5px;
  background: currentColor;
  -webkit-mask: var(--pf-icon) center / contain no-repeat;
  mask: var(--pf-icon) center / contain no-repeat;
}
.phone-field__msg--error {
  --pf-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cline x1='12' y1='8' x2='12' y2='12.5'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E");
  color: var(--pf-bad);
  font-weight: 500;
}
.phone-field__msg--note {
  --pf-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cline x1='12' y1='11.5' x2='12' y2='16'/%3E%3Cline x1='12' y1='8' x2='12.01' y2='8'/%3E%3C/svg%3E");
  color: var(--do-ink-secondary, #444);
}
/* Confirmation for screen readers only; sighted users get the check. */
.phone-field__msg--sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .phone-field__input { font-size: 16px; } /* no zoom on iOS */
}
