/*
 * Form fields, notices and form buttons, shared by the account pages and the sign-in popup
 * (on every page). Builds on the tokens in storefront.css (--zl-*).
 */

/* ───────────────────────── Forms ───────────────────────── */

.zl-form { --zl-input-h: 48px; }
.zl-field { margin-bottom: 18px; }
.zl-form > .zl-field:last-child, .modal-body > .zl-field:last-child { margin-bottom: 0; }
.zl-label { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; font-weight: 600; font-size: .88rem; color: var(--zl-ink); margin-bottom: 7px; }
.zl-label small { font-weight: 400; color: var(--zl-muted); font-size: .78rem; }
.zl-label a { font-weight: 600; font-size: .82rem; color: var(--zl-blue); }
.zl-input {
    display: block; width: 100%; height: var(--zl-input-h); padding: 0 14px;
    border: 1px solid #d5ddea; border-radius: 12px; background: #fff; color: var(--zl-ink);
    font-size: .95rem; line-height: 1.4; transition: border-color .15s, box-shadow .15s; appearance: none;
}
.zl-input::placeholder { color: #94a3b8; }
.zl-input:hover { border-color: #b8c4d6; }
.zl-input:focus { border-color: var(--zl-blue); box-shadow: 0 0 0 4px rgba(0, 96, 246, .12); outline: 0; }
.zl-input.is-invalid { border-color: #dc2626; background: #fffafa; }
.zl-input.is-invalid:focus { box-shadow: 0 0 0 4px rgba(220, 38, 38, .12); }
textarea.zl-input { height: auto; min-height: 140px; padding: 12px 14px; resize: vertical; }
select.zl-input {
    padding-right: 40px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat; background-position: right 14px center; background-size: 14px;
}
.zl-input-group { display: flex; align-items: stretch; }
.zl-input-group__prefix { display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid #d5ddea; border-right: 0; border-radius: 12px 0 0 12px; background: var(--zl-soft); color: var(--zl-muted); font-size: .9rem; font-weight: 600; }
.zl-input-group .zl-input { border-radius: 0 12px 12px 0; }
.zl-error { display: flex; align-items: flex-start; gap: .35rem; margin-top: 6px; color: #dc2626; font-size: .82rem; line-height: 1.4; }
.zl-error::before { content: '\F33A'; font-family: 'bootstrap-icons'; font-size: .8rem; line-height: 1.5; }
.zl-hint { margin-top: 6px; color: var(--zl-muted); font-size: .8rem; line-height: 1.45; }
.zl-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.zl-row--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.zl-pass { position: relative; }
.zl-pass .zl-input { padding-right: 76px; }
.zl-pass__toggle {
    position: absolute; top: 50%; right: 6px; transform: translateY(-50%);
    display: inline-flex; align-items: center; gap: .3rem; height: 36px; padding: 0 10px;
    border: 0; border-radius: 9px; background: transparent; color: var(--zl-muted); font-size: .8rem; font-weight: 600; cursor: pointer;
}
.zl-pass__toggle:hover, .zl-pass__toggle:focus-visible { background: var(--zl-soft); color: var(--zl-ink); outline: 0; }

.zl-check { display: flex; align-items: flex-start; gap: .65rem; cursor: pointer; font-size: .9rem; color: var(--zl-text); line-height: 1.45; }
.zl-check input { flex-shrink: 0; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--zl-blue); cursor: pointer; }
.zl-check a { color: var(--zl-blue); font-weight: 600; }
.zl-check.is-invalid { color: #b91c1c; }

.zl-switch { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--zl-line); cursor: pointer; }
.zl-switch:last-of-type { border-bottom: 0; }
.zl-switch strong { display: block; color: var(--zl-ink); font-size: .95rem; font-weight: 600; }
.zl-switch span { display: block; color: var(--zl-muted); font-size: .84rem; margin-top: 2px; }
.zl-switch.form-switch { padding-left: 0; min-height: 0; }
.zl-switch .form-check-input { width: 2.6em; height: 1.4em; margin: 2px 0 0 !important; float: none; flex-shrink: 0; cursor: pointer; }
.zl-switch .form-check-input:checked { background-color: var(--zl-blue); border-color: var(--zl-blue); }

.zl-radio-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.zl-radio-chips label { position: relative; cursor: pointer; }
.zl-radio-chips input { position: absolute; opacity: 0; pointer-events: none; }
.zl-radio-chips span { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1rem; border: 1px solid var(--zl-line); border-radius: 999px; background: #fff; font-size: .88rem; font-weight: 500; color: var(--zl-text); transition: border-color .15s, background-color .15s, color .15s; }
.zl-radio-chips label:hover span { border-color: var(--zl-blue); }
.zl-radio-chips input:checked + span { border-color: var(--zl-blue); background: var(--zl-soft-blue); color: var(--zl-blue); font-weight: 600; }
.zl-radio-chips input:focus-visible + span { box-shadow: 0 0 0 4px rgba(0, 96, 246, .15); }

.zl-btn--block { width: 100%; }
.zl-btn--lg { padding: 1rem 1.6rem; font-size: 1rem; }
.zl-btn--danger { background: #dc2626; color: #fff; }
.zl-btn--danger:hover { background: #b91c1c; color: #fff; }
.zl-btn--danger-ghost { background: #fff; color: #b91c1c; border-color: #f5c2c2; }
.zl-btn--danger-ghost:hover { border-color: #dc2626; color: #b91c1c; background: #fff7f7; }
.zl-btn:disabled, .zl-btn.is-busy { opacity: .65; pointer-events: none; transform: none; }

.zl-notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; font-size: .9rem; line-height: 1.5; margin-bottom: 18px; }
.zl-notice i { font-size: 1.1rem; line-height: 1.3; }
.zl-notice--success { background: #ecfdf3; color: #166534; border: 1px solid #bbf0cf; }
.zl-notice--info { background: var(--zl-soft-blue); color: #1e3a8a; border: 1px solid #d6e4ff; }
.zl-notice--warning { background: #fffaeb; color: #92400e; border: 1px solid #fde7b0; }
.zl-notice--danger { background: #fef2f2; color: #991b1b; border: 1px solid #fbd0d0; }
.zl-notice strong { display: block; color: inherit; }

/* Password strength meter */
.zl-auth__strength { display: flex; gap: 4px; margin-top: 8px; }
.zl-auth__strength span { flex: 1; height: 4px; border-radius: 4px; background: var(--zl-line); transition: background-color .2s; }
.zl-auth__strength[data-level="1"] span:nth-child(-n+1) { background: #ef4444; }
.zl-auth__strength[data-level="2"] span:nth-child(-n+2) { background: #f59e0b; }
.zl-auth__strength[data-level="3"] span:nth-child(-n+3) { background: #22c55e; }
.zl-auth__strength[data-level="4"] span { background: #15803d; }

/* Sign-up code (SMS): wide-spaced digits, then "Send a new code" / "Change number" */
.zl-input.zl-input--otp { height: 56px; text-align: center; font-size: 1.5rem; font-weight: 700; letter-spacing: .45em; padding-left: calc(14px + .45em); font-variant-numeric: tabular-nums; }
.zl-input--otp::placeholder { font-size: .95rem; font-weight: 500; letter-spacing: normal; }
.zl-otp-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; font-size: .9rem; }
.zl-otp-actions form { margin: 0; }
.zl-link-btn { padding: 0; border: 0; background: none; color: var(--zl-blue); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.zl-link-btn:hover { text-decoration: underline; }
.zl-link-btn:disabled { color: var(--zl-muted); text-decoration: none; cursor: default; }

@media (max-width: 767.98px) {
    .zl-row, .zl-row--3 { grid-template-columns: 1fr; }
}
