/* ============================================================
 * Frontend form polish (V28)
 * ------------------------------------------------------------
 * The storefront already handles mobile control sizing (16px
 * font + 48px targets in the <=820px block of storefront.css).
 * This layer fills the remaining gaps so forms feel modern and
 * stay perfect across every storefront theme:
 *   - a clear focus ring on all controls (was missing)
 *   - controls harmonise with the active theme tokens (--ui-*),
 *     so dark themes (midnight/neon) get readable inputs
 *   - comfortable desktop min-height + consistent select chevron
 *   - full-width primary buttons + single-column rows on phones
 * ========================================================== */

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group input[type="search"],
.form-group input[type="date"],
.form-group textarea,
.form-group select,
form .form-group input:not([type=checkbox]):not([type=radio]),
form .form-group select,
form .form-group textarea {
  min-height: 46px;
  border: 1px solid var(--ui-border, #d0d7e2);
  border-radius: calc(var(--ui-radius, 12px) * .6);
  background: var(--ui-surface, #fff);
  color: var(--ui-ink, #1e293b);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.form-group textarea { min-height: 110px; line-height: 1.55; }

/* Consistent, theme-aware select chevron. */
.form-group select,
form .form-group select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

/* Visible, on-brand focus ring (accessibility + modern feel). */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
form .form-group input:focus,
form .form-group select:focus,
form .form-group textarea:focus {
  outline: none;
  border-color: var(--ui-primary, #087f96);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ui-primary, #087f96) 18%, transparent);
}

/* Placeholder + label readability harmonised with the theme. */
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--ui-muted, #94a3b8); }
.form-group label { color: var(--ui-ink, #334155); }

/* Invalid state feedback after a failed submit. */
.form-group input:user-invalid,
.form-group select:user-invalid,
.form-group textarea:user-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .14);
}

/* Touch widths: keep the larger 48px target + 16px font (>=16px
   prevents iOS focus-zoom). Restated here because the rules above
   out-specify storefront.css's own <=820px control sizing. */
@media (max-width: 820px) {
  .form-group input[type="text"],
  .form-group input[type="email"],
  .form-group input[type="tel"],
  .form-group input[type="number"],
  .form-group input[type="password"],
  .form-group input[type="url"],
  .form-group input[type="search"],
  .form-group input[type="date"],
  .form-group textarea,
  .form-group select,
  form .form-group input:not([type=checkbox]):not([type=radio]),
  form .form-group select,
  form .form-group textarea {
    min-height: 48px;
    font-size: 16px;
  }
}

/* Phones: full-width primary actions + single-column rows. */
@media (max-width: 640px) {
  form .btn-block,
  form .btn-lg,
  .ajax-form .btn[type="submit"],
  .auth-form .btn[type="submit"] { width: 100%; }
  .form-row { grid-template-columns: 1fr !important; }
  .form-actions,
  .auth-form__actions { display: flex; flex-direction: column; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .form-group input,
  .form-group select,
  .form-group textarea { transition: none; }
}
