/**
 * Login page — 3D spatial UI (scoped to .login-3d)
 * Matches landing page motion language.
 */
:root {
    --l3d-ink: #0a1628;
    --l3d-deep: #06101c;
    --l3d-teal: #0d7377;
    --l3d-teal-bright: #14a3a8;
    --l3d-copper: #c47245;
    --l3d-sand: #e8d5b5;
    --l3d-mist: rgba(232, 240, 248, 0.92);
    --l3d-glass: rgba(255, 255, 255, 0.08);
    --l3d-stroke: rgba(255, 255, 255, 0.14);
    --l3d-glow: rgba(20, 163, 168, 0.45);
    --l3d-font-display: "Syne", system-ui, sans-serif;
    --l3d-font-body: "Figtree", system-ui, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.login-3d {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--l3d-font-body);
    color: var(--l3d-mist);
    background: var(--l3d-deep);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.login-3d a {
    color: inherit;
    text-decoration: none;
}

.login-3d .l3d-atmosphere {
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(ellipse 80% 60% at 20% 15%, rgba(13, 115, 119, 0.4), transparent 55%),
        radial-gradient(ellipse 60% 50% at 85% 80%, rgba(196, 114, 69, 0.22), transparent 50%),
        radial-gradient(ellipse 50% 40% at 50% 50%, rgba(10, 40, 70, 0.5), transparent 70%),
        linear-gradient(165deg, #040a12 0%, #0a1628 45%, #061820 100%);
}

.login-3d .l3d-grid {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 64px 64px;
    mask-image: radial-gradient(ellipse 65% 55% at 50% 45%, #000 15%, transparent 75%);
    transform: perspective(800px) rotateX(58deg) scale(1.9) translateY(-8%);
    transform-origin: center top;
    animation: login-grid-drift 28s linear infinite;
    pointer-events: none;
}

@keyframes login-grid-drift {
    from { background-position: 0 0, 0 0; }
    to { background-position: 0 64px, 64px 0; }
}

.login-3d .l3d-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
    z-index: -1;
    opacity: 0.55;
    animation: login-orb-float 11s ease-in-out infinite;
}

.login-3d .l3d-orb--a {
    width: 360px;
    height: 360px;
    top: -5%;
    right: 10%;
    background: var(--l3d-glow);
}

.login-3d .l3d-orb--b {
    width: 300px;
    height: 300px;
    bottom: 5%;
    left: 5%;
    background: rgba(196, 114, 69, 0.35);
    animation-delay: -3.5s;
}

.login-3d .l3d-orb--c {
    width: 180px;
    height: 180px;
    top: 40%;
    left: 48%;
    background: rgba(20, 163, 168, 0.2);
    animation-delay: -6s;
    animation-duration: 15s;
}

@keyframes login-orb-float {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(18px, -24px, 0) scale(1.06); }
}

.login-3d .l3d-dust {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.login-3d .l3d-dust span {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(232, 240, 248, 0.5);
    box-shadow: 0 0 10px rgba(20, 163, 168, 0.5);
    animation: login-dust 15s linear infinite;
    opacity: 0;
}

.login-3d .l3d-dust span:nth-child(1) { left: 10%; animation-delay: 0s; }
.login-3d .l3d-dust span:nth-child(2) { left: 22%; animation-delay: -2s; animation-duration: 18s; width: 2px; height: 2px; }
.login-3d .l3d-dust span:nth-child(3) { left: 38%; animation-delay: -4s; }
.login-3d .l3d-dust span:nth-child(4) { left: 52%; animation-delay: -1s; animation-duration: 17s; }
.login-3d .l3d-dust span:nth-child(5) { left: 66%; animation-delay: -6s; width: 4px; height: 4px; }
.login-3d .l3d-dust span:nth-child(6) { left: 78%; animation-delay: -3s; }
.login-3d .l3d-dust span:nth-child(7) { left: 88%; animation-delay: -8s; animation-duration: 20s; }
.login-3d .l3d-dust span:nth-child(8) { left: 30%; animation-delay: -5s; }

@keyframes login-dust {
    0% { transform: translate3d(0, 50vh, 0); opacity: 0; }
    12% { opacity: 0.65; }
    100% { transform: translate3d(24px, -60vh, 0); opacity: 0; }
}

/* Shell */
.login-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    perspective: 1400px;
}

.login-stage {
    position: relative;
    width: min(100%, 440px);
    transform-style: preserve-3d;
}

.login-ring {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 520px;
    height: 520px;
    margin: -260px 0 0 -260px;
    border: 1px solid rgba(20, 163, 168, 0.22);
    border-radius: 50%;
    transform: rotateX(68deg) translateZ(-40px);
    animation: login-ring-spin 26s linear infinite;
    pointer-events: none;
    z-index: 0;
}

.login-ring--inner {
    width: 380px;
    height: 380px;
    margin: -190px 0 0 -190px;
    border-color: rgba(232, 213, 181, 0.18);
    animation: login-ring-spin 18s linear infinite reverse;
}

@keyframes login-ring-spin {
    to { transform: rotateX(68deg) translateZ(-40px) rotateZ(360deg); }
}

/* Floating deco chips — no backdrop-filter (hides icons in 3D) */
.login-chip {
    position: absolute;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #f2f7fb;
    border: 1px solid var(--l3d-stroke);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(12, 28, 42, 0.92));
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    pointer-events: none;
    backface-visibility: visible;
    translate: var(--parx, 0px) var(--pary, 0px);
}

.login-chip i,
.login-chip .bi {
    display: block;
    font-size: 1rem;
    line-height: 1;
    color: var(--l3d-teal-bright);
    font-style: normal;
    -webkit-font-smoothing: antialiased;
}

.login-chip--1 {
    top: -1.1rem;
    left: -1.5rem;
    animation: login-chip-f1 5s ease-in-out infinite;
}

.login-chip--2 {
    top: 14%;
    right: -2.2rem;
    animation: login-chip-f2 5.2s ease-in-out infinite;
    animation-delay: -1.4s;
    border-color: rgba(196, 114, 69, 0.35);
}

.login-chip--2 i { color: var(--l3d-copper); }

.login-chip--3 {
    bottom: 10%;
    left: -2rem;
    animation: login-chip-f3 5.4s ease-in-out infinite;
    animation-delay: -2.6s;
}

.login-chip--3 i { color: #c4b5fd; }

.login-chip--4 {
    bottom: -0.6rem;
    right: -1.2rem;
    animation: login-chip-f4 5.1s ease-in-out infinite;
    animation-delay: -0.8s;
    border-color: rgba(196, 122, 44, 0.35);
}

.login-chip--4 i { color: #c47a2c; }

@keyframes login-chip-f1 {
    0%, 100% { transform: translateZ(40px) rotate(-6deg) translateY(0); }
    50% { transform: translateZ(40px) rotate(-6deg) translateY(-12px); }
}

@keyframes login-chip-f2 {
    0%, 100% { transform: translateZ(60px) rotate(8deg) translateY(0); }
    50% { transform: translateZ(60px) rotate(8deg) translateY(-12px); }
}

@keyframes login-chip-f3 {
    0%, 100% { transform: translateZ(50px) rotate(-4deg) translateY(0); }
    50% { transform: translateZ(50px) rotate(-4deg) translateY(-10px); }
}

@keyframes login-chip-f4 {
    0%, 100% { transform: translateZ(45px) rotate(5deg) translateY(0); }
    50% { transform: translateZ(45px) rotate(5deg) translateY(-11px); }
}

/* 3D card */
.login-card-wrap {
    position: relative;
    z-index: 2;
    transform-style: preserve-3d;
    transition: transform 0.15s ease-out;
    will-change: transform;
    animation: login-card-rise 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes login-card-rise {
    from {
        opacity: 0;
        transform: translateY(40px) rotateX(14deg) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0) scale(1);
    }
}

.login-card {
    position: relative;
    padding: clamp(1.75rem, 4vw, 2.35rem);
    border-radius: 1.75rem;
    border: 1px solid var(--l3d-stroke);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.14), rgba(18, 36, 52, 0.92) 55%, rgba(8, 22, 34, 0.96));
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 0 80px rgba(13, 115, 119, 0.14);
    transform: translateZ(20px);
    overflow: hidden;
}

.login-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(125deg, rgba(255, 255, 255, 0.12) 0%, transparent 42%);
    pointer-events: none;
}

.login-card::after {
    content: "";
    position: absolute;
    width: 180px;
    height: 180px;
    right: -40px;
    top: -50px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 163, 168, 0.35), transparent 70%);
    pointer-events: none;
    animation: login-glow-drift 8s ease-in-out infinite;
}

@keyframes login-glow-drift {
    0%, 100% { transform: translate(0, 0); opacity: 0.9; }
    50% { transform: translate(-18px, 14px); opacity: 1; }
}

.login-rise {
    opacity: 0;
    transform: translateY(18px);
}

.login-3d.is-ready .login-rise {
    animation: login-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
    animation-delay: calc(var(--i, 0) * 0.1s + 0.25s);
}

@keyframes login-rise {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-brand {
    position: relative;
    z-index: 1;
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo-3d {
    position: relative;
    width: 64px;
    height: 64px;
    margin: 0 auto 0.85rem;
    border-radius: 18px;
    display: grid;
    place-items: center;
    overflow: visible;
    background: linear-gradient(145deg, #1a9ea3, #0a4a4e);
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.4),
        0 0 24px rgba(20, 163, 168, 0.35);
    transform: translateZ(36px);
    animation: login-logo-bob 5s ease-in-out infinite;
}

.login-logo-3d img {
    width: 40px !important;
    height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    object-fit: contain;
    display: block;
    position: relative;
    z-index: 1;
}

.login-logo-pulse {
    position: absolute;
    inset: -8px;
    border-radius: 22px;
    border: 1px solid rgba(20, 163, 168, 0.45);
    animation: login-logo-pulse 2.8s ease-out infinite;
    pointer-events: none;
}

@keyframes login-logo-bob {
    0%, 100% { transform: translateZ(36px) translateY(0); }
    50% { transform: translateZ(36px) translateY(-8px); }
}

@keyframes login-logo-pulse {
    0% { transform: scale(0.9); opacity: 0.65; }
    100% { transform: scale(1.4); opacity: 0; }
}

.login-brand h1 {
    font-family: "Times New Roman", Times, serif;
    font-weight: 700;
    font-size: clamp(1.55rem, 4.5vw, 1.95rem);
    letter-spacing: -0.01em;
    line-height: 1.15;
    margin: 0 0 0.45rem;
    background: linear-gradient(120deg, #fff 25%, var(--l3d-sand) 60%, var(--l3d-teal-bright) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login-brand h1 em {
    font-style: italic;
    font-weight: inherit;
    color: #f5c518;
    -webkit-text-fill-color: #f5c518;
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    filter: drop-shadow(0 0 8px rgba(245, 197, 24, 0.35));
}

.login-brand p {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(220, 230, 240, 0.65);
}

.login-alert {
    position: relative;
    z-index: 1;
    margin-bottom: 1rem;
    padding: 0.7rem 0.9rem;
    border-radius: 0.85rem;
    font-size: 0.88rem;
    border: 1px solid transparent;
}

.login-alert--danger {
    background: rgba(180, 40, 50, 0.25);
    border-color: rgba(255, 120, 130, 0.3);
    color: #ffc9ce;
}

.login-alert--success {
    background: rgba(20, 120, 80, 0.25);
    border-color: rgba(100, 220, 160, 0.3);
    color: #b8f0d0;
}

.login-form {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-field label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(232, 240, 248, 0.78);
}

.login-field input {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 0.9rem;
    border: 1px solid var(--l3d-stroke);
    background: rgba(4, 12, 22, 0.55);
    color: #fff;
    font-family: var(--l3d-font-body);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.login-field input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.login-field input:focus {
    border-color: rgba(20, 163, 168, 0.65);
    box-shadow: 0 0 0 3px rgba(20, 163, 168, 0.2);
    transform: translateY(-1px);
}

.login-password-wrap {
    position: relative;
    isolation: isolate;
}

.login-password-wrap input {
    position: relative;
    z-index: 0;
    padding-right: 3.15rem;
}

.login-password-wrap input::-ms-reveal,
.login-password-wrap input::-ms-clear {
    display: none;
}

.login-password-toggle {
    position: absolute;
    top: 50%;
    right: 0.45rem;
    z-index: 2;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: calc(100% - 0.5rem);
    min-height: 2.35rem;
    padding: 0;
    border: 1px solid var(--l3d-stroke);
    border-radius: 0.65rem;
    background: rgba(4, 12, 22, 0.72);
    color: var(--l3d-mist);
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.login-password-toggle i {
    display: block;
    font-size: 1.15rem;
    line-height: 1;
    pointer-events: none;
}

.login-password-toggle:hover {
    color: #fff;
    border-color: rgba(20, 163, 168, 0.65);
    background: rgba(20, 163, 168, 0.18);
}

.login-password-toggle:focus-visible {
    outline: 2px solid rgba(20, 163, 168, 0.65);
    outline-offset: 2px;
}

.login-captcha-row {
    display: flex;
    align-items: stretch;
    gap: 0.55rem;
}

.login-captcha-img {
    flex: 0 0 auto;
    width: 160px;
    height: 48px;
    border-radius: 0.75rem;
    border: 1px solid var(--l3d-stroke);
    background: rgba(4, 12, 22, 0.7);
    object-fit: cover;
}

.login-captcha-refresh {
    flex: 0 0 48px;
    width: 48px;
    border-radius: 0.75rem;
    border: 1px solid var(--l3d-stroke);
    background: rgba(4, 12, 22, 0.55);
    color: var(--l3d-mist);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.login-captcha-refresh:hover {
    border-color: rgba(20, 163, 168, 0.65);
    background: rgba(20, 163, 168, 0.15);
    transform: rotate(-20deg);
}

.login-captcha-input {
    flex: 1 1 auto;
    min-width: 0;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.login-submit {
    position: relative;
    margin-top: 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.95rem 1.25rem;
    border: none;
    border-radius: 999px;
    font-family: var(--l3d-font-body);
    font-weight: 700;
    font-size: 1.02rem;
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    background: linear-gradient(135deg, var(--l3d-teal-bright), var(--l3d-teal));
    box-shadow:
        0 14px 32px rgba(13, 115, 119, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.login-submit--shine::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%);
    transform: translateX(-120%);
    animation: login-shine 4.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes login-shine {
    0%, 55% { transform: translateX(-120%); }
    75%, 100% { transform: translateX(120%); }
}

.login-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(13, 115, 119, 0.55);
}

.login-submit:active {
    transform: translateY(0);
}

.login-links {
    position: relative;
    z-index: 1;
    margin-top: 1.35rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    font-size: 0.88rem;
}

.login-links a {
    color: rgba(232, 213, 181, 0.9);
    transition: color 0.2s ease;
}

.login-links a:hover {
    color: #fff;
}

.login-links .muted {
    color: rgba(220, 230, 240, 0.45);
    font-size: 0.8rem;
}

.login-links .credit {
    margin-top: 0.35rem;
    color: rgba(220, 230, 240, 0.4);
    font-size: 0.78rem;
}

@media (max-width: 900px) {
    .login-chip--3,
    .login-chip--4 { display: none; }
    .login-chip--1 { left: 0; top: -0.85rem; }
    .login-chip--2 { right: 0; }
    .login-ring { opacity: 0.4; width: 400px; height: 400px; margin: -200px 0 0 -200px; }
    .login-ring--inner { width: 300px; height: 300px; margin: -150px 0 0 -150px; }
    .login-stage { width: min(100%, 420px); }
    .login-card { padding: 1.35rem 1.2rem 1.2rem; }
}

@media (max-width: 560px) {
    .login-shell { padding: 1rem 0.75rem 1.5rem; }
    .login-chip--1,
    .login-chip--2 { display: none; }
    .login-ring { opacity: 0.28; width: 300px; height: 300px; margin: -150px 0 0 -150px; }
    .login-ring--inner { width: 220px; height: 220px; margin: -110px 0 0 -110px; }
    .login-brand h1 { font-size: 1.35rem; }
    .login-field input { padding: 0.75rem 0.9rem; }
    .login-password-wrap input { padding-right: 3.15rem; }
    .login-captcha-row { flex-wrap: wrap; }
    .login-captcha-img { width: 100%; height: auto; aspect-ratio: 160 / 48; }
    .login-captcha-refresh { width: 44px; flex-basis: 44px; }
    .login-captcha-input { flex: 1 1 calc(100% - 56px); }
}

@media (min-width: 1200px) {
    .login-stage { width: min(100%, 460px); }
}

@media (prefers-reduced-motion: reduce) {
    .login-3d .l3d-grid,
    .login-3d .l3d-orb,
    .login-3d .l3d-dust span,
    .login-chip,
    .login-logo-3d,
    .login-logo-pulse,
    .login-card-wrap,
    .login-ring,
    .login-card::after,
    .login-submit--shine::after,
    .login-rise {
        animation: none !important;
    }

    .login-rise {
        opacity: 1 !important;
        transform: none !important;
    }

    .login-card-wrap {
        transition: none;
    }
}
