/* 登录 / 注册 / 找回密码共用：全屏背景 + 玻璃卡片 + 左下角署名 + 半透明动效 */

@keyframes auth-bg-aurora {
    0% {
        opacity: 0.55;
        transform: rotate(-8deg) scale(1);
    }
    50% {
        opacity: 0.92;
        transform: rotate(4deg) scale(1.08);
    }
    100% {
        opacity: 0.62;
        transform: rotate(10deg) scale(1.02);
    }
}

@keyframes auth-overlay-breathe {
    0%,
    100% {
        opacity: 1;
    }
    50% {
        opacity: 0.82;
    }
}

@keyframes auth-drift-soft {
    0% {
        transform: translate3d(-2%, -1%, 0);
    }
    100% {
        transform: translate3d(2%, 2%, 0);
    }
}

@keyframes auth-card-in {
    from {
        opacity: 0;
        transform: translateY(22px) scale(0.97);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes auth-glass-shimmer {
    0% {
        background-position: 0% 50%;
        opacity: 0.35;
    }
    50% {
        opacity: 0.55;
    }
    100% {
        background-position: 100% 50%;
        opacity: 0.38;
    }
}

@keyframes auth-glass-glow {
    0%,
    100% {
        box-shadow:
            0 28px 70px rgba(0, 0, 0, 0.32),
            0 0 0 1px rgba(255, 255, 255, 0.35) inset,
            0 0 40px rgba(59, 130, 246, 0.12);
    }
    50% {
        box-shadow:
            0 32px 80px rgba(0, 0, 0, 0.28),
            0 0 0 1px rgba(255, 255, 255, 0.45) inset,
            0 0 48px rgba(251, 146, 60, 0.14);
    }
}

@keyframes auth-badge-enter {
    from {
        opacity: 0;
        transform: translateX(-14px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes auth-badge-float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

.auth-page {
    min-height: 100vh;
    margin: 0;
    position: relative;
}

/* 半透明浮动光斑（画布外缘，不挡阅读） */
.auth-page::before,
.auth-page::after {
    content: "";
    position: fixed;
    z-index: 0;
    pointer-events: none;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.45;
    mix-blend-mode: screen;
    animation: auth-drift-soft 22s ease-in-out infinite alternate;
}

.auth-page::before {
    width: min(72vw, 520px);
    height: min(72vw, 520px);
    left: max(-8%, calc(50% - 380px));
    top: max(-14%, env(safe-area-inset-top, 0));
    background: radial-gradient(circle, rgba(59, 130, 246, 0.45) 0%, transparent 68%);
}

.auth-page::after {
    width: min(60vw, 420px);
    height: min(60vw, 420px);
    right: max(-6%, calc(40% - 200px));
    bottom: max(-18%, calc(35% - 180px));
    background: radial-gradient(circle, rgba(251, 191, 36, 0.38) 0%, transparent 70%);
    animation-duration: 28s;
    animation-delay: -4s;
}

.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-color: #0b1220;
    background-image: url("../assets/auth-hero-apache-bg.png");
    background-size: cover;
    background-position: center 35%;
    background-repeat: no-repeat;
    overflow: hidden;
}

/* 动态极光叠层（半透明） */
.auth-bg::before {
    content: "";
    position: absolute;
    inset: -25%;
    background:
        radial-gradient(ellipse 100% 60% at 20% 10%, rgba(251, 191, 36, 0.18) 0%, transparent 50%),
        radial-gradient(ellipse 70% 50% at 85% 75%, rgba(96, 165, 250, 0.2) 0%, transparent 55%),
        radial-gradient(ellipse 50% 40% at 50% 100%, rgba(255, 255, 255, 0.08) 0%, transparent 48%);
    mix-blend-mode: soft-light;
    animation: auth-bg-aurora 18s ease-in-out infinite alternate;
    pointer-events: none;
}

.auth-bg::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        145deg,
        rgba(15, 23, 42, 0.76) 0%,
        rgba(15, 23, 42, 0.22) 42%,
        rgba(15, 23, 42, 0.82) 100%
    );
    pointer-events: none;
    animation: auth-overlay-breathe 14s ease-in-out infinite;
}

.auth-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(16px, 4vw, 48px);
    box-sizing: border-box;
}

.auth-glass {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background:
        linear-gradient(
            125deg,
            rgba(255, 255, 255, 0.52) 0%,
            rgba(255, 255, 255, 0.38) 45%,
            rgba(248, 250, 252, 0.45) 100%
        );
    backdrop-filter: blur(22px) saturate(165%);
    -webkit-backdrop-filter: blur(22px) saturate(165%);
    border: 1px solid rgba(255, 255, 255, 0.42);
    animation:
        auth-card-in 0.72s cubic-bezier(0.22, 1, 0.36, 1) both,
        auth-glass-glow 6s ease-in-out infinite 0.85s;
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.55),
        inset 0 -1px 0 rgba(255, 255, 255, 0.12);
    transition:
        transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
        border-color 0.35s ease,
        box-shadow 0.35s ease;
}

/* 斜向流光高光（半透明） */
.auth-glass::before {
    content: "";
    position: absolute;
    inset: -40% -70%;
    z-index: 0;
    background: linear-gradient(
        105deg,
        transparent 0%,
        rgba(255, 255, 255, 0.06) 38%,
        rgba(255, 255, 255, 0.22) 50%,
        rgba(255, 255, 255, 0.06) 62%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: auth-glass-shimmer 9s linear infinite;
    opacity: 0.4;
    pointer-events: none;
}

/* 半透明渐变描边 + 内辉光（不依赖 mask，兼容更好） */
.auth-glass::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
    box-sizing: border-box;
    pointer-events: none;
    padding: 1px;
    background: linear-gradient(
        135deg,
        rgba(96, 165, 250, 0.35) 0%,
        rgba(255, 255, 255, 0.12) 45%,
        rgba(251, 191, 36, 0.28) 100%
    );
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.65;
    animation: auth-bg-aurora 22s ease-in-out infinite alternate-reverse;
}

.auth-glass > * {
    position: relative;
    z-index: 2;
}

@media (hover: hover) {
    .auth-glass:hover {
        transform: translateY(-2px);
        border-color: rgba(255, 255, 255, 0.55);
        box-shadow:
            0 36px 86px rgba(0, 0, 0, 0.34),
            inset 0 1px 0 rgba(255, 255, 255, 0.65),
            0 0 36px rgba(59, 130, 246, 0.1);
    }
}

.auth-photo-credits {
    position: fixed;
    left: max(14px, env(safe-area-inset-left));
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    pointer-events: none;
}

.auth-photo-badge {
    display: inline-block;
    max-width: min(260px, 88vw);
    padding: 7px 16px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.96);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.32);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    animation:
        auth-badge-enter 0.75s cubic-bezier(0.22, 1, 0.36, 1) both,
        auth-badge-float 5s ease-in-out infinite;
}

.auth-photo-credits .auth-photo-badge:nth-child(1) {
    animation-delay: 0.32s, 1.12s;
}

.auth-photo-credits .auth-photo-badge:nth-child(2) {
    animation-delay: 0.5s, 1.28s;
}

.auth-photo-badge.auth-photo-title-dark {
    display: none;
}

html.theme-dark .auth-photo-credits .auth-photo-badge:nth-child(3),
body.theme-dark .auth-photo-credits .auth-photo-badge:nth-child(3) {
    animation-delay: 0.5s, 1.28s;
}

/* ---------- 深色模式（登录 / 注册 / 找回密码） ---------- */
html.theme-dark .auth-glass,
body.theme-dark .auth-glass {
    background:
        linear-gradient(
            125deg,
            rgba(30, 41, 59, 0.88) 0%,
            rgba(15, 23, 42, 0.82) 45%,
            rgba(15, 23, 42, 0.9) 100%
        ) !important;
    border-color: rgba(148, 163, 184, 0.22) !important;
    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(148, 163, 184, 0.12) inset,
        0 0 40px rgba(59, 130, 246, 0.08) !important;
    color: var(--text-primary);
}

html.theme-dark .auth-glass h1,
html.theme-dark .auth-glass h2,
html.theme-dark .auth-glass label,
html.theme-dark .auth-glass p,
body.theme-dark .auth-glass h1,
body.theme-dark .auth-glass h2,
body.theme-dark .auth-glass label,
body.theme-dark .auth-glass p {
    color: var(--text-primary);
}

html.theme-dark .auth-glass .form-hint,
html.theme-dark .auth-glass .auth-footer,
body.theme-dark .auth-glass .form-hint,
body.theme-dark .auth-glass .auth-footer {
    color: var(--text-secondary) !important;
}

html.theme-dark .auth-glass input,
html.theme-dark .auth-glass select,
html.theme-dark .auth-glass textarea,
body.theme-dark .auth-glass input,
body.theme-dark .auth-glass select,
body.theme-dark .auth-glass textarea {
    background: rgba(15, 23, 42, 0.65) !important;
    border-color: rgba(148, 163, 184, 0.28) !important;
    color: var(--text-primary) !important;
}

html.theme-dark .auth-glass input::placeholder,
body.theme-dark .auth-glass input::placeholder {
    color: var(--text-light) !important;
}

html.theme-dark .auth-glass a,
body.theme-dark .auth-glass a {
    color: #93c5fd;
}

html.theme-dark .auth-bg,
body.theme-dark .auth-bg {
    background-image: url("../assets/auth-hero-night-aircraft.jpg");
    background-position: center 42%;
}

html.theme-dark .auth-bg::after,
body.theme-dark .auth-bg::after {
    background: linear-gradient(
        145deg,
        rgba(2, 6, 23, 0.88) 0%,
        rgba(15, 23, 42, 0.55) 42%,
        rgba(2, 6, 23, 0.92) 100%
    ) !important;
}

html.theme-dark .auth-photo-badge.auth-photo-title-light,
body.theme-dark .auth-photo-badge.auth-photo-title-light {
    display: none;
}

html.theme-dark .auth-photo-badge.auth-photo-title-dark,
body.theme-dark .auth-photo-badge.auth-photo-title-dark {
    display: inline-block;
}

@media (prefers-reduced-motion: reduce) {
    .auth-bg {
        background-attachment: scroll;
    }

    .auth-bg::before,
    .auth-bg::after {
        animation: none;
    }

    .auth-bg::after {
        opacity: 1;
    }

    .auth-page::before,
    .auth-page::after {
        animation: none;
    }

    .auth-glass {
        animation: none;
        opacity: 1;
        transform: none;
        filter: none;
    }

    .auth-glass:hover {
        transform: none;
    }

    .auth-glass::before,
    .auth-glass::after {
        animation: none;
        opacity: 0.25;
    }

    .auth-photo-badge {
        animation: auth-badge-enter 0.35s ease-out both;
    }

    .auth-photo-credits .auth-photo-badge:nth-child(2) {
        animation-delay: 0.12s;
    }
}
