﻿/* ==========================================================================
   Login & Forgot Password pages
   Loaded only by Nav/Login.aspx (APPRREG.Master + tsapprreg.css) and
   Nav/ForgotPassword.aspx (Page.Master + ApprPage.css). Both masters use the
   same header/footer markup, so the overrides below restyle the chrome on
   these two pages only - every other page on those masters is unchanged.
   Self-contained: does not rely on .main-wrapper / .loading-overlay rules
   from the master stylesheet (ApprPage.css has none).
   Depends on AppTheme.css for tokens.
   ========================================================================== */

body {
    /* tsapprreg.css adds 1rem body padding under 480px for Registration - not wanted here */
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    font-family: var(--ds-font);
    line-height: 1.5;
    color: var(--ds-text);
    background: var(--ds-bg);
    -webkit-font-smoothing: antialiased;
}

/* The master's <form> wraps header/main/footer - make it the flex column so
   the footer sits at the bottom of the window on short pages */
body > form {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 100vh;
}

/* --------------------------------------------------------------------------
   Master header -> solid brand bar (#1a237e), white text
   -------------------------------------------------------------------------- */
.header-container {
    position: relative;
    color: var(--ds-on-brand);
    background: var(--ds-brand-bg);
    border-bottom: 0;
    box-shadow: none;
}

.progress-bar-container {
    display: none;
}

.header-content {
    max-width: 1120px;
    padding: var(--ds-space-3) var(--ds-space-5);
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    gap: var(--ds-space-3);
    text-align: left;
}

.logo {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    margin: 0;
    padding: 2px;
    background: #fff;
    border: 0;
    border-radius: 50%;
    box-shadow: none;
    animation: none;
    object-fit: contain;
}

    .logo:hover {
        transform: none;
        box-shadow: none;
    }

.header-text {
    flex-shrink: 1;
    min-width: 0;
    text-align: left;
}

.main-title {
    font-size: var(--ds-text-md);
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.35;
    color: var(--ds-on-brand);
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: currentColor;
    text-shadow: none;
}

.sub-title {
    padding: 0;
    font-size: var(--ds-text-sm);
    font-weight: 400;
    color: var(--ds-on-brand-muted);
    text-shadow: none;
}

/* --------------------------------------------------------------------------
   Master content wrapper -> transparent; the login card is the surface
   -------------------------------------------------------------------------- */
.main-wrapper {
    flex: 1 0 auto;
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: var(--ds-space-7) var(--ds-space-4);
}

.content-container {
    width: 100%;
    max-width: none;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/* --------------------------------------------------------------------------
   Master footer -> solid brand bar (#1a237e), matches the header
   -------------------------------------------------------------------------- */
.footer-container {
    padding: var(--ds-space-5) var(--ds-space-4);
    padding-bottom: calc(var(--ds-space-5) + env(safe-area-inset-bottom, 0px));
    color: var(--ds-on-brand-subtle);
    background: var(--ds-brand-bg);
    border-top: 0;
}

.footer-links {
    flex-direction: row;
    gap: var(--ds-space-1) var(--ds-space-5);
    margin-bottom: var(--ds-space-3);
}

.footer-link {
    min-width: 0;
    padding: var(--ds-space-1) 0;
    font-size: 13px;
    color: var(--ds-on-brand-muted);
}

    .footer-link:hover {
        color: var(--ds-on-brand);
    }

    .footer-link:focus-visible {
        outline: none;
        border-radius: 2px;
        box-shadow: var(--ds-on-brand-focus);
    }

.footer-copyright {
    padding-top: var(--ds-space-3);
    font-size: var(--ds-text-xs);
    color: var(--ds-on-brand-subtle);
    border-top: 1px solid var(--ds-on-brand-border);
}

/* Loading overlay - hidden by default; APPRREG.Master's script shows it on
   submit by setting inline opacity/visibility. Page.Master never shows it. */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    background-color: rgba(244, 246, 249, 0.75);
    backdrop-filter: blur(2px);
    transition: opacity 0.3s, visibility 0.3s;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--ds-border);
    border-top-color: var(--ds-primary);
    border-radius: 50%;
    animation: ds-spin 0.9s linear infinite;
}

@keyframes ds-spin {
    to {
        transform: rotate(360deg);
    }
}

/* --------------------------------------------------------------------------
   Login card
   -------------------------------------------------------------------------- */
.lg-wrap {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

.lg-card {
    padding: var(--ds-space-6);
}

.lg-card__header {
    margin-bottom: var(--ds-space-5);
    text-align: center;
}

.lg-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin: 0 auto var(--ds-space-4);
    font-size: 20px;
    color: var(--ds-primary);
    background: var(--ds-primary-soft);
    border-radius: var(--ds-radius-full);
}

.lg-title {
    margin: 0 0 var(--ds-space-1);
    font-size: var(--ds-text-xl);
    font-weight: 600;
    line-height: 1.3;
    color: var(--ds-text);
}

.lg-subtitle {
    margin: 0;
    font-size: var(--ds-text-sm);
    color: var(--ds-text-muted);
    text-wrap: balance;
}

/* Two-step indicator: 1 Mobile & password -> 2 Verify OTP */
.lg-steps {
    display: flex;
    gap: var(--ds-space-2);
    margin: 0 0 var(--ds-space-5);
    padding: 0;
    list-style: none;
}

.lg-step {
    display: flex;
    flex: 1;
    align-items: center;
    gap: var(--ds-space-2);
    padding-top: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ds-text-subtle);
    border-top: 3px solid var(--ds-border);
}

.lg-step__num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    font-size: var(--ds-text-xs);
    font-weight: 600;
    border: 1px solid var(--ds-border-strong);
    border-radius: var(--ds-radius-full);
}

.lg-step.is-active,
.lg-step.is-done {
    border-top-color: var(--ds-primary);
}

.lg-step.is-active {
    color: var(--ds-text);
}

    .lg-step.is-active .lg-step__num {
        color: #fff;
        background: var(--ds-primary);
        border-color: var(--ds-primary);
    }

.lg-step.is-done {
    color: var(--ds-text-muted);
}

    .lg-step.is-done .lg-step__num {
        color: var(--ds-primary);
        background: var(--ds-primary-soft);
        border-color: var(--ds-primary-soft);
    }

.lg-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--ds-space-2);
    margin: var(--ds-space-1) 0 var(--ds-space-5);
    font-size: var(--ds-text-sm);
}

.lg-action .ds-hint {
    margin-top: var(--ds-space-3);
    text-align: center;
    text-wrap: balance;
}

.lg-back {
    margin-top: var(--ds-space-5);
    padding-top: var(--ds-space-4);
    font-size: var(--ds-text-sm);
    text-align: center;
    border-top: 1px solid var(--ds-border);
}

    .lg-back i {
        margin-right: 6px;
        font-size: var(--ds-text-xs);
    }

/* Forgot Password: mobile input with the Get OTP button beside it.
   After the OTP is sent (--sent) the button turns secondary, acting as "resend",
   so the final Reset Password button is the only primary action. */
.fp-inline {
    display: flex;
    align-items: stretch;
    gap: var(--ds-space-2);
}

    .fp-inline .ds-input-group {
        flex: 1;
        min-width: 0;
    }

    .fp-inline .ds-btn {
        flex-shrink: 0;
        padding: 0 var(--ds-space-4);
    }

.fp-inline--sent .ds-btn {
    color: var(--ds-text);
    background: var(--ds-surface);
    border-color: var(--ds-border-strong);
}

    .fp-inline--sent .ds-btn:hover,
    .fp-inline--sent .ds-btn:active {
        color: var(--ds-text);
        background: var(--ds-bg);
    }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .header-content {
        padding: 10px var(--ds-space-4);
    }

    .main-wrapper {
        padding: var(--ds-space-6) var(--ds-space-4);
    }

    .footer-links {
        flex-direction: row;
    }
}

@media (max-width: 480px) {
    .logo {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
    }

    .main-title {
        font-size: var(--ds-text-sm);
    }

    .main-wrapper {
        padding: var(--ds-space-5) var(--ds-space-3);
    }

    .lg-card {
        padding: var(--ds-space-5) var(--ds-space-4);
    }
}
