* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

.auth-page {
    --auth-gold: #d4af37;
    --auth-gold-soft: #f1de65;
    --auth-gold-deep: #b88a1b;
    --auth-text: #121212;
    --auth-muted: #6e6e6e;
    --auth-border: rgba(212, 175, 55, 0.35);
    --auth-danger-bg: rgba(220, 53, 69, 0.08);
    --auth-danger-fg: #8f1f2f;
    --auth-danger-border: rgba(220, 53, 69, 0.25);
    --auth-success-bg: rgba(40, 167, 69, 0.1);
    --auth-success-fg: #1f6d3b;
    --auth-success-border: rgba(40, 167, 69, 0.25);
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    background:
        radial-gradient(circle at 15% 12%, rgba(212, 175, 55, 0.16), transparent 30%),
        radial-gradient(circle at 86% 88%, rgba(212, 175, 55, 0.14), transparent 32%),
        linear-gradient(140deg, #fbfaf6 0%, #f7f4eb 48%, #faf8f3 100%);
    color: var(--auth-text);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.auth-page::before,
.auth-page::after {
    content: "";
    position: fixed;
    pointer-events: none;
    z-index: 0;
}

.auth-page::before {
    top: 120px;
    inset-inline-start: -140px;
    width: 520px;
    height: 520px;
    border-radius: 44% 56% 61% 39% / 45% 39% 61% 55%;
    background:
        conic-gradient(
            from 210deg,
            rgba(212, 175, 55, 0) 0deg,
            rgba(212, 175, 55, 0.22) 110deg,
            rgba(241, 222, 101, 0.28) 175deg,
            rgba(212, 175, 55, 0) 300deg
        );
    filter: blur(2px);
    opacity: 0.8;
    animation: authGoldFloat 13s ease-in-out infinite alternate;
}

.auth-page::after {
    inset-inline-end: 6%;
    bottom: 14%;
    width: 330px;
    height: 330px;
    border-radius: 28px;
    border: 1px solid rgba(212, 175, 55, 0.45);
    background:
        radial-gradient(circle at 30% 30%, rgba(241, 222, 101, 0.2), transparent 58%),
        radial-gradient(circle at 72% 68%, rgba(212, 175, 55, 0.16), transparent 62%);
    box-shadow:
        0 0 24px rgba(212, 175, 55, 0.16),
        inset 0 0 36px rgba(212, 175, 55, 0.09);
    transform: rotate(34deg);
    animation: authGoldFrame 9s ease-in-out infinite;
}

@keyframes authGoldFloat {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    }
    50% {
        transform: translate3d(56px, 18px, 0) rotate(12deg) scale(1.06);
    }
    100% {
        transform: translate3d(20px, -26px, 0) rotate(20deg) scale(0.98);
    }
}

@keyframes authGoldFrame {
    0% {
        transform: rotate(34deg) translate3d(0, 0, 0) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: rotate(44deg) translate3d(-14px, -10px, 0) scale(1.04);
        opacity: 0.86;
    }
    100% {
        transform: rotate(36deg) translate3d(12px, 8px, 0) scale(0.98);
        opacity: 0.62;
    }
}

@keyframes authGoldDiamond {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
        opacity: 0.74;
    }
    50% {
        transform: translate3d(-10px, 12px, 0) rotate(18deg) scale(1.08);
        opacity: 0.95;
    }
    100% {
        transform: translate3d(10px, -12px, 0) rotate(36deg) scale(0.98);
        opacity: 0.78;
    }
}

.auth-page .auth-main,
.auth-page .site-footer {
    position: relative;
    z-index: 1;
}

.auth-page .auth-main {
    min-height: calc(100vh - 130px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 18px 44px;
}

.auth-page .auth-main::before {
    content: "";
    position: absolute;
    inset-inline-end: clamp(14px, 8vw, 110px);
    top: clamp(110px, 16vh, 220px);
    width: 190px;
    height: 190px;
    pointer-events: none;
    z-index: 0;
    clip-path: polygon(50% 0%, 90% 22%, 100% 66%, 72% 100%, 28% 100%, 0 66%, 10% 22%);
    background:
        linear-gradient(135deg, rgba(241, 222, 101, 0.62) 0%, rgba(212, 175, 55, 0.2) 48%, rgba(184, 138, 27, 0.68) 100%);
    box-shadow:
        0 0 28px rgba(212, 175, 55, 0.28),
        inset 0 0 20px rgba(255, 255, 255, 0.22);
    opacity: 0.88;
    animation: authGoldDiamond 11s ease-in-out infinite alternate;
}

.auth-container {
    position: relative;
    z-index: 1;
    width: min(620px, 100%);
    border-radius: 24px;
    border: 1px solid var(--auth-border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(251, 248, 240, 0.98) 100%);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.1), 0 0 30px rgba(212, 175, 55, 0.12);
    padding: 34px 28px;
    animation: authSlideUp 0.45s ease;
    backdrop-filter: blur(8px);
}

@keyframes authSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    text-align: center;
    margin-bottom: 26px;
}

.logo h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 3.7vw, 2.5rem);
    color: var(--auth-gold);
    line-height: 1;
    letter-spacing: 0.4px;
}

.logo p {
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.94rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #2a2a2a;
    font-weight: 700;
    font-size: 0.92rem;
}

.form-group label .required {
    color: #ff7f7f;
}

.form-group input,
.form-group select {
    width: 100%;
    min-height: 46px;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.28);
    background: #ffffff;
    color: #161616;
    padding: 11px 14px;
    font-size: 0.97rem;
    font-family: inherit;
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background-color 0.25s ease;
}

.form-group input::placeholder {
    color: #8f8f8f;
}

.form-group select {
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: rgba(212, 175, 55, 0.8);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.2);
    background: #ffffff;
}

.remember-forgot {
    margin: 6px 0 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.remember-forgot label,
.terms-agreement label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    color: var(--auth-muted);
    cursor: pointer;
}

.remember-forgot input[type="checkbox"],
.terms-agreement input[type="checkbox"] {
    margin: 0;
    margin-top: 2px;
    width: 18px;
    height: 18px;
    accent-color: var(--auth-gold);
}

.remember-forgot a,
.terms-agreement a,
.register-link a,
.login-link a {
    color: #bc8c1a;
    text-decoration: none;
    font-weight: 700;
    transition: color 0.2s ease;
}

.remember-forgot a:hover,
.terms-agreement a:hover,
.register-link a:hover,
.login-link a:hover {
    color: #9e7211;
}

.terms-agreement {
    margin-bottom: 20px;
    font-size: 0.89rem;
}

.btn-submit {
    width: 100%;
    min-height: 48px;
    border-radius: 14px;
    border: 1px solid rgba(212, 175, 55, 0.5);
    background: linear-gradient(135deg, #d4af37 0%, #f1de65 100%);
    color: #111;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.22s ease, box-shadow 0.22s ease, filter 0.22s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(212, 175, 55, 0.28);
    filter: brightness(1.03);
}

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

.btn-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.divider {
    position: relative;
    margin: 24px 0;
    text-align: center;
}

.divider::before {
    content: "";
    position: absolute;
    top: 50%;
    inset-inline: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.36), transparent);
}

.divider span {
    position: relative;
    z-index: 1;
    background: #fbfaf6;
    color: #888;
    padding: 0 12px;
    font-size: 0.86rem;
}

.register-link,
.login-link {
    margin-top: 18px;
    text-align: center;
    color: var(--auth-muted);
    font-size: 0.93rem;
}

.btn-link-action {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.auth-note {
    margin: -2px 0 16px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.25);
    background: rgba(255, 250, 237, 0.72);
    color: #514015;
    font-size: 0.9rem;
    line-height: 1.65;
}

.auth-note p {
    margin: 0;
}

.auth-note p + p {
    margin-top: 4px;
}

.auth-code-input {
    text-align: center;
    letter-spacing: 0.4rem;
    font-size: 1.22rem;
    font-weight: 700;
}

.auth-actions-row {
    margin-top: 14px;
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 10px;
}

.auth-inline-form {
    margin: 0;
    flex: 1;
}

.btn-secondary {
    min-height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(212, 175, 55, 0.45);
    background: rgba(255, 255, 255, 0.86);
    color: #7a5d12;
    padding: 10px 14px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    width: 100%;
}

.btn-secondary:hover {
    border-color: rgba(184, 138, 27, 0.75);
    color: #5f470e;
    transform: translateY(-1px);
}

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    line-height: 1.6;
    animation: authSlideDown 0.25s ease;
}

@keyframes authSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: var(--auth-success-bg);
    color: var(--auth-success-fg);
    border: 1px solid var(--auth-success-border);
}

.alert-error {
    background: var(--auth-danger-bg);
    color: var(--auth-danger-fg);
    border: 1px solid var(--auth-danger-border);
}

.loading-spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 2px solid rgba(17, 17, 17, 0.25);
    border-radius: 50%;
    border-top-color: #111;
    animation: authSpin 0.8s linear infinite;
    margin-inline-start: 8px;
    vertical-align: middle;
}

@keyframes authSpin {
    to {
        transform: rotate(360deg);
    }
}

.password-strength {
    margin-top: 8px;
    font-size: 0.84rem;
}

.password-strength .strength-bar {
    height: 4px;
    margin-top: 6px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.password-strength .strength-bar-fill {
    height: 100%;
    width: 0;
    transition: width 0.25s ease, background-color 0.25s ease;
}

.password-strength .strength-bar-fill.weak {
    width: 33%;
    background: #e84b5c;
}

.password-strength .strength-bar-fill.medium {
    width: 66%;
    background: #f2aa3d;
}

.password-strength .strength-bar-fill.strong {
    width: 100%;
    background: #36c46f;
}

small {
    color: #777 !important;
}

@media (max-width: 768px) {
    .auth-page::before {
        width: 360px;
        height: 360px;
        inset-inline-start: -110px;
        top: 130px;
        opacity: 0.7;
    }

    .auth-page::after {
        width: 210px;
        height: 210px;
        inset-inline-end: -10px;
        bottom: 18%;
    }

    .auth-page .auth-main::before {
        width: 126px;
        height: 126px;
        inset-inline-end: 8px;
        top: 126px;
        opacity: 0.72;
    }

    .auth-page .auth-main {
        min-height: calc(100vh - 120px);
        padding: 98px 12px 28px;
    }

    .auth-container {
        padding: 26px 18px;
        border-radius: 18px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .remember-forgot {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-actions-row {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-page::before,
    .auth-page::after,
    .auth-page .auth-main::before,
    .auth-container {
        animation: none !important;
    }
}
