/* Sign-in window (components/auth/loginModal.cfm + public/assets/js/authWindow.js)
   One window that morphs between Log In, Sign Up, Reset Password, Check Your Email and Re-activate.
   Phones: bottom sheet. #login-modal.am-inline = the same panel inside a page (/signup). */

#login-modal { z-index: 100000 !important; }
#login-modal, #login-modal *, #login-modal *::before, #login-modal *::after { box-sizing: border-box; }
#login-modal:not(.hidden):not(.am-inline) { display: block !important; }
#login-modal [hidden] { display: none !important; }
#login-modal form { width: 100% !important; max-width: 100% !important; margin: 0 !important; padding: 0 !important; }
/* Inputs look the same on every page (same look as signup.css), whatever stylesheets the page loads */
#login-modal .form-control { display: block; width: 100%; max-width: 100%; margin-top: 0 !important; padding: 12px 18px !important; border-radius: 50px !important; background-color: #F8F8F8 !important; border: 1px solid #DADADA !important; font-size: 16px; line-height: 1.5; color: #111827; outline: none; box-shadow: none; }
#login-modal .form-control:focus { border-color: var(--primary-color, #D75E00) !important; box-shadow: 0 0 0 3px rgba(215, 94, 0, .15) !important; }
#login-modal .form-control::placeholder { color: #6b7280; }

#login-modal .am-backdrop { position: fixed; inset: 0; background-color: rgba(17, 24, 39, .4); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); opacity: 0; transition: opacity .2s ease; }
#login-modal.am-shown .am-backdrop { opacity: 1; }
#login-modal .am-wrap { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; min-height: 100%; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
#login-modal .am-card { position: relative; width: 100%; max-width: 440px; background: #fff; border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 20px 40px -12px rgba(17, 24, 39, .25); overflow: hidden; transform: translateY(8px) scale(.98); opacity: 0; transition: transform .2s ease, opacity .2s ease, height .22s ease; }
#login-modal.am-shown .am-card { transform: none; opacity: 1; }

#login-modal .am-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid #d1d5db; }
#login-modal .am-back, #login-modal .am-x { width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: 0; cursor: pointer; }
#login-modal .am-back { color: #6b7280; margin-left: -6px; }
#login-modal .am-x { color: #9ca3af; }
#login-modal .am-back:hover, #login-modal .am-x:hover { background: #e5e7eb; color: #111827; }
#login-modal .am-title { flex: 1; font-size: 20px; font-weight: 600; color: #111827; margin: 0; transition: opacity .15s ease; }
#login-modal .am-body { padding: 20px; }
#login-modal .am-view { transition: opacity .18s ease; }
#login-modal .am-view.am-fading { opacity: 0; }
#login-modal .am-sub { text-align: center; color: #4b5563; font-size: 15px; margin: 0 0 16px; line-height: 1.45; }
#login-modal .am-sub strong { color: #111827; font-weight: 600; }
#login-modal .am-plan { display: flex; justify-content: center; margin: -6px 0 16px; }
#login-modal .am-plan span { font-size: 12px; font-weight: 600; color: var(--primary-color, #D75E00); background: #fdf1e7; border: 1px solid #f6d3b4; border-radius: 999px; padding: 4px 12px; }

/* Google renders its own button (an iframe) into .am-gbtn; Apple's is ours, sized to match (40px) */
#login-modal .am-social { display: grid; gap: 10px; justify-items: center; }
#login-modal .am-gbtn { width: 100%; min-height: 40px; display: flex; justify-content: center; }
#login-modal .am-sbtn { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; max-width: 400px; height: 40px; border-radius: 999px; font-size: 14px; font-weight: 500; cursor: pointer; transition: background-color .15s ease; }
#login-modal .am-sbtn svg { width: 16px; height: 16px; flex: none; }
#login-modal .am-apple { background: #000; color: #fff; border: 1px solid #000; }
#login-modal .am-apple:hover { background: #1f1f1f; }
#login-modal .am-sbtn:focus-visible, #login-modal .am-link:focus-visible, #login-modal .am-main:focus-visible { outline: 2px solid var(--primary-color, #D75E00); outline-offset: 2px; }
#login-modal .am-social.am-busy { pointer-events: none; opacity: .6; }
#login-modal .am-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: #9ca3af; font-size: 13px; }
#login-modal .am-or::before, #login-modal .am-or::after { content: ""; flex: 1; border-top: 1px solid #e5e7eb; }

#login-modal .am-field { margin-bottom: 14px; }
#login-modal .am-label { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: #111827; }
#login-modal .am-pw { position: relative; }
#login-modal .am-pw input { padding-right: 48px !important; }
#login-modal .am-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; color: #6b7280; background: transparent; border: 0; cursor: pointer; }
#login-modal .am-eye:hover { color: #111827; }
#login-modal .am-err { display: none; margin-top: 6px; font-size: 13px; color: #dc2626; }
#login-modal .am-err.am-on { display: block; }
#login-modal .am-err button { color: #dc2626; font-weight: 600; text-decoration: underline; background: none; border: 0; padding: 0; cursor: pointer; font-size: inherit; }
#login-modal .am-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #374151; margin: 2px 0 16px; cursor: pointer; }
#login-modal .am-check input { width: 16px; height: 16px; }
#login-modal .am-captcha { display: flex; justify-content: center; margin: 2px 0 14px; min-height: 78px; }
#login-modal .am-captcha:empty { min-height: 0; margin: 0; }
#login-modal .am-main { width: 100%; height: 50px; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 16px; border: 0; cursor: pointer; }
#login-modal .am-main:disabled { cursor: wait; }
#login-modal .am-spin { width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .45); border-top-color: #fff; border-radius: 50%; animation: am-spin .7s linear infinite; display: none; }
#login-modal .am-busy .am-spin, #login-modal .am-main.am-busy .am-spin { display: inline-block; }
@keyframes am-spin { to { transform: rotate(360deg); } }
#login-modal .am-link { color: var(--primary-color, #D75E00); font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; font-size: inherit; }
#login-modal .am-link:hover { text-decoration: underline; }
#login-modal .am-small-link { font-size: 12px; font-weight: 500; }
#login-modal .am-foot { margin-top: 18px; text-align: center; font-size: 14px; color: #6b7280; }
#login-modal .am-legal { margin-top: 14px; text-align: center; font-size: 12px; line-height: 1.5; color: #6b7280; }
#login-modal .am-legal a { color: #4b5563; text-decoration: underline; }
#login-modal .am-captcha-note { margin-top: 10px; text-align: center; font-size: 11px; color: #9ca3af; }
#login-modal .am-captcha-note a { color: #9ca3af; text-decoration: underline; }
#login-modal .am-icon { width: 56px; height: 56px; margin: 4px auto 14px; border-radius: 999px; background: #fdf1e7; color: var(--primary-color, #D75E00); display: flex; align-items: center; justify-content: center; }
#login-modal .am-notice { margin-bottom: 14px; padding: 10px 12px; border-radius: 8px; background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; font-size: 13px; line-height: 1.45; display: none; }
#login-modal .am-notice.am-on { display: block; }
#login-modal .am-notice.am-bad { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
#login-modal .am-notice .am-main { height: 40px; font-size: 14px; margin-top: 10px; }
#login-modal .am-feat { list-style: none; margin: 0 0 16px; padding: 4px 14px; border: 1px solid #e5e7eb; border-radius: 10px; }
#login-modal .am-feat li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f3f4f6; font-size: 14px; color: #374151; }
#login-modal .am-feat li:last-child { border-bottom: 0; }
#login-modal .am-feat .am-yes { color: #16a34a; font-weight: 600; }
#login-modal .am-feat .am-no { color: #9ca3af; }
#login-modal #am-card-element { width: 100%; min-height: 44px; border: 1px solid #d1d5db; padding: 12px 14px; border-radius: 30px; margin-bottom: 8px; }

html:has(#login-modal:not(.hidden):not(.am-inline)), html:has(#login-modal:not(.hidden):not(.am-inline)) body { overflow: hidden !important; }
body:has(#login-modal:not(.hidden):not(.am-inline)) #modal-overlay, body:has(#login-modal:not(.hidden):not(.am-inline)) > [modal-backdrop] { display: none !important; }

/* Inside a page (/signup): no overlay, no close button, no slide-in */
#login-modal.am-inline { position: static; z-index: auto !important; overflow: visible; }
#login-modal.am-inline .am-backdrop, #login-modal.am-inline .am-x { display: none; }
#login-modal.am-inline .am-wrap { min-height: 0; padding: 0; }
#login-modal.am-inline .am-card { transform: none; opacity: 1; }

/* Phones: bottom sheet */
@media (max-width: 640px) {
    #login-modal:not(.am-inline) .am-wrap { align-items: flex-end; padding: 24px 0 0; }
    #login-modal:not(.am-inline) .am-card { max-width: none; border: 0; border-radius: 20px 20px 0 0; box-shadow: 0 -8px 30px rgba(17, 24, 39, .18); transform: translateY(40px); opacity: 0; padding-bottom: env(safe-area-inset-bottom); }
    #login-modal:not(.am-inline).am-shown .am-card { transform: none; opacity: 1; }
    #login-modal:not(.am-inline) .am-card::before { content: ""; display: block; width: 40px; height: 5px; border-radius: 999px; background: #d1d5db; margin: 8px auto 0; }
    #login-modal:not(.am-inline) .am-head { border-bottom-color: #e5e7eb; padding-top: 10px; }
}
@media (max-width: 480px) {
    #login-modal .am-head { padding: 14px 16px; }
    #login-modal .am-body { padding: 16px; }
    #login-modal .am-sub { margin-bottom: 12px; font-size: 14px; }
    #login-modal .am-or { margin: 14px 0; }
    #login-modal .am-field { margin-bottom: 12px; }
    #login-modal .am-legal { margin-top: 10px; }
    #login-modal .am-foot { margin-top: 12px; }
}
@media (max-width: 359px) {
    #login-modal .am-body { padding: 14px; }
    #login-modal .am-captcha > div { transform: scale(.88); transform-origin: center top; }
    #login-modal .am-captcha { min-height: 70px; }
}
@media (prefers-reduced-motion: reduce) {
    #login-modal .am-card, #login-modal .am-view, #login-modal .am-title, #login-modal .am-backdrop { transition: none !important; }
}
