/* Login + sign-up modals (#loginModal, #registerModal) — 2026-12-03.
   Shared look and motion. Phones (< 576px) get a bottom sheet; larger screens a centred card.
   Mirror of resources/…/assets/css/auth-modals.css → public/themes/…/assets/css/auth-modals.css. */

.am-modal {
  --am-brand: var(--bs-primary, #4A2E1C);
  --am-brand-rgb: var(--bs-primary-rgb, 74, 46, 28);
  --am-gold: #B78845;
  --am-ink: #1D1712;
  --am-ink-2: #5E5248;
  --am-ink-3: #958878;
  --am-line: #E7DED2;
  --am-soft: #F6F0E8;
  --am-ok: #2F7A4E;
  --am-err: #C2362B;
  --am-spring: cubic-bezier(.34, 1.42, .64, 1);
  --am-ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- card ---------- */
.am-modal .modal-dialog { max-width: 460px; }
.am-modal .modal-content {
  position: relative; overflow: hidden; border: 0; border-radius: 24px;
  box-shadow: 0 24px 60px rgba(29, 23, 18, .22), 0 2px 6px rgba(29, 23, 18, .08);
}
/* warm wash behind the header */
.am-modal .modal-content::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 150px; pointer-events: none;
  background:
    radial-gradient(120% 90% at 85% -10%, rgba(183, 136, 69, .20), transparent 60%),
    radial-gradient(90% 80% at 0% 0%, rgba(var(--am-brand-rgb), .10), transparent 65%);
}
/* close button pinned to the inline-end corner (it was landing on top of the brand mark) */
.am-modal .modal-header { position: static; padding: 0; min-height: 22px; border: 0; }
.am-modal .modal-header .btn-close {
  position: absolute; top: 14px; inset-inline-end: 14px; inset-inline-start: auto; z-index: 5;
  width: 36px; height: 36px; padding: 0; margin: 0; border-radius: 50%; opacity: .7;
  background-color: rgba(255, 255, 255, .7); background-size: 12px; transition: transform .25s var(--am-spring), opacity .2s, background-color .2s;
}
.am-modal .modal-header .btn-close:hover { opacity: 1; background-color: #fff; transform: rotate(90deg); }
.am-modal .modal-body { position: relative; z-index: 1; padding: 0 28px 24px; }

.am-head { text-align: center; margin: -8px 0 18px; }
.am-mark {
  display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 12px; border-radius: 20px;
  background: #fff; box-shadow: 0 8px 22px rgba(var(--am-brand-rgb), .16), 0 0 0 1px rgba(var(--am-brand-rgb), .06);
}
.am-mark img { width: 52px; height: 52px; object-fit: contain; }
.am-title { font-size: 1.45rem; font-weight: 800; color: var(--am-ink); margin: 0 0 6px; line-height: 1.35; }
.am-sub { font-size: .92rem; color: var(--am-ink-2); margin: 0; line-height: 1.6; }

/* benefits (sign-up) */
.am-perks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; }
.am-perks li {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 9px; border-radius: 14px;
  background: var(--am-soft); color: var(--am-ink-2); font-size: .72rem; font-weight: 700; line-height: 1.3; text-align: center;
}
.am-perks i {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; font-size: 15px;
  background: #fff; color: var(--am-brand); box-shadow: 0 2px 6px rgba(var(--am-brand-rgb), .12);
}

/* ---------- fields ---------- */
.am-modal label, .am-field > label { font-weight: 700; font-size: .875rem; color: var(--am-ink); margin-bottom: .4rem; display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.am-modal .lp-req, .am-req { color: var(--am-err); }
.am-opt { font-weight: 500; font-size: .78rem; color: var(--am-ink-3); }
.am-hint { font-weight: 500; font-size: .76rem; color: var(--am-ink-3); }
.am-modal .form-control {
  min-height: 50px; border-radius: 14px; border: 1.5px solid var(--am-line); background: #fff; font-size: 1rem;
  transition: border-color .2s, box-shadow .25s var(--am-ease), background-color .2s;
}
.am-modal .form-control::placeholder { color: #B5A999; }
.am-modal .form-control:hover { border-color: #D8CBBA; }
.am-modal .form-control:focus { border-color: var(--am-brand); box-shadow: 0 0 0 4px rgba(var(--am-brand-rgb), .12); }
.am-field { margin-bottom: 14px; }
.am-field.is-bad .form-control { border-color: var(--am-err); box-shadow: 0 0 0 4px rgba(194, 54, 43, .10); }
.am-err { display: block; min-height: 0; max-height: 0; overflow: hidden; color: var(--am-err); font-size: .8rem; font-weight: 600; transition: max-height .25s var(--am-ease), margin .25s; }
.am-field.is-bad .am-err { max-height: 3em; margin-top: 6px; }
.am-field.is-bad { animation: am-nudge .38s var(--am-ease); }

/* LTR phone / email boxes inside an RTL page (same approach as the login identity box) */
.am-ltr { direction: ltr; }
.am-modal input[dir="ltr"], .am-modal input[dir="ltr"]::placeholder { text-align: left; direction: ltr; }
.am-ltr .iti { width: 100%; direction: ltr; }
.am-ltr .iti--allow-dropdown .iti__flag-container, .am-ltr .iti--separate-dial-code .iti__flag-container { left: 0; right: auto; }
.am-modal .am-ltr .iti--allow-dropdown input.iti__tel-input[type=tel] { padding-right: 12px; margin-left: 0; }
.am-modal .am-ltr .iti .iti__selected-flag { padding: 0 8px 0 14px; border-radius: 14px 0 0 14px; }
.am-modal .am-ltr .iti .iti__selected-flag .iti__arrow { margin-left: 6px; margin-right: 0; }
.am-modal .am-ltr .iti .iti__selected-flag .iti__selected-dial-code { direction: ltr; unicode-bidi: isolate; margin-left: 8px; margin-right: 0; font-weight: 600; }
[dir="rtl"] .am-modal .am-ltr .iti__country-list { direction: rtl; text-align: right; }
[dir="rtl"] .am-modal .am-ltr .iti__country-name, [dir="rtl"] .am-modal .am-ltr .iti__flag-box { margin-left: 6px; margin-right: 0; }
[dir="rtl"] .am-modal .am-ltr .iti__dial-code { direction: ltr; unicode-bidi: isolate; }
.am-modal .lp-identity .lp-ltr .iti .iti__selected-flag { border-radius: 14px 0 0 14px; }

/* password strength (hint only, never blocks) */
.am-meter[data-level="0"] { opacity: 0; }
.am-meter { transition: opacity .25s; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 8px; }
.am-meter i { height: 4px; border-radius: 4px; background: var(--am-line); transform-origin: left center; transition: background-color .3s; }
[dir="rtl"] .am-meter i { transform-origin: right center; }
.am-meter[data-level="1"] i:nth-child(1) { background: #E0A23A; animation: am-grow .35s var(--am-spring); }
.am-meter[data-level="2"] i:nth-child(-n+2) { background: #C9A227; }
.am-meter[data-level="2"] i:nth-child(2) { animation: am-grow .35s var(--am-spring); }
.am-meter[data-level="3"] i { background: var(--am-ok); }
.am-meter[data-level="3"] i:nth-child(3) { animation: am-grow .35s var(--am-spring); }

/* "add email (optional)" / "referral code" reveal */
.am-more {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 2px; border: 0; background: none;
  color: var(--am-brand); font-weight: 700; font-size: .86rem;
}
.am-more i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: rgba(var(--am-brand-rgb), .09); font-size: 12px; transition: transform .3s var(--am-spring); }
.am-more:hover i { transform: rotate(90deg); }
.am-reveal { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .35s var(--am-ease), opacity .25s; }
.am-reveal > div { min-height: 0; overflow: hidden; }
.am-reveal.is-open { grid-template-rows: 1fr; opacity: 1; }
.am-reveal.is-open > div { overflow: visible; }

/* sign-up: tabs glider for the email mode (login has its own rule in _email) */
.am-reg[data-method="email"] .lp-tabs__glider { inset-inline-start: 50%; }
.am-reg .lp-tabs { margin-bottom: 16px; }
.am-reg .am-fields { display: flex; flex-direction: column; }
.am-reg .am-f-name { order: 1; }
.am-reg .am-f-email { order: 5; }
.am-reg .am-f-phone { order: 3; }
.am-reg .am-f-pass { order: 4; }
.am-reg .am-f-ref { order: 6; }
.am-reg[data-method="email"] .am-f-email { order: 2; }
.am-reg[data-method="email"] .am-email-toggle { display: none; }
.am-reg:not([data-method="email"]) .am-phone-hint { display: none; }
.am-reg[data-method="email"] .am-email-opt { display: none; }
.am-reg:not([data-method="email"]) .am-email-req { display: none; }

.am-terms { font-size: .8rem; color: var(--am-ink-3); text-align: center; margin: 4px 0 14px; line-height: 1.7; }
.am-terms a { color: var(--am-brand); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- buttons ---------- */
.am-modal .am-btn, .am-modal button[type="submit"].btn-primary {
  position: relative; min-height: 52px; border-radius: 16px; font-size: 1.02rem; font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 10px 22px rgba(var(--am-brand-rgb), .26); transition: transform .18s var(--am-ease), box-shadow .25s, filter .2s;
}
.am-modal .am-btn:hover, .am-modal button[type="submit"].btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 26px rgba(var(--am-brand-rgb), .30); }
.am-modal .am-btn:active, .am-modal button[type="submit"].btn-primary:active { transform: scale(.975); box-shadow: 0 6px 14px rgba(var(--am-brand-rgb), .24); }
.am-modal .is-loading { color: transparent !important; pointer-events: none; }
.am-modal .is-loading::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: am-spin .7s linear infinite;
}
.am-modal .auth-signup-btn { min-height: 50px; border-radius: 16px; border-width: 1.5px; transition: transform .18s var(--am-ease), background-color .2s, color .2s; }
.am-modal .auth-signup-btn:active { transform: scale(.975); }
.am-switch { text-align: center; margin: 14px 0 0; font-size: .9rem; color: var(--am-ink-2); }
.am-switch button { border: 0; background: none; padding: 0 2px; color: var(--am-brand); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }

/* login tabs, slightly roomier inside the modal */
.am-modal .lp-tabs { border-radius: 16px; }
.am-modal .lp-tab { min-height: 46px; border-radius: 12px; }
.am-modal .lp-tabs__glider { border-radius: 12px; }

/* ---------- success (sign-up) ---------- */
.am-done { display: none; text-align: center; padding: 18px 0 8px; }
.am-reg-wrap.is-done .am-done { display: block; }
.am-reg-wrap.is-done .am-form-area { display: none; }
.am-check { width: 92px; height: 92px; margin: 0 auto 16px; display: block; }
.am-check circle { fill: var(--am-ok); transform-origin: center; animation: am-pop-in .55s var(--am-spring) both; }
.am-check path { fill: none; stroke: #fff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: am-draw .45s .3s var(--am-ease) forwards; }
.am-check .am-ring { fill: none; stroke: var(--am-ok); stroke-width: 2; opacity: 0; animation: am-ring .9s .15s ease-out; }
.am-done h3 { font-size: 1.35rem; font-weight: 800; color: var(--am-ink); margin: 0 0 6px; }
.am-done p { color: var(--am-ink-2); margin: 0; }

/* ---------- motion ---------- */
.am-modal.fade .modal-dialog { transform: none; transition: none; }
.am-modal.show .modal-dialog { animation: am-in .5s var(--am-spring); }
/* stagger the blocks in the body; the animation only affects these wrappers, never hover states */
.am-modal.show .am-s > * { animation: am-rise .5s var(--am-ease) backwards; }
.am-modal.show .am-s > :nth-child(1) { animation-delay: .06s; }
.am-modal.show .am-s > :nth-child(2) { animation-delay: .11s; }
.am-modal.show .am-s > :nth-child(3) { animation-delay: .16s; }
.am-modal.show .am-s > :nth-child(4) { animation-delay: .21s; }
.am-modal.show .am-s > :nth-child(5) { animation-delay: .26s; }
.am-modal.show .am-s > :nth-child(6) { animation-delay: .31s; }
.am-modal.show .am-s > :nth-child(n+7) { animation-delay: .36s; }
.am-modal.show .am-perks li { animation: am-pop-in .5s var(--am-spring) backwards; }
.am-modal.show .am-perks li:nth-child(1) { animation-delay: .18s; }
.am-modal.show .am-perks li:nth-child(2) { animation-delay: .24s; }
.am-modal.show .am-perks li:nth-child(3) { animation-delay: .30s; }
.am-modal.show .am-perks li:nth-child(4) { animation-delay: .36s; }
.am-modal.show .am-mark { animation: am-pop-in .6s .05s var(--am-spring) backwards; }
.am-modal .lp-pane:not([hidden]) { animation: am-rise .3s var(--am-ease); }
.am-modal.am-shake .modal-content { animation: am-shake .42s var(--am-ease); }

@keyframes am-in { from { opacity: 0; transform: translateY(22px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes am-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes am-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes am-pop-in { 0% { opacity: 0; transform: scale(.6); } 100% { opacity: 1; transform: none; } }
@keyframes am-grow { from { transform: scaleX(0); } to { transform: none; } }
@keyframes am-spin { to { transform: rotate(360deg); } }
@keyframes am-draw { to { stroke-dashoffset: 0; } }
@keyframes am-ring { 0% { opacity: .6; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.35); } }
@keyframes am-shake { 0%, 100% { transform: none; } 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }
@keyframes am-nudge { 0%, 100% { transform: none; } 30% { transform: translateX(-5px); } 65% { transform: translateX(4px); } }
.am-check circle, .am-check .am-ring { transform-box: fill-box; }

/* ---------- phones: bottom sheet ---------- */
@media (max-width: 575.98px) {
  .am-modal .modal-dialog, .am-modal .modal-dialog-centered {
    max-width: none; margin: 0; min-height: 100%; display: flex; align-items: flex-end;
  }
  .am-modal .modal-content { border-radius: 26px 26px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .am-modal .modal-content::after {
    content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px;
    border-radius: 3px; background: rgba(29, 23, 18, .14); z-index: 3;
  }
  .am-modal.show .modal-dialog { animation: am-up .5s cubic-bezier(.32, 1.18, .5, 1); }
  .am-modal .modal-body { padding: 0 20px 18px; }
  .am-title { font-size: 1.3rem; }
  .am-mark { width: 56px; height: 56px; border-radius: 18px; }
  .am-mark img { width: 44px; height: 44px; }
  .am-perks li { font-size: .68rem; padding: 9px 2px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .am-modal *, .am-modal.show .modal-dialog, .am-modal .modal-content { animation: none !important; transition: none !important; }
  .am-check path { stroke-dashoffset: 0; }
}
