/* ==========================================================================
   LendSwift — Auth screens
   Modernises the existing .login-* markup shared by the user and admin login
   pages, plus the forgot/reset/OTP screens. Square, token-driven, dark-aware.
   ========================================================================== */

.auth-page,
body.auth-body,
body:has(.login-container) {
    background: var(--ls-bg);
    color: var(--ls-text);
}

.login-container,
.login-container * { box-sizing: border-box; }

/* ------------------------------------------------------------- Utility bar */

.auth-utils {
    position: fixed;
    top: var(--ls-space-4);
    right: var(--ls-space-4);
    z-index: var(--ls-z-dropdown);
    display: flex;
    align-items: center;
    gap: var(--ls-space-2);
}

.auth-util-link,
.auth-util-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--ls-space-2);
    height: 38px;
    padding: 0 var(--ls-space-4);
    background: var(--ls-surface);
    border: 1px solid var(--ls-border);
    color: var(--ls-text-secondary);
    font-family: var(--ls-font-sans);
    font-size: var(--ls-text-sm);
    font-weight: 550;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--ls-duration) var(--ls-ease);
}

.auth-util-link:hover,
.auth-util-btn:hover { border-color: var(--ls-brand-600); color: var(--ls-brand-600); }
.auth-util-link i, .auth-util-btn i { font-size: 0.8rem; }

.auth-theme-toggle { width: 38px; height: 38px; }

/* Language panel */

.auth-lang { position: relative; }

.auth-lang-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 290px;
    padding: var(--ls-space-4);
    background: var(--ls-surface);
    border: 1px solid var(--ls-border);
    box-shadow: var(--ls-shadow-xl);
}

.auth-lang-panel[hidden] { display: none; }

.auth-lang-quick { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ls-space-2); }

.auth-lang-quick button {
    padding: 0.45rem 0.6rem;
    background: var(--ls-surface-2);
    border: 1px solid var(--ls-border);
    color: var(--ls-text-secondary);
    font-family: var(--ls-font-sans);
    font-size: var(--ls-text-xs);
    text-align: left;
    cursor: pointer;
    transition: all var(--ls-duration) var(--ls-ease);
}

.auth-lang-quick button:hover { border-color: var(--ls-brand-600); color: var(--ls-brand-600); background: var(--ls-brand-bg); }

.auth-lang-native { margin-top: var(--ls-space-3); padding-top: var(--ls-space-3); border-top: 1px solid var(--ls-border); }
.auth-lang-native > span { display: block; font-size: var(--ls-text-xs); color: var(--ls-text-muted); margin-bottom: var(--ls-space-2); }
.auth-lang-native .goog-te-gadget { font-size: 0 !important; color: transparent !important; }
.auth-lang-native .goog-te-gadget-simple {
    background: var(--ls-surface-2) !important;
    border: 1px solid var(--ls-border) !important;
    padding: 0.4rem 0.6rem !important;
    font-size: 0.8125rem !important;
    width: 100%;
    display: block !important;
}
.auth-lang-native .goog-te-gadget-simple span { color: var(--ls-text-secondary) !important; border: 0 !important; }
.auth-lang-native .goog-te-gadget-icon { display: none !important; }

/* ------------------------------------------------------------ Split layout */

.login-container {
    display: grid !important;
    grid-template-columns: 1.05fr 1fr;
    min-height: 100vh;
    width: 100%;
    max-width: none !important;
    margin: 0 !important;
    background: var(--ls-bg);
    box-shadow: none !important;
    border: 0 !important;
}

/* The auth pages set `width: 50%` on both panels for their original flex
   layout. Inside the grid above that halves them again, leaving each panel at
   half its column with a gap beside it — so both are forced back to full. */
.login-form-container,
.login-image-container {
    width: 100% !important;
    max-width: none;
    min-width: 0;
    height: 100%;
}

/* Brand panel */

.login-image-container {
    position: relative;
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    gap: var(--ls-space-2);
    padding: clamp(1.25rem, 3.5vw, 3rem);
    background: linear-gradient(150deg, var(--ls-brand-700), var(--ls-brand-900)) !important;
    color: #fff;
    /* Content must never spill past the viewport — that is what was cutting
       the heading off at the top of the panel. */
    max-height: 100vh;
    overflow: hidden;
}

.login-image-container > * { flex: 0 0 auto; }

/* Cap the illustration so text always has room. */
.login-image-container img {
    max-height: 32vh;
    max-width: 70%;
    width: auto;
    height: auto;
    object-fit: contain;
    margin-inline: auto;
}

.login-image-container::after {
    content: '';
    position: absolute;
    top: -25%; right: -18%;
    width: 520px; height: 520px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.12), transparent 62%);
    pointer-events: none;
}

.login-image-container img { opacity: 0.92; position: relative; }
.login-image-container h2,
.login-image-container h3 { color: #fff; position: relative; font-weight: 720; letter-spacing: -0.02em; }
.login-image-container p { color: rgba(255, 255, 255, 0.85); position: relative; line-height: 1.65; }

/* Form panel */

.login-form-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(1.75rem, 5vw, 4rem);
    background: var(--ls-surface);
    overflow-y: auto;
}

/* Keep the form itself readable inside the full-width column. */
.login-form-container > * { width: 100%; max-width: 460px; margin-inline: auto; }

.login-logo { margin-bottom: var(--ls-space-6); }
.login-logo img { max-height: 46px; width: auto; }

.login-header { margin-bottom: var(--ls-space-8); }

.login-header h1,
.login-header h2 {
    margin: 0 0 var(--ls-space-2);
    font-size: clamp(1.6rem, 3.2vw, 2.1rem);
    font-weight: 750;
    letter-spacing: -0.03em;
    color: var(--ls-text);
    line-height: 1.15;
}

.login-header p { margin: 0; color: var(--ls-text-muted); font-size: var(--ls-text-base); line-height: 1.6; }

/* ------------------------------------------------------------------ Fields */

.login-container .form-group { margin-bottom: var(--ls-space-5); }

.login-container label {
    display: block;
    margin-bottom: var(--ls-space-2);
    font-size: var(--ls-text-sm);
    font-weight: 600;
    color: var(--ls-text-secondary);
}

.input-wrapper { position: relative; display: block; }

.input-icon {
    position: absolute;
    left: var(--ls-space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--ls-text-muted);
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 2;
}

.login-container input[type="text"],
.login-container input[type="email"],
.login-container input[type="password"],
.login-container input[type="number"],
.login-container select {
    width: 100%;
    height: 50px;
    padding: 0 var(--ls-space-4) 0 calc(var(--ls-space-4) * 2 + 12px);
    background: var(--ls-surface-2);
    border: 1px solid var(--ls-border-strong);
    color: var(--ls-text);
    font-family: var(--ls-font-sans);
    font-size: var(--ls-text-base);
    transition: border-color var(--ls-duration) var(--ls-ease),
                box-shadow var(--ls-duration) var(--ls-ease),
                background var(--ls-duration) var(--ls-ease);
}

.login-container input:focus,
.login-container select:focus {
    outline: none;
    background: var(--ls-surface);
    border-color: var(--ls-brand-600);
    box-shadow: 0 0 0 3px var(--ls-brand-bg);
}

.login-container input::placeholder { color: var(--ls-text-muted); }

.password-toggle {
    position: absolute;
    right: var(--ls-space-4);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 0;
    color: var(--ls-text-muted);
    cursor: pointer;
    padding: 0;
    z-index: 2;
    height: auto;
}

.password-toggle:hover { color: var(--ls-brand-600); }

.remember-forgot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--ls-space-3);
    margin-bottom: var(--ls-space-6);
}

.remember-me { display: flex; align-items: center; gap: var(--ls-space-2); }
.remember-me label { margin: 0; font-weight: 500; font-size: var(--ls-text-sm); color: var(--ls-text-muted); }
.remember-me input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ls-brand-600); }

.remember-forgot a,
.register-link a {
    color: var(--ls-brand-600);
    font-size: var(--ls-text-sm);
    font-weight: 600;
    text-decoration: none;
}

.remember-forgot a:hover,
.register-link a:hover { text-decoration: underline; }

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

.login-button,
.login-container button[type="submit"],
.login-container .auth-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ls-space-2);
    width: 100%;
    height: 50px;
    padding: 0 var(--ls-space-6);
    background: var(--ls-brand-600);
    border: 0;
    color: #fff;
    font-family: var(--ls-font-sans);
    font-size: var(--ls-text-base);
    font-weight: 650;
    cursor: pointer;
    transition: background var(--ls-duration) var(--ls-ease),
                transform var(--ls-duration) var(--ls-ease),
                box-shadow var(--ls-duration) var(--ls-ease);
}

.login-button:hover,
.login-container button[type="submit"]:hover {
    background: var(--ls-brand-700);
    transform: translateY(-1px);
    box-shadow: var(--ls-shadow-lg);
}

.login-button:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.login-divider {
    display: flex;
    align-items: center;
    gap: var(--ls-space-4);
    margin: var(--ls-space-6) 0;
    color: var(--ls-text-muted);
    font-size: var(--ls-text-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.login-divider::before,
.login-divider::after { content: ''; flex: 1 1 auto; height: 1px; background: var(--ls-border); }

.register-link { text-align: center; font-size: var(--ls-text-sm); color: var(--ls-text-muted); }

/* ------------------------------------------------------------------ Alerts */

.login-container .alert {
    padding: var(--ls-space-4);
    margin-bottom: var(--ls-space-5);
    border-left: 3px solid transparent;
    font-size: var(--ls-text-sm);
    line-height: 1.55;
}

.login-container .alert-danger,
.login-container .alert-error { background: var(--ls-danger-bg); color: var(--ls-danger-fg); border-left-color: var(--ls-danger); }
.login-container .alert-success { background: var(--ls-success-bg); color: var(--ls-success-fg); border-left-color: var(--ls-success); }
.login-container .alert-info { background: var(--ls-info-bg); color: var(--ls-info-fg); border-left-color: var(--ls-info); }
.login-container .alert-warning { background: var(--ls-warning-bg); color: var(--ls-warning-fg); border-left-color: var(--ls-warning); }
.login-container .alert ul { margin: 0; padding-left: 1.1rem; }

/* --------------------------------------------------------------- OTP entry */

.otp-inputs { display: flex; gap: var(--ls-space-3); justify-content: center; margin-bottom: var(--ls-space-6); }

.otp-inputs input {
    width: 54px !important;
    height: 62px;
    padding: 0 !important;
    text-align: center;
    font-size: var(--ls-text-2xl) !important;
    font-weight: 700;
}

/* ------------------------------------------------------------- Responsive */

@media (max-width: 900px) {
    .login-container { grid-template-columns: 1fr; min-height: 100vh; }
    .login-image-container { display: none !important; }
    .login-form-container { justify-content: flex-start; padding-top: calc(var(--ls-space-16) + var(--ls-space-4)); }
}

@media (max-width: 560px) {
    .auth-utils { top: var(--ls-space-3); right: var(--ls-space-3); left: var(--ls-space-3); justify-content: flex-end; }
    .auth-util-link span { display: none; }
    .auth-util-link { padding: 0 var(--ls-space-3); }
    .auth-lang-panel { position: fixed; left: var(--ls-space-3); right: var(--ls-space-3); width: auto; }
    .otp-inputs input { width: 42px !important; height: 52px; font-size: var(--ls-text-xl) !important; }
}
