/* ══════════════════════════════════════════════════════════════════
   v6.3 FIELD STATES — one look for every input on the site (sign-in page
   and the three dashboards). Painted by js/validate.js:
     .field-valid   → green border + check mark (the value passes every check)
     .field-invalid → red border + warning mark + a message under the field
     neither        → the normal field
   Colour is never the only signal: the icon and the message say it too.
   Loaded after every older stylesheet, so these rules win.
══════════════════════════════════════════════════════════════════ */
:root {
  --ok-border: #16a34a;
  --ok-ring: rgba(22, 163, 74, 0.16);
  --ok-text: #15803d;   /* 5.0:1 on white */
  --err-border: #dc2626;
  --err-ring: rgba(220, 38, 38, 0.15);
  --err-text: #b91c1c;  /* 6.5:1 on white */
  --field-ease: cubic-bezier(0.23, 1, 0.32, 1);
  --ic-ok: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='9' fill='%2316a34a'/%3E%3Cpath d='M6 10.4l2.6 2.6L14 7.6' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --ic-err: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='9' fill='%23dc2626'/%3E%3Cpath d='M10 5.6v5.2' stroke='%23fff' stroke-width='2' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='14.1' r='1.2' fill='%23fff'/%3E%3C/svg%3E");
}

/* Every text-like field eases between states (colour only — nothing moves). */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select,
textarea {
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

/* ── states ── */
.field-valid:not([type="checkbox"]):not([type="radio"]),
.form-input.field-valid,
.form-select.field-valid,
.form-textarea.field-valid {
  border-color: var(--ok-border) !important;
  box-shadow: 0 0 0 3px var(--ok-ring) !important;
}
.field-invalid:not([type="checkbox"]):not([type="radio"]),
.form-input.field-invalid,
.form-select.field-invalid,
.form-textarea.field-invalid {
  border-color: var(--err-border) !important;
  box-shadow: 0 0 0 3px var(--err-ring) !important;
}
input[type="checkbox"].field-invalid,
input[type="radio"].field-invalid {
  outline: 2px solid var(--err-border);
  outline-offset: 2px;
}

/* Status mark inside single-line text fields (not selects: they draw a chevron there). */
input.field-valid:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(.otp-box):not([type="date"]),
input.field-invalid:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(.otp-box):not([type="date"]) {
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
  padding-right: 40px !important;
}
input.field-valid:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(.otp-box):not([type="date"]) { background-image: var(--ic-ok); }
input.field-invalid:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(.otp-box):not([type="date"]) { background-image: var(--ic-err); }
/* Password fields: no status icon inside (it collided with the show/hide eye).
   The red / green border and the message below the field still show the state. */
.pass-wrap input.field-valid,
.pass-wrap input.field-invalid,
.pw-wrap input.field-valid,
.pw-wrap input.field-invalid {
  background-image: none !important;
  padding-right: 50px !important;
}
textarea.field-valid,
textarea.field-invalid {
  background-repeat: no-repeat;
  background-position: right 12px top 12px;
  background-size: 18px 18px;
  padding-right: 40px;
}
textarea.field-valid { background-image: var(--ic-ok); }
textarea.field-invalid { background-image: var(--ic-err); }

/* +63 phone field: the frame around prefix + digits carries the state */
.phone-wrap:has(.field-valid) .phone-prefix { border-color: var(--ok-border); }
.phone-wrap:has(.field-invalid) .phone-prefix { border-color: var(--err-border); }
.card .phone-wrap:has(.field-valid),
.modal .phone-wrap:has(.field-valid) { border-color: var(--ok-border); box-shadow: 0 0 0 3px var(--ok-ring); }
.card .phone-wrap:has(.field-invalid),
.modal .phone-wrap:has(.field-invalid) { border-color: var(--err-border); box-shadow: 0 0 0 3px var(--err-ring); }
.card .phone-wrap .phone-input.field-valid,
.card .phone-wrap .phone-input.field-invalid,
.modal .phone-wrap .phone-input.field-valid,
.modal .phone-wrap .phone-input.field-invalid { box-shadow: none !important; border-color: transparent !important; }

/* ── messages under fields ── */
.field-msg,
.field-error-msg { color: var(--err-text); }
.field-msg.show { animation: nvMsgIn 180ms var(--field-ease); }
.field-msg.is-valid,
.field-error-msg.is-valid { color: var(--ok-text) !important; }
.field-msg.is-valid.show::before {
  content: "";
  background: var(--ic-ok) center / 16px 16px no-repeat;
}
.auth-view .field-error-msg.show { display: flex; gap: 6px; align-items: flex-start; }
.auth-view .field-error-msg.show::before {
  content: "";
  flex: none;
  width: 14px;
  height: 14px;
  margin-top: 1px;
  background: var(--ic-err) center / 14px 14px no-repeat;
}
.auth-view .field-error-msg.is-valid.show::before { background-image: var(--ic-ok); }
.field-msg.show::before { flex: none; }
@keyframes nvMsgIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .field-msg.show { animation: none; }
}

/* ───────────── small icons that replaced text glyphs ───────────── */
.ic-inline {
  width: 1.05em;
  height: 1.05em;
  flex: none;
  vertical-align: -0.16em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn-with-ic,
.wb-btn:has(> .ic-inline), .btn-new:has(> .ic-inline), .btn-soft:has(> .ic-inline), .ov-empty-btn:has(> .ic-inline) { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }

.modal-close .ic-x, .auth-modal-close .ic-x, .nv-viewer-btn .ic-inline, .nvb-ic .ic-x { width: 18px; height: 18px; vertical-align: middle; }
.nv-viewer-nav .ic-inline { width: 26px; height: 26px; }

/* The +63 digits field is narrow: its frame already carries the state, so no
   mark inside it (all 10 digits stay visible). The message under it still says why. */
.phone-wrap input.field-valid,
.phone-wrap input.field-invalid {
  background-image: none !important;
  padding-right: 12px !important;
}
.auth-view .phone-wrap:has(.field-valid) .phone-input { border-color: var(--ok-border) !important; }
.auth-view .phone-wrap:has(.field-invalid) .phone-input { border-color: var(--err-border) !important; }
