/* ── Global hidden fix ────────────────────────────────────────
   Prevents display:flex on child elements from overriding the
   browser's [hidden] attribute — fixes the button showing both
   "Sign In" text AND the spinner at the same time.
   ─────────────────────────────────────────────────────────── */
[hidden] { display: none !important; }

/* ── Inline AJAX error alert ──────────────────────────────────
   Rendered by JS inside the form when login/register fails.
   ─────────────────────────────────────────────────────────── */
@keyframes ap-shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}
.ap-auth-ajax-error {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    padding: .75rem 1rem;
    border-radius: 10px;
    background: rgba(239, 68, 68, .1);
    border: 1px solid rgba(239, 68, 68, .3);
    color: #fca5a5;
    font-size: .875rem;
    line-height: 1.5;
    margin-bottom: .25rem;
    animation: ap-shake .4s ease;
}
.ap-auth-ajax-error::before {
    content: '';
    flex-shrink: 0;
    width: 16px; height: 16px;
    margin-top: 1px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ── Auth Modal ──────────────────────────────────────────── */
.ap-auth-modal {
    position: fixed; inset: 0; z-index: 9000;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .3s ease, visibility 0s linear .3s;
}
.ap-auth-modal[aria-hidden="false"] {
    opacity: 1; visibility: visible; pointer-events: auto;
    transition: opacity .3s ease;
}
.ap-auth-modal__backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.78);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.ap-auth-modal__panel {
    position: relative; z-index: 1;
    width: 100%; max-width: 460px; max-height: 92vh;
    overflow-y: auto; overflow-x: hidden;
    background: linear-gradient(145deg, var(--ap-surface) 0%, var(--ap-bg) 100%);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 20px; padding: 2rem;
    box-shadow: 0 24px 80px rgba(0,0,0,.6), 0 0 0 1px rgba(205, 53, 255, .06);
    transform: translateY(28px) scale(.96);
    transition: transform .4s cubic-bezier(.34,1.56,.64,1);
    -webkit-overflow-scrolling: touch;
}
.ap-auth-modal[aria-hidden="false"] .ap-auth-modal__panel {
    transform: translateY(0) scale(1);
}
.ap-auth-modal__close {
    position: absolute; top: 1.125rem; right: 1.125rem;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08);
    color: rgba(255,255,255,.5); transition: background .2s, color .2s; z-index: 2;
}
.ap-auth-modal__close:hover { background: rgba(255,255,255,.14); color: #fff; }
.ap-auth-modal__brand {
    display: flex; align-items: center; gap: .625rem; margin-bottom: 1.5rem;
}
.ap-auth-modal__brand span {
    font-family: 'Space Grotesk', sans-serif; font-size: 1.0625rem;
    font-weight: 700; color: #fff;
}
.ap-auth-modal__subtitle {
    font-size: .9375rem; color: rgba(255,255,255,.45); margin-bottom: 1.25rem;
}

/* Modal Tabs */
.ap-auth-modal__tabs {
    display: flex; position: relative;
    background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
    border-radius: 10px; padding: 4px; margin-bottom: 1.5rem;
}
.ap-auth-modal__tab {
    flex: 1; padding: .625rem .75rem; border-radius: 7px;
    font-size: .875rem; font-weight: 600;
    color: rgba(255,255,255,.4); transition: color .2s; position: relative; z-index: 1;
}
.ap-auth-modal__tab--active { color: #fff; }
.ap-auth-modal__tab-indicator {
    position: absolute; top: 4px; left: 4px;
    height: calc(100% - 8px); width: calc(50% - 4px);
    background: rgba(205, 53, 255, .15); border: 1px solid rgba(205, 53, 255, .25);
    border-radius: 7px; transition: left .25s cubic-bezier(.4,0,.2,1); pointer-events: none;
}
.ap-auth-modal__tab-indicator--right { left: calc(50%); }
.ap-auth-modal__panel-content { display: none; }
.ap-auth-modal__panel-content--active { display: block; }
.ap-auth-modal__footer {
    margin-top: 1.25rem; padding-top: 1rem;
    border-top: 1px solid rgba(255,255,255,.06);
}
.ap-auth-modal__security {
    display: flex; align-items: center; gap: .375rem;
    font-size: .8125rem; color: rgba(255,255,255,.28); justify-content: center;
}

/* ── Shared Auth Form ─────────────────────────────────────── */
.ap-auth-form { display: flex; flex-direction: column; gap: 1rem; }
.ap-auth-form__field { display: flex; flex-direction: column; gap: .375rem; }
.ap-auth-form__label {
    display: flex; align-items: center; gap: .375rem;
    font-size: .8125rem; font-weight: 600;
    color: rgba(255,255,255,.5); text-transform: uppercase; letter-spacing: .05em;
}
.ap-auth-form__input,
.ap-lp-form__input {
    width: 100%;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 10px; padding: .75rem 1rem;
    color: #fff; font-size: .9375rem; font-family: inherit;
    outline: none; -webkit-appearance: none;
    transition: border-color .2s, background .2s, box-shadow .2s;
}
.ap-auth-form__input:focus,
.ap-lp-form__input:focus {
    border-color: var(--ap-secondary);
    background: rgba(205, 53, 255, .04);
    box-shadow: 0 0 0 3px rgba(205, 53, 255, .12);
}
.ap-auth-form__input::placeholder,
.ap-lp-form__input::placeholder { color: rgba(255,255,255,.18); }
.ap-auth-form__input-wrap,
.ap-lp-form__input-wrap { position: relative; }
.ap-auth-form__input-wrap .ap-auth-form__input,
.ap-lp-form__input-wrap .ap-lp-form__input { padding-right: 2.75rem; }
.ap-auth-form__eye {
    position: absolute; right: .75rem; top: 50%; transform: translateY(-50%);
    color: rgba(255,255,255,.3); transition: color .2s; display: flex;
}
.ap-auth-form__eye:hover { color: rgba(255,255,255,.65); }
.ap-auth-form__row {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
}
.ap-auth-form__row--2col { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.ap-auth-form__link {
    font-size: .875rem; font-weight: 600;
    color: var(--ap-secondary); background: none; border: none; cursor: pointer;
    text-decoration: none; transition: opacity .2s; padding: 0;
}
.ap-auth-form__link:hover { opacity: .7; }
.ap-auth-form__checkbox {
    display: flex; align-items: flex-start; gap: .5rem;
    font-size: .875rem; color: rgba(255,255,255,.5); cursor: pointer;
}
.ap-auth-form__checkbox input[type="checkbox"] {
    width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px;
    accent-color: var(--ap-secondary);
}
.ap-auth-form__terms a { color: var(--ap-secondary); text-decoration: none; }
.ap-auth-form__submit { margin-top: .25rem; gap: .5rem; }
.ap-auth-form__submit-loading { display: flex; align-items: center; gap: .5rem; }
.ap-auth-form__switch {
    text-align: center; font-size: .875rem; color: rgba(255,255,255,.38);
}
.ap-auth-form__note {
    display: flex; align-items: center; gap: .375rem;
    font-size: .8125rem; color: rgba(255,255,255,.4);
    background: rgba(255,255,255,.03); border-radius: 8px;
    padding: .625rem .875rem; border: 1px solid rgba(255,255,255,.07);
}
.ap-auth-form__disabled-msg {
    display: flex; flex-direction: column; align-items: center; gap: 1rem;
    padding: 2rem; text-align: center; color: rgba(255,255,255,.45);
}

/* Password strength meter */
.ap-password-strength { margin-top: .375rem; }
.ap-password-strength__bar {
    height: 4px; background: rgba(255,255,255,.08);
    border-radius: 2px; overflow: hidden; margin-bottom: .25rem;
}
.ap-password-strength__fill {
    display: block; height: 100%; width: 0; border-radius: 2px;
    transition: width .3s ease, background .3s ease;
}
.ap-strength-weak   .ap-password-strength__fill { width: 25%; background: #ef4444; }
.ap-strength-fair   .ap-password-strength__fill { width: 50%; background: #f59e0b; }
.ap-strength-good   .ap-password-strength__fill { width: 75%; background: #22c55e; }
.ap-strength-strong .ap-password-strength__fill { width: 100%; background: var(--ap-secondary); }
.ap-password-strength__label { font-size: .75rem; color: rgba(255,255,255,.38); }

/* Spinner */
@keyframes ap-spin { to { transform: rotate(360deg); } }
.ap-spinner { animation: ap-spin .8s linear infinite; }

/* ── Full-page Login (/my-account/ guests) ───────────────── */
.ap-login-page {
    min-height: 100vh; display: flex; align-items: stretch;
    background: var(--ap-bg); position: relative; overflow: hidden;
}
.ap-login-page__bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.ap-login-page__orb {
    position: absolute; border-radius: 50%; filter: blur(80px); opacity: .35;
}
.ap-login-page__orb--1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, var(--ap-secondary), transparent 70%);
    top: -100px; left: -100px;
}
.ap-login-page__orb--2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, var(--ap-secondary), transparent 70%);
    bottom: -80px; right: -80px;
}
.ap-login-page__wrapper {
    position: relative; z-index: 1;
    display: grid; grid-template-columns: 1fr 1fr;
    min-height: 100vh; width: 100%;
}
.ap-login-page__hero {
    background: linear-gradient(135deg, rgba(205,53,255,.07), rgba(255,0,133,.04));
    border-right: 1px solid rgba(255,255,255,.06);
    display: flex; align-items: center; justify-content: center; padding: 3rem;
}
.ap-login-page__hero-inner { max-width: 440px; }
.ap-login-page__back {
    display: inline-flex; align-items: center; gap: .375rem;
    font-size: .875rem; font-weight: 600; color: rgba(255,255,255,.4);
    text-decoration: none; margin-bottom: 3rem; transition: color .2s;
}
.ap-login-page__back:hover { color: #fff; }
.ap-login-page__hero-brand { margin-bottom: 2rem; }
.ap-login-page__hero-logo { margin-bottom: 1rem; display: flex; }
.ap-login-page__hero-title {
    font-family: 'Space Grotesk', sans-serif; font-size: 2rem;
    font-weight: 800; color: #fff; margin-bottom: .5rem; letter-spacing: -.02em;
}
.ap-login-page__hero-subtitle { font-size: 1rem; color: rgba(255,255,255,.4); line-height: 1.6; }
.ap-login-page__hero-perks { display: flex; flex-direction: column; gap: .875rem; margin-bottom: 2rem; }
.ap-login-page__hero-perk {
    display: flex; align-items: center; gap: .75rem;
    font-size: .9375rem; color: rgba(255,255,255,.6);
}
.ap-login-page__perk-icon { font-size: 1.125rem; flex-shrink: 0; }
.ap-login-page__hero-trust {
    display: flex; align-items: center; gap: .375rem;
    font-size: .875rem; color: rgba(255,255,255,.3);
    padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,.06);
}
.ap-login-page__hero-trust strong { color: var(--ap-secondary); font-weight: 700; }
.ap-login-page__forms {
    display: flex; align-items: center; justify-content: center;
    padding: 3rem 2rem; background: var(--ap-surface);
}
.ap-login-page__forms-inner { width: 100%; max-width: 420px; }

/* Page tabs */
.ap-login-page__tabs {
    display: flex; position: relative;
    background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07);
    border-radius: 12px; padding: 4px; margin-bottom: 2rem;
}
.ap-login-page__tab {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: .375rem;
    padding: .75rem .875rem; border-radius: 9px;
    font-size: .875rem; font-weight: 600; color: rgba(255,255,255,.38);
    transition: color .2s; position: relative; z-index: 1;
}
.ap-login-page__tab--active { color: #fff; }
.ap-login-page__tab-indicator {
    position: absolute; top: 4px; left: 4px;
    height: calc(100% - 8px); width: calc(50% - 4px);
    background: rgba(205, 53, 255, .12); border: 1px solid rgba(205, 53, 255, .2);
    border-radius: 9px; transition: left .25s cubic-bezier(.4,0,.2,1); pointer-events: none;
}
.ap-login-page__tab-indicator--right { left: calc(50%); }
.ap-login-page__panel { display: none; }
.ap-login-page__panel--active { display: block; }
.ap-login-page__panel-header { margin-bottom: 1.5rem; }
.ap-login-page__panel-header h2 {
    font-size: 1.625rem; font-weight: 800; color: #fff;
    margin-bottom: .375rem; letter-spacing: -.02em;
}
.ap-login-page__panel-header p { font-size: .9375rem; color: rgba(255,255,255,.4); }
.ap-lp-form { display: flex; flex-direction: column; gap: 1rem; }
.ap-lp-form__field { display: flex; flex-direction: column; gap: .375rem; }
.ap-lp-form__label {
    font-size: .8125rem; font-weight: 600; color: rgba(255,255,255,.45);
    text-transform: uppercase; letter-spacing: .05em;
}
.ap-lp-form__label-row { display: flex; align-items: center; justify-content: space-between; }
.ap-lp-form__forgot { font-size: .8125rem; font-weight: 600; color: var(--ap-secondary); text-decoration: none; transition: opacity .2s; }
.ap-lp-form__forgot:hover { opacity: .7; }
.ap-lp-form__row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.ap-lp-form__submit { margin-top: .5rem; gap: .5rem; }
.ap-lp-form__switch { text-align: center; font-size: .875rem; color: rgba(255,255,255,.38); }
.ap-lp-form__auto-pw {
    display: flex; align-items: center; gap: .375rem;
    font-size: .8125rem; color: rgba(255,255,255,.38);
    background: rgba(255,255,255,.03); padding: .625rem .875rem;
    border-radius: 8px; border: 1px solid rgba(255,255,255,.06);
}
.ap-login-page__ssl {
    display: flex; align-items: center; justify-content: center; gap: .375rem;
    font-size: .8125rem; color: rgba(255,255,255,.22); margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 900px) {
    .ap-login-page__wrapper { grid-template-columns: 1fr; }
    .ap-login-page__hero { display: none; }
    .ap-login-page__forms { min-height: 100vh; padding: 2rem 1.25rem; }
}
@media (max-width: 480px) {
    .ap-auth-modal__panel { padding: 1.5rem 1.25rem; border-radius: 16px; }
    .ap-auth-form__row--2col,
    .ap-lp-form__row-2col { grid-template-columns: 1fr; }
}
