/* =========================================================================
 *  MTN FWA Business Case — Login Stylesheet
 *  Visual language: dark gradient, teal accent (#0d9488), glassmorphism.
 *  Matches prototype.html header aesthetic.
 *  All DOM ids are owned by auth.js — this file ONLY styles them.
 * ========================================================================= */

/* ----- Reset & Base ---------------------------------------------------- */

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

html, body {
    height: 100%;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ----- Screen-reader only ---------------------------------------------- */

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ----- Login Shell (full-viewport container) --------------------------- */

.login-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;

    /* Deep-space gradient — matches prototype header */
    background: linear-gradient(160deg, #0a0a0b 0%, #111827 40%, #1a1a2e 70%, #0f172a 100%);
    background-attachment: fixed;

    /* Subtle noise texture overlay */
    position: relative;
}

.login-shell::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 20%, rgba(13, 148, 136, 0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(13, 148, 136, 0.04) 0%, transparent 50%);
    pointer-events: none;
}

/* ----- Login Card (glassmorphism) -------------------------------------- */

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2rem;
    border-radius: 1.25rem;

    /* Glass effect */
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;

    color: #e2e8f0;
}

/* ----- Brand Header ---------------------------------------------------- */

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-brand .wordmark {
    font-size: 1.75rem;
    font-weight: 900;
    letter-spacing: -0.02em;
    color: #ffffff;
}

.login-brand .wordmark .product {
    color: #0d9488;
    margin-left: 0.15em;
}

.login-brand .sub {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.35rem;
}

/* ----- Login Steps (transitions) --------------------------------------- */

.login-step {
    animation: fadeSlideIn 0.2s ease-out;
}

.login-step-out {
    animation: fadeSlideOut 0.14s ease-in forwards;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeSlideOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(-6px); }
}

/* ----- Form Inputs ----------------------------------------------------- */

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input-wrap .icon-left {
    position: absolute;
    left: 0.9rem;
    color: rgba(255, 255, 255, 0.35);
    pointer-events: none;
    z-index: 2;
}

.login-field {
    width: 100%;
    padding: 0.8rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.85rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-field::placeholder {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
}

.login-field:focus {
    border-color: #0d9488;
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

.login-field.with-icon-left {
    padding-left: 2.8rem;
}

.login-field.with-icon-right {
    padding-right: 3.8rem;
}

/* ----- Buttons --------------------------------------------------------- */

.login-primary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.75rem 1.2rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #0d9488 0%, #0f766e 100%);
    border: none;
    border-radius: 0.85rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
    outline: none;
}

.login-primary-action:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px -4px rgba(13, 148, 136, 0.45);
}

.login-primary-action:active:not(:disabled) {
    transform: translateY(0);
}

.login-primary-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-primary-action:focus-visible {
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.35);
}

.login-secondary-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    padding: 0.6rem 1rem;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.7rem;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
    outline: none;
}

.login-secondary-action:hover:not(:disabled) {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

.login-secondary-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ----- Messages -------------------------------------------------------- */

.login-message {
    padding: 0.55rem 0.8rem;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 0.6rem;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
}

.login-message.error {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.login-message.notice {
    color: #5eead4;
    background: rgba(13, 148, 136, 0.12);
    border: 1px solid rgba(13, 148, 136, 0.2);
}

/* ----- Help Text ------------------------------------------------------- */

.login-help {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.35);
    font-weight: 400;
    line-height: 1.4;
}

/* ----- Access Request Sidecard ----------------------------------------- */

.login-sidecard {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.55);
}

.login-sidecard .login-field {
    margin-top: 0.75rem;
}

/* ----- Footer ---------------------------------------------------------- */

.login-footer {
    position: relative;
    z-index: 1;
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.68rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 0.04em;
}

.login-footer svg {
    color: rgba(255, 255, 255, 0.2);
}

/* ----- Spinner (used by auth.js lock() / unlock()) --------------------- */

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ----- Responsive (≤640px) --------------------------------------------- */

@media (max-width: 640px) {
    .login-shell {
        padding: 1rem 0.75rem;
        justify-content: flex-start;
        padding-top: 15vh;
    }

    .login-card {
        max-width: 100%;
        padding: 1.75rem 1.25rem;
        border-radius: 1rem;
    }

    .login-brand .wordmark {
        font-size: 1.5rem;
    }
}
