/* Auth pages — login / register shared visual system */
:root {
    --auth-ink: #15261a;
    --auth-forest: #205A28;
    --auth-forest-deep: #163f1c;
    --auth-sage: #4a7a52;
    --auth-mist: #e8eee8;
    --auth-paper: #f6f7f4;
    --auth-line: rgba(21, 38, 26, 0.12);
    --auth-gold: #b08d3e;
    --auth-danger: #9b2c2c;
    --auth-ok: #1f6b3a;
    --auth-font-display: "Literata", "Noto Serif SC", "Songti SC", Georgia, serif;
    --auth-font-ui: "Manrope", "Noto Sans SC", "PingFang SC", "Segoe UI", sans-serif;
}

@keyframes authFadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes authDrift {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50% { transform: translate3d(1.5%, -1%, 0) scale(1.03); }
}

@keyframes authSheen {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}

body.auth-page {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--auth-font-ui);
    color: var(--auth-ink);
    background: var(--auth-paper);
}

body.auth-page .main-content {
    flex: 1;
    display: flex;
    padding: 0;
    min-height: 0;
}

.auth-stage {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    animation: authFadeUp 0.55s ease both;
}

/* —— Brand panel —— */
.auth-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: clamp(2rem, 5vw, 4rem);
    color: #f4f7f4;
    background:
        linear-gradient(160deg, rgba(22, 63, 28, 0.92) 0%, rgba(21, 38, 26, 0.88) 55%, rgba(32, 90, 40, 0.85) 100%),
        radial-gradient(120% 80% at 10% 90%, rgba(176, 141, 62, 0.22), transparent 55%),
        linear-gradient(135deg, #1a3d22 0%, #0f1f14 100%);
}

.auth-brand::before {
    content: "";
    position: absolute;
    inset: -8%;
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 42px,
            rgba(255, 255, 255, 0.035) 42px,
            rgba(255, 255, 255, 0.035) 46px,
            transparent 46px,
            transparent 78px,
            rgba(176, 141, 62, 0.07) 78px,
            rgba(176, 141, 62, 0.07) 82px
        );
    opacity: 0.9;
    animation: authDrift 22s ease-in-out infinite;
    pointer-events: none;
}

.auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 70% 50% at 70% 20%, rgba(255, 255, 255, 0.08), transparent 60%),
        linear-gradient(180deg, transparent 40%, rgba(8, 16, 10, 0.35) 100%);
    pointer-events: none;
}

.auth-brand-inner {
    position: relative;
    z-index: 1;
    max-width: 34rem;
    animation: authFadeUp 0.7s 0.08s ease both;
}

.auth-brand-kicker {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(244, 247, 244, 0.72);
    margin-bottom: 1rem;
}

.auth-brand-name {
    font-family: var(--auth-font-display);
    font-size: clamp(2.4rem, 4.5vw, 3.6rem);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.02em;
    margin: 0 0 0.85rem;
    color: #fff;
}

.auth-brand-tagline {
    font-family: var(--auth-font-display);
    font-size: clamp(1.05rem, 1.6vw, 1.25rem);
    font-weight: 450;
    line-height: 1.55;
    color: rgba(244, 247, 244, 0.88);
    margin: 0 0 1.75rem;
    max-width: 28rem;
}

.auth-brand-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.auth-brand-features li {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.95rem;
    line-height: 1.45;
    color: rgba(244, 247, 244, 0.82);
}

.auth-brand-features li i {
    flex-shrink: 0;
    margin-top: 0.15rem;
    color: var(--auth-gold);
}

.auth-brand-footer {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding-top: 2.5rem;
    font-size: 0.8rem;
    color: rgba(244, 247, 244, 0.55);
    letter-spacing: 0.02em;
}

/* —— Form panel —— */
.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: var(--auth-paper);
    padding: clamp(1.75rem, 4vw, 3.25rem) clamp(1.25rem, 4vw, 3.5rem) 0;
    position: relative;
    min-height: 100%;
}

.auth-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(32, 90, 40, 0.06), transparent 55%),
        linear-gradient(180deg, #fbfcf9 0%, var(--auth-paper) 100%);
    pointer-events: none;
}

.auth-panel-inner {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    margin: auto auto 0;
    padding-bottom: 1.25rem;
    animation: authFadeUp 0.65s 0.12s ease both;
}

.auth-panel.register-wide .auth-panel-inner {
    max-width: 520px;
}

.auth-panel-header {
    margin-bottom: 1.5rem;
}

.auth-panel-header h1 {
    font-family: var(--auth-font-display);
    font-size: clamp(1.65rem, 2.4vw, 2rem);
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 0.4rem;
    color: var(--auth-ink);
}

.auth-panel-header p {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(21, 38, 26, 0.62);
    line-height: 1.5;
}

.auth-notice {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    padding: 0.85rem 1rem;
    margin-bottom: 1.25rem;
    background: rgba(32, 90, 40, 0.06);
    border-left: 3px solid var(--auth-forest);
    font-size: 0.875rem;
    line-height: 1.5;
    color: rgba(21, 38, 26, 0.78);
}

.auth-notice i {
    color: var(--auth-forest);
    margin-top: 0.1rem;
    flex-shrink: 0;
}

.auth-alert {
    border: none;
    border-radius: 0;
    padding: 0.9rem 1rem;
    margin-bottom: 1.15rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.auth-alert-danger {
    background: #faf0f0;
    color: var(--auth-danger);
    border-left: 3px solid var(--auth-danger);
}

.auth-alert-success {
    background: #eef7f1;
    color: var(--auth-ok);
    border-left: 3px solid var(--auth-ok);
}

.auth-form .form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(21, 38, 26, 0.72);
    margin-bottom: 0.4rem;
}

.auth-form .form-label .req {
    color: var(--auth-danger);
    font-weight: 700;
}

.auth-form .form-control {
    border-radius: 0;
    border: 1px solid var(--auth-line);
    border-bottom-width: 2px;
    padding: 0.7rem 0.9rem;
    font-size: 0.95rem;
    background: #fff;
    color: var(--auth-ink);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.auth-form .form-control:focus {
    border-color: var(--auth-forest);
    box-shadow: none;
    background: #fff;
}

.auth-form .form-control.is-valid {
    border-color: var(--auth-ok);
}

.auth-form .form-control.is-invalid {
    border-color: var(--auth-danger);
}

.auth-form .form-text {
    font-size: 0.8rem;
    color: rgba(21, 38, 26, 0.5);
}

.auth-form .password-field {
    position: relative;
}

.auth-form .password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(21, 38, 26, 0.45);
    cursor: pointer;
    padding: 0.35rem;
    line-height: 1;
    z-index: 5;
}

.auth-form .password-toggle:hover,
.auth-form .password-toggle:focus-visible {
    color: var(--auth-forest);
    outline: none;
}

.auth-form .form-check-input {
    border-radius: 2px;
    border-color: rgba(21, 38, 26, 0.3);
}

.auth-form .form-check-input:checked {
    background-color: var(--auth-forest);
    border-color: var(--auth-forest);
}

.auth-form .form-check-label {
    font-size: 0.875rem;
    color: rgba(21, 38, 26, 0.7);
}

.auth-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    margin-top: 0.35rem;
    padding: 0.8rem 1.1rem;
    border: none;
    border-radius: 0;
    background: var(--auth-forest);
    color: #fff;
    font-family: var(--auth-font-ui);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.auth-btn-primary:hover:not(:disabled) {
    background: var(--auth-forest-deep);
    color: #fff;
    transform: translateY(-1px);
}

.auth-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.auth-btn-primary:focus-visible {
    outline: 2px solid var(--auth-gold);
    outline-offset: 2px;
}

.auth-switch {
    margin-top: 1.5rem;
    padding-top: 1.15rem;
    border-top: 1px solid var(--auth-line);
    text-align: center;
    font-size: 0.9rem;
    color: rgba(21, 38, 26, 0.62);
}

.auth-switch a {
    color: var(--auth-forest);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease;
}

.auth-switch a:hover {
    border-bottom-color: var(--auth-forest);
}

.auth-form a.link-login {
    color: var(--auth-forest);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid rgba(32, 90, 40, 0.35);
}

.auth-form a.link-login:hover {
    border-bottom-color: var(--auth-forest);
}

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: rgba(21, 38, 26, 0.5);
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-back:hover {
    color: var(--auth-forest);
}

/* Slider captcha */
.slider-captcha {
    margin: 0.85rem 0 1rem;
    user-select: none;
}

.slider-captcha-track {
    position: relative;
    height: 46px;
    background: var(--auth-mist);
    border: 1px solid var(--auth-line);
    overflow: hidden;
}

.slider-captcha-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, rgba(32, 90, 40, 0.75), var(--auth-forest));
    background-size: 200% 100%;
    animation: authSheen 3.5s linear infinite;
}

.slider-captcha-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    color: rgba(21, 38, 26, 0.5);
    pointer-events: none;
}

.slider-captcha-text.verified {
    color: #fff;
    font-weight: 600;
}

.slider-captcha-thumb {
    position: absolute;
    left: 2px;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 40px;
    background: #fff;
    border: 1px solid var(--auth-line);
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-forest);
    z-index: 2;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.slider-captcha-thumb:active { cursor: grabbing; }

.slider-captcha-thumb.verified {
    background: var(--auth-forest);
    color: #fff;
    border-color: var(--auth-forest);
    cursor: default;
}

/* Password requirements */
.auth-pw-reqs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem 0.75rem;
    margin: 0.25rem 0 1rem;
    padding: 0.75rem 0.85rem;
    background: rgba(32, 90, 40, 0.04);
    border: 1px solid var(--auth-line);
    font-size: 0.78rem;
}

.auth-pw-reqs .auth-pw-reqs-title {
    grid-column: 1 / -1;
    font-weight: 650;
    color: rgba(21, 38, 26, 0.65);
    margin-bottom: 0.15rem;
}

.auth-pw-reqs li {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: rgba(21, 38, 26, 0.5);
    list-style: none;
}

.auth-pw-reqs li.text-success {
    color: var(--auth-ok);
}

.auth-pw-reqs #req-special {
    grid-column: 1 / -1;
}

.auth-strength .progress {
    height: 4px;
    border-radius: 0;
    background: var(--auth-mist);
}

.auth-strength .progress-bar {
    border-radius: 0;
}

/* Modals on auth pages */
.auth-page .modal-header {
    background: var(--auth-forest);
    color: #fff;
    border-bottom: none;
    border-radius: 0;
}

.auth-page .modal-header .btn-close { filter: invert(1); }

.auth-page .modal-content {
    border-radius: 0;
    border: none;
    box-shadow: 0 16px 48px rgba(21, 38, 26, 0.18);
}

.auth-page .modal-body h6 {
    color: var(--auth-forest);
    font-weight: 650;
    margin-top: 1.35rem;
    margin-bottom: 0.45rem;
}

.auth-page .modal-body h6:first-child { margin-top: 0; }

.auth-page .modal-footer {
    border-top: 1px solid var(--auth-line);
}

.auth-page .btn-primary {
    background: var(--auth-forest);
    border-color: var(--auth-forest);
    border-radius: 0;
}

.auth-page .btn-primary:hover {
    background: var(--auth-forest-deep);
    border-color: var(--auth-forest-deep);
}

.auth-page .btn-secondary,
.auth-page .btn-outline-primary {
    border-radius: 0;
}

.auth-page .btn-outline-primary {
    color: var(--auth-forest);
    border-color: var(--auth-forest);
}

.auth-page .btn-outline-primary:hover {
    background: var(--auth-forest);
    border-color: var(--auth-forest);
    color: #fff;
}

/* Footer — continuous with form panel paper surface */
.auth-footer-slot {
    position: relative;
    z-index: 1;
    margin-top: auto;
    width: 100%;
    padding-top: 0.5rem;
    background: transparent;
    border-top: 1px solid var(--auth-line);
}

body.auth-page .auth-footer-slot footer.bg-light {
    margin-top: 0 !important;
    padding: 1.1rem 0 1.35rem !important;
    background: transparent !important;
    border: none;
    font-family: var(--auth-font-ui);
}

body.auth-page .auth-footer-slot footer .container {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
}

body.auth-page .auth-footer-slot footer .text-center {
    text-align: left !important;
}

body.auth-page .auth-footer-slot footer .text-muted,
body.auth-page .auth-footer-slot footer a.text-muted {
    color: rgba(21, 38, 26, 0.52) !important;
}

body.auth-page .auth-footer-slot footer a.text-muted:hover {
    color: var(--auth-forest) !important;
}

body.auth-page .auth-footer-slot footer p {
    margin-bottom: 0.3rem !important;
    font-size: 0.8125rem;
    line-height: 1.45;
    border-top: none !important;
    padding-top: 0 !important;
}

body.auth-page .auth-footer-slot footer p.mb-0 {
    margin-bottom: 0 !important;
    font-size: 0.75rem;
}

body.auth-page .auth-footer-slot footer strong {
    color: var(--auth-ink);
    font-weight: 600;
    font-family: var(--auth-font-display);
}

body.auth-page .auth-footer-slot footer .mb-3 {
    margin-bottom: 0.45rem !important;
}

body.auth-page .auth-footer-slot footer img {
    height: 36px !important;
    margin-bottom: 0.2rem !important;
    opacity: 0.9;
}

body.auth-page .auth-footer-slot footer .text-center > p:nth-child(2),
body.auth-page .auth-footer-slot footer .text-center > p:nth-child(3) {
    display: none;
}

.auth-page footer.bg-light,
.auth-page .site-tail {
    margin-top: 0;
}

@media (max-width: 991.98px) {
    .auth-stage {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .auth-brand {
        min-height: 220px;
        padding: 1.75rem 1.35rem 1.5rem;
        justify-content: flex-end;
    }

    .auth-brand-name {
        font-size: clamp(1.85rem, 7vw, 2.4rem);
    }

    .auth-brand-features {
        display: none;
    }

    .auth-brand-footer {
        display: none;
    }

    .auth-panel {
        padding: 1.75rem 1.25rem 0;
    }

    .auth-panel-inner {
        margin: 0 auto;
        padding-bottom: 1rem;
    }

    .auth-pw-reqs {
        grid-template-columns: 1fr;
    }

    body.auth-page .auth-footer-slot footer .text-center {
        text-align: center !important;
    }
}

@media (max-width: 575.98px) {
    .auth-brand {
        min-height: 180px;
    }

    .auth-brand-tagline {
        margin-bottom: 0;
        font-size: 0.95rem;
    }
}
