/* Shared SMS code UI (scripts/phone-otp.js). Pages theme it; this file keeps layout, states and motion.
   No data: images here: ERP pages' content security policy blocks them, so icons are inline SVG. */
.opal-otp-panel { margin-top: 14px; text-align: left; }
.opal-otp-panel[hidden], .opal-otp-panel [hidden], .opal-otp-flow [hidden],
.opal-auth-view[hidden], .opal-otp-switch-host[hidden] { display: none !important; }
.opal-otp-field { display: flex; flex-direction: column; gap: 7px; margin: 12px 0; font-size: 13px; font-weight: 500; }
.opal-otp-label { display: block; }
.opal-otp-control { position: relative; }
.opal-otp-input { width: 100%; box-sizing: border-box; padding: 12px; border: 1px solid rgba(148,163,184,.4); border-radius: 10px; background: rgba(127,127,127,.07); color: inherit; font: inherit; }
.opal-otp-input:focus { outline: 2px solid #7c9ada; outline-offset: 2px; }
.opal-otp-input[readonly] { opacity: .85; }
.opal-otp-input--code { font-size: 22px; font-weight: 600; letter-spacing: .45em; text-indent: .45em; text-align: center; font-variant-numeric: tabular-nums; }
.opal-otp-control--action .opal-otp-input { padding-right: 88px; }
.opal-otp-inline { position: absolute; top: 50%; right: 7px; translate: 0 -50%; min-height: 30px; padding: 4px 12px; border: 1px solid rgba(148,163,184,.4); border-radius: 8px; background: rgba(127,127,127,.1); color: inherit; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.opal-otp-inline:disabled { opacity: .55; cursor: default; }
.opal-otp-hint, .opal-otp-message, .opal-otp-unavailable { font-size: 13px; line-height: 1.55; margin: 10px 0; }
/* An empty status stays in the accessibility tree (so its first message is announced) but takes no space. */
.opal-otp-message:empty { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.opal-otp-hint { opacity: .8; }
.opal-otp-error { color: #dd6969; }
.opal-otp-verified { color: #45ac77; }
.opal-otp-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.opal-otp-button { font: inherit; font-size: 13px; min-height: 38px; padding: 8px 12px; cursor: pointer; }
.opal-otp-button:disabled { opacity: .55; cursor: default; }
.opal-otp-actions .opal-otp-button { flex: 1 1 auto; }
@media (max-width: 480px) { .opal-otp-actions .opal-otp-button { width: 100%; } }

/* Method switch (password ↔ SMS) */
.opal-otp-switch { display: inline-flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-height: 40px; padding: 8px 14px; border: 1px solid rgba(148,163,184,.4); border-radius: 10px; background: transparent; color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.opal-otp-switch__icon { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Two-view stage: phone-otp.js sets the height. It clips only while a swap grows it;
   the padding keeps focus rings visible during that moment. */
.opal-auth-stage { box-sizing: content-box; margin: -6px; padding: 6px; }
.opal-auth-stage--clip { overflow: hidden; }
.opal-auth-stage--animated { transition: height .34s cubic-bezier(.2,.8,.2,1); }

/* Entrance keyframes only define the start, with a backwards fill: once finished, each element's own
   state (disabled, hover, busy) applies again instead of being held at the final frame. */
@keyframes opal-otp-rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes opal-otp-fade { from { opacity: 0; } }
@keyframes opal-view-in { from { opacity: 0; transform: translateX(var(--opal-view-shift, 22px)); } }
@keyframes opal-view-out { to { opacity: 0; transform: translateX(calc(var(--opal-view-shift, 22px) * -1)); } }
@keyframes opal-otp-flip { from { opacity: .35; transform: translateY(3px) scale(.985); } }

/* Fields ease in whenever the flow reveals them (display: none → shown restarts the animation). */
.opal-otp-flow > :not(.opal-otp-actions):not(.opal-otp-message), .opal-otp-flow .opal-otp-actions > *, .opal-otp-inline { animation: opal-otp-rise .28s cubic-bezier(.2,.8,.2,1) backwards; }
.opal-otp-message--in { animation: opal-otp-fade .24s ease-out backwards; }
.opal-view-back { --opal-view-shift: -22px; }
.opal-view-entering { animation: opal-view-in .36s cubic-bezier(.2,.8,.2,1) backwards; }
.opal-view-leaving { animation: opal-view-out .17s cubic-bezier(.4,0,1,1) forwards; pointer-events: none; }
.opal-otp-switch--flip { animation: opal-otp-flip .32s cubic-bezier(.2,.8,.2,1); }

@media (prefers-reduced-motion: reduce) {
    .opal-otp-flow > :not(.opal-otp-actions):not(.opal-otp-message), .opal-otp-flow .opal-otp-actions > *, .opal-otp-inline,
    .opal-otp-message--in, .opal-view-entering, .opal-view-leaving, .opal-otp-switch--flip { animation: none !important; }
    .opal-auth-stage--animated { transition: none; }
}
