/* =========================================================
   EXACTSUB
   LOGIN PAGE
========================================================= */


/* =========================================================
   PAGE
========================================================= */

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(
            circle at 10% 20%,
            rgba(2, 42, 123, 0.045),
            transparent 30%
        ),
        radial-gradient(
            circle at 90% 80%,
            rgba(41, 186, 34, 0.035),
            transparent 28%
        ),
        var(--white);
}


/* =========================================================
   TOP BAR
========================================================= */

.auth-topbar {
    width: min(
        calc(100% - (var(--container-padding) * 2)),
        var(--container-width)
    );

    min-height: var(--nav-height);

    margin-inline: auto;

    display: flex;
    align-items: center;
    justify-content: space-between;
}


.auth-logo {
    display: inline-flex;
    align-items: center;

    transition:
        opacity var(--transition),
        transform var(--transition);
}

.auth-logo:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.auth-logo img {
    width: auto;
    height: 3.8rem;
    object-fit: contain;
}


/* =========================================================
   THEME TOGGLE
========================================================= */

.auth-theme-toggle {
    width: 4.2rem;
    height: 4.2rem;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--gray-200);
    border-radius: 50%;

    color: var(--gray-700);
    background: var(--white);

    box-shadow: var(--shadow-sm);

    transition:
        background-color var(--transition),
        border-color var(--transition),
        color var(--transition),
        transform var(--transition),
        box-shadow var(--transition);
}

.auth-theme-toggle:hover {
    color: var(--brand-primary);
    border-color: var(--brand-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.auth-theme-toggle:focus-visible {
    outline: 3px solid rgba(41, 186, 34, 0.3);
    outline-offset: 3px;
}


.theme-icon {
    width: 1.9rem;
    height: 1.9rem;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-icon-sun {
    display: none;
}

[data-theme="dark"] .theme-icon-sun {
    display: block;
}

[data-theme="dark"] .theme-icon-moon {
    display: none;
}


/* =========================================================
   AUTH SECTION
========================================================= */

.auth-section {
    flex: 1;

    display: flex;
    align-items: center;

    padding-block: 4rem 5rem;
}


.auth-layout {
    width: min(
        calc(100% - (var(--container-padding) * 2)),
        1040px
    );

    margin-inline: auto;

    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(400px, 470px);

    align-items: center;

    gap: clamp(5rem, 8vw, 10rem);
}


/* =========================================================
   LEFT INTRO
========================================================= */

.auth-intro {
    max-width: 530px;
}


.auth-intro-badge {
    width: fit-content;

    display: inline-flex;
    align-items: center;
    gap: 0.8rem;

    margin-bottom: 2rem;
    padding: 0.7rem 1.2rem;

    border: 1px solid var(--brand-accent-light);
    border-radius: var(--radius-full);

    color: var(--brand-accent-dark);
    background: var(--brand-accent-light);

    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
}


.auth-badge-dot {
    width: 0.7rem;
    height: 0.7rem;

    border-radius: 50%;

    background: var(--brand-accent);

    box-shadow:
        0 0 0 4px rgba(41, 186, 34, 0.12);
}


.auth-intro h1 {
    margin-bottom: 2rem;

    font-size: clamp(3.6rem, 5vw, 5.8rem);
    line-height: 1.08;
    letter-spacing: -0.045em;
}


.auth-intro h1 span {
    display: block;
    color: var(--brand-primary);
}


.auth-intro > p {
    max-width: 500px;

    margin-bottom: 3.6rem;

    font-size: 1.7rem;
    line-height: 1.7;
}


/* =========================================================
   BENEFITS
========================================================= */

.auth-benefits {
    display: flex;
    flex-direction: column;
    gap: 1.8rem;
}


.auth-benefit {
    display: flex;
    align-items: flex-start;
    gap: 1.4rem;
}


.auth-benefit-icon {
    flex: 0 0 4.2rem;

    width: 4.2rem;
    height: 4.2rem;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1px solid var(--brand-primary-light);
    border-radius: 1.1rem;

    color: var(--brand-primary);
    background: var(--brand-primary-light);
}


.auth-benefit-icon svg {
    width: 2rem;
    height: 2rem;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}


.auth-benefit div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;

    padding-top: 0.2rem;
}


.auth-benefit strong {
    color: var(--gray-800);

    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);
}


.auth-benefit div span {
    color: var(--gray-600);

    font-size: var(--text-sm);
    line-height: 1.5;
}


/* =========================================================
   LOGIN CARD
========================================================= */

.auth-card {
    width: 100%;

    padding: clamp(2.8rem, 5vw, 4rem);

    border: 1px solid var(--gray-200);
    border-radius: 2rem;

    background: var(--white);

    box-shadow:
        0 18px 50px rgba(2, 42, 123, 0.08);

    transition:
        background-color 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}


/* =========================================================
   HEADER
========================================================= */

.auth-header {
    margin-bottom: 3rem;
    text-align: center;
}


.auth-mobile-logo {
    display: none;
}


.auth-heading-icon {
    width: 4.8rem;
    height: 4.8rem;

    margin: 0 auto 1.8rem;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 1.4rem;

    color: var(--brand-primary);
    background: var(--brand-primary-light);
}


.auth-heading-icon svg {
    width: 2.4rem;
    height: 2.4rem;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}


.auth-header h2 {
    margin-bottom: 0.8rem;

    font-size: 2.8rem;
    line-height: 1.2;
    letter-spacing: -0.025em;
}


.auth-header h2 span {
    color: var(--brand-primary);
}


.auth-header p {
    font-size: var(--text-sm);
    line-height: 1.55;
}


/* =========================================================
   FORM
========================================================= */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}


.auth-field {
    display: flex;
    flex-direction: column;
}


.auth-field label {
    display: block;

    margin-bottom: 0.8rem;

    color: var(--gray-800);

    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);
}


.auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 1rem;
}


.forgot-password {
    color: var(--brand-primary);

    font-size: 1.3rem;
    font-weight: var(--font-weight-semibold);

    transition:
        color var(--transition);
}


.forgot-password:hover {
    color: var(--brand-primary-dark);
    text-decoration: underline;
}


/* =========================================================
   INPUT
========================================================= */

.auth-input-wrapper {
    position: relative;

    display: flex;
    align-items: center;
}


.auth-input-wrapper input {
    width: 100%;
    height: 5rem;

    padding:
        0 4.8rem
        0 4.6rem;

    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);

    outline: none;

    color: var(--gray-800);
    background: var(--white);

    font-size: var(--text-base);

    transition:
        border-color var(--transition),
        box-shadow var(--transition),
        background-color var(--transition);
}


.auth-input-wrapper input::placeholder {
    color: var(--gray-400);
}


.auth-input-wrapper input:hover {
    border-color: var(--gray-400);
}


.auth-input-wrapper input:focus {
    border-color: var(--brand-primary);

    box-shadow:
        0 0 0 3px rgba(2, 42, 123, 0.1);
}


.auth-input-wrapper:focus-within .auth-input-icon {
    color: var(--brand-primary);
}


.auth-input-icon {
    position: absolute;
    left: 1.5rem;

    z-index: 2;

    width: 2rem;
    height: 2rem;

    display: flex;

    color: var(--gray-400);

    pointer-events: none;

    transition: color var(--transition);
}


.auth-input-icon svg {
    width: 100%;
    height: 100%;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* =========================================================
   PASSWORD TOGGLE
========================================================= */

.password-toggle {
    position: absolute;
    right: 1.2rem;

    width: 3.6rem;
    height: 3.6rem;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 0;
    border-radius: 0.8rem;

    color: var(--gray-500);
    background: transparent;

    transition:
        color var(--transition),
        background-color var(--transition);
}


.password-toggle:hover {
    color: var(--brand-primary);
    background: var(--gray-100);
}


.password-toggle:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 1px;
}


.eye-icon {
    width: 1.9rem;
    height: 1.9rem;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}


.eye-closed {
    display: none;
}


.password-toggle.is-visible .eye-open {
    display: none;
}


.password-toggle.is-visible .eye-closed {
    display: block;
}


/* =========================================================
   ERRORS
========================================================= */

.auth-error {
    min-height: 0;

    margin-top: 0.5rem;

    color: var(--error);

    font-size: 1.2rem;
    line-height: 1.4;
}


.auth-field.has-error
.auth-input-wrapper input {
    border-color: var(--error);
}


.auth-field.has-error
.auth-input-wrapper input:focus {
    box-shadow:
        0 0 0 3px rgba(224, 49, 49, 0.1);
}


/* =========================================================
   REMEMBER ME
========================================================= */

.auth-options {
    display: flex;
    align-items: center;

    margin-top: -0.2rem;
}


.remember-me {
    position: relative;

    display: inline-flex;
    align-items: center;
    gap: 0.9rem;

    color: var(--gray-600);

    font-size: 1.3rem;

    cursor: pointer;
    user-select: none;
}


.remember-me input {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;
}


.custom-checkbox {
    width: 1.8rem;
    height: 1.8rem;

    display: flex;
    align-items: center;
    justify-content: center;

    border: 1.5px solid var(--gray-300);
    border-radius: 0.45rem;

    background: var(--white);

    transition:
        background-color var(--transition),
        border-color var(--transition);
}


.custom-checkbox svg {
    width: 1.2rem;
    height: 1.2rem;

    fill: none;
    stroke: white;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;

    opacity: 0;

    transition: opacity var(--transition);
}


.remember-me input:checked
+ .custom-checkbox {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
}


.remember-me input:checked
+ .custom-checkbox svg {
    opacity: 1;
}


.remember-me input:focus-visible
+ .custom-checkbox {
    outline: 3px solid rgba(41, 186, 34, 0.25);
    outline-offset: 2px;
}


/* =========================================================
   FORM MESSAGE
========================================================= */

.auth-message {
    display: none;

    padding: 1.1rem 1.2rem;

    border-radius: var(--radius-md);

    color: var(--error);
    background: rgba(224, 49, 49, 0.07);

    font-size: 1.3rem;
    line-height: 1.5;
}


.auth-message.is-visible {
    display: block;
}


/* =========================================================
   SUBMIT BUTTON
========================================================= */

.auth-submit {
    position: relative;

    width: 100%;
    min-height: 5rem;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;

    margin-top: 0.4rem;
    padding: 1.2rem 2rem;

    border: 1px solid var(--brand-primary);
    border-radius: var(--radius-md);

    color: var(--white);
    background: var(--brand-primary);

    font-size: var(--text-base);
    font-weight: var(--font-weight-semibold);

    box-shadow:
        0 8px 18px rgba(2, 42, 123, 0.16);

    transition:
        background-color var(--transition),
        border-color var(--transition),
        transform var(--transition),
        box-shadow var(--transition);
}


.auth-submit:hover {
    background: var(--brand-primary-dark);
    border-color: var(--brand-primary-dark);

    transform: translateY(-1px);

    box-shadow:
        0 10px 22px rgba(2, 42, 123, 0.2);
}


.auth-submit:active {
    transform: translateY(0);
}


.auth-submit:focus-visible {
    outline: 3px solid rgba(41, 186, 34, 0.3);
    outline-offset: 3px;
}


.auth-submit:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}


.submit-arrow {
    width: 1.8rem;
    height: 1.8rem;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;

    transition: transform var(--transition);
}


.auth-submit:hover .submit-arrow {
    transform: translateX(3px);
}


.submit-loader {
    display: none;

    width: 1.8rem;
    height: 1.8rem;

    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: white;
    border-radius: 50%;

    animation: login-spin 0.7s linear infinite;
}


.auth-submit.is-loading .submit-loader {
    display: block;
}


.auth-submit.is-loading .submit-text,
.auth-submit.is-loading .submit-arrow {
    display: none;
}


@keyframes login-spin {
    to {
        transform: rotate(360deg);
    }
}


/* =========================================================
   REGISTER
========================================================= */

.auth-divider {
    position: relative;

    display: flex;
    align-items: center;

    margin-block: 2.5rem 1.5rem;

    color: var(--gray-500);

    font-size: 1.2rem;
}


.auth-divider::before,
.auth-divider::after {
    content: "";

    flex: 1;

    height: 1px;

    background: var(--gray-200);
}


.auth-divider span {
    padding-inline: 1.2rem;
}


.auth-register {
    min-height: 4.8rem;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;

    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);

    color: var(--brand-primary);

    background: var(--white);

    font-size: var(--text-sm);
    font-weight: var(--font-weight-semibold);

    transition:
        background-color var(--transition),
        border-color var(--transition),
        transform var(--transition);
}


.auth-register:hover {
    border-color: var(--brand-primary);
    background: var(--brand-primary-light);
    transform: translateY(-1px);
}


.auth-register svg {
    width: 1.7rem;
    height: 1.7rem;

    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;

    transition: transform var(--transition);
}


.auth-register:hover svg {
    transform: translateX(3px);
}


/* =========================================================
   SECURITY
========================================================= */

.auth-security {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;

    margin-top: 2rem;

    color: var(--gray-500);

    font-size: 1.15rem;
    text-align: center;
}


.auth-security svg {
    flex: 0 0 auto;

    width: 1.6rem;
    height: 1.6rem;

    fill: none;
    stroke: var(--brand-accent);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}


/* =========================================================
   COPYRIGHT
========================================================= */

.auth-copyright {
    width: min(
        calc(100% - (var(--container-padding) * 2)),
        var(--container-width)
    );

    margin: 0 auto;

    padding-bottom: 2.5rem;

    color: var(--gray-500);

    font-size: 1.2rem;

    text-align: center;
}


/* =========================================================
   DARK MODE
========================================================= */

[data-theme="dark"] .auth-page {
    background:
        radial-gradient(
            circle at 10% 20%,
            rgba(34, 139, 230, 0.08),
            transparent 30%
        ),
        radial-gradient(
            circle at 90% 80%,
            rgba(41, 186, 34, 0.045),
            transparent 28%
        ),
        var(--white);
}


[data-theme="dark"] .auth-card {
    box-shadow:
        0 18px 50px rgba(0, 0, 0, 0.3);
}


[data-theme="dark"] .auth-register:hover {
    background: var(--brand-primary-light);
}


[data-theme="dark"] .auth-input-wrapper input {
    color: var(--gray-800);
}


/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 900px) {

    .auth-layout {
        grid-template-columns: 1fr;

        max-width: 520px;

        gap: 4rem;
    }

    .auth-intro {
        display: none;
    }

    .auth-card {
        max-width: 520px;
        margin-inline: auto;
    }

    

}


@media (max-width: 600px) {

    .auth-topbar {
        min-height: 6.4rem;
    }

    .auth-logo img {
        height: 3.2rem;
    }

    .auth-theme-toggle {
        width: 3.9rem;
        height: 3.9rem;
    }

    .auth-section {
        align-items: flex-start;

        padding-block: 2.5rem 3.5rem;
    }

    .auth-layout {
        width: min(
            calc(100% - 3.2rem),
            520px
        );
    }

    .auth-card {
        padding: 2.4rem 2rem;

        border-radius: 1.6rem;
    }

    .auth-heading-icon {
        width: 4.4rem;
        height: 4.4rem;
    }

    .auth-header {
        margin-bottom: 2.5rem;
    }

    .auth-header h2 {
        font-size: 2.5rem;
    }

    .auth-form {
        gap: 1.8rem;
    }

    .auth-input-wrapper input {
        height: 4.8rem;
    }

    .auth-copyright {
        padding-bottom: 2rem;
    }

}


@media (max-width: 380px) {

    .auth-topbar {
        width: min(
            calc(100% - 2.4rem),
            var(--container-width)
        );
    }

    .auth-layout {
        width: min(
            calc(100% - 2.4rem),
            520px
        );
    }

    .auth-card {
        padding: 2.2rem 1.6rem;
    }

    .auth-label-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.4rem;
    }

    .forgot-password {
        font-size: 1.2rem;
    }

}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

}

/* =========================================================
   FINAL DESKTOP LAYOUT / SCROLL CORRECTIONS
   These overrides preserve the existing design while
   preventing the login card from being vertically clipped.
========================================================= */

/* Always allow the page to scroll naturally on desktop. */
html {
    overflow-y: scroll;
}

body {
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

.auth-page {
    min-height: 100dvh;
    height: auto;
    overflow: visible;
}

/* Keep the brand in the top-left, but make it more refined and
   visually aligned with the authentication content. */
.auth-topbar {
    width: min(
        calc(100% - (var(--container-padding) * 2)),
        1180px
    );

    min-height: 7.2rem;
    padding-block: 1rem;
}

.auth-logo img {
    height: 3.2rem;
    width: auto;
    object-fit: contain;
}

/* Start the content naturally instead of vertically centering
   a tall card beyond the viewport. This makes the full card
   reachable by normal page scrolling. */
.auth-section {
    flex: none;
    align-items: flex-start;
    padding-block: 3rem 4.5rem;
}

.auth-layout {
    width: min(
        calc(100% - (var(--container-padding) * 2)),
        1180px
    );

    grid-template-columns: minmax(0, 1fr) minmax(400px, 470px);
    align-items: flex-start;
    gap: clamp(4rem, 6vw, 7.5rem);
}

/* Gives the left content a deliberate visual starting point
   beside the login card rather than pushing it too low. */
.auth-intro {
    padding-top: clamp(3rem, 5vw, 6rem);
}

/* Slightly tighten the card without changing its design. */
.auth-card {
    padding: clamp(2.8rem, 4vw, 3.6rem);
}

/* Django/server-side form messages. */
.auth-message.is-error {
    color: var(--error);
    background: rgba(224, 49, 49, 0.07);
}

.auth-message.is-success {
    color: var(--brand-accent-dark);
    background: rgba(41, 186, 34, 0.09);
}

/* Keep field errors visible when returned by Django. */
.auth-field.has-error .auth-error:not(:empty) {
    display: block;
}

/* =========================================================
   DESKTOP / LAPTOP
========================================================= */

@media (min-width: 901px) and (max-height: 850px) {

    .auth-topbar {
        min-height: 6.6rem;
        padding-block: 0.7rem;
    }

    .auth-logo img {
        height: 3rem;
    }

    .auth-section {
        padding-block: 2rem 3.5rem;
    }

    .auth-intro {
        padding-top: 2.5rem;
    }

    .auth-intro-badge {
        margin-bottom: 1.5rem;
    }

    .auth-intro h1 {
        margin-bottom: 1.5rem;
    }

    .auth-intro > p {
        margin-bottom: 2.8rem;
    }

    .auth-benefits {
        gap: 1.4rem;
    }

    .auth-card {
        padding: 2.6rem 3rem;
    }

    .auth-header {
        margin-bottom: 2.4rem;
    }

    .auth-form {
        gap: 1.7rem;
    }

    .auth-copyright {
        padding-bottom: 1.8rem;
    }
}

/* =========================================================
   TABLET / MOBILE
   Preserve the existing responsive design.
========================================================= */

@media (max-width: 900px) {

    .auth-section {
        flex: none;
        padding-block: 2.5rem 4rem;
    }

    .auth-layout {
        width: min(
            calc(100% - (var(--container-padding) * 2)),
            520px
        );
        gap: 3rem;
    }

    .auth-intro {
        padding-top: 0;
    }
}

@media (max-width: 600px) {

    .auth-topbar {
        min-height: 6.4rem;
        padding-block: 0.5rem;
    }

    .auth-logo img {
        height: 3.2rem;
    }

    .auth-section {
        padding-block: 2.5rem 3.5rem;
    }
}
