/* =============================================================================
   Login — Sober Centered Design (x99)
   Keeps the sidebar/header visible; only restyles the login form itself to match
   the neutral white-transparent tokens used across invoices/dashboard/cancel.
   ============================================================================= */

/* ─── Break out of the Bootstrap .container width on login pages so the card
   can render at its full designed size regardless of viewport or sidebar. */
body.page-login .main-body > .container,
body.page-password-reset-container .main-body > .container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 24px !important;
    padding-right: 24px !important;
}

/* ─── Wrapper: centers the card in whatever container the layout provides ─── */
.x99-login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    gap: 20px;
    box-sizing: border-box;
    min-height: 80vh;
    width: 100%;
}

/* ─── Card (square) ─── */
.x99-login-card {
    width: 480px;
    height: 480px;
    max-width: 100%;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 18px;
    padding: 44px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    box-sizing: border-box;
}

/* ─── Logo ─── */
.x99-login-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2px;
}
.x99-login-logo .logo,
.x99-login-logo .login-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
}
.x99-login-logo img {
    max-height: 32px;
    max-width: 180px;
    height: auto;
    width: auto;
    opacity: 0.9;
}
.x99-login-logo .logo-text {
    color: rgba(255,255,255,0.9);
    font-size: 20px;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 0.02em;
}

/* ─── Heading ─── */
.x99-login-heading {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}
.x99-login-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: rgba(255,255,255,0.95);
    letter-spacing: -0.015em;
}
.x99-login-subtitle {
    margin: 0;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
    font-weight: 400;
}

/* ─── Alerts / flash messages ─── */
.x99-login-card .alert,
.x99-login-card .alert-lagom {
    background: rgba(239,68,68,0.08) !important;
    border: 1px solid rgba(239,68,68,0.18) !important;
    color: rgba(254,202,202,0.9) !important;
    border-radius: 10px !important;
    padding: 10px 14px !important;
    font-size: 12px !important;
    margin: 0 !important;
    box-shadow: none !important;
}
.x99-login-card .alert-success,
.x99-login-card .alert-lagom.alert-success {
    background: rgba(34,197,94,0.08) !important;
    border-color: rgba(34,197,94,0.18) !important;
    color: rgba(187,247,208,0.9) !important;
}
.x99-login-card .alert-info,
.x99-login-card .alert-lagom.alert-info {
    background: rgba(255,255,255,0.03) !important;
    border-color: rgba(255,255,255,0.1) !important;
    color: rgba(255,255,255,0.75) !important;
}
.x99-login-alerts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ─── Form ─── */
.x99-login-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.x99-login-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 0;
}
.x99-login-field-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: rgba(255,255,255,0.4);
}
.x99-login-forgot {
    font-size: 11px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    transition: color 0.15s ease;
}
.x99-login-forgot:hover,
.x99-login-forgot:focus {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    outline: none;
}

/* Inputs — match the neutral tokens used in x99-inv-balance-btn / dashboard */
.x99-login-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    background: rgba(255,255,255,0.03) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 12px !important;
    color: rgba(255,255,255,0.92) !important;
    font-size: 14px;
    font-weight: 500;
    outline: none !important;
    box-shadow: none !important;
    transition: border-color 0.15s ease, background 0.15s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}
.x99-login-input::placeholder {
    color: rgba(255,255,255,0.25);
    font-weight: 400;
    font-size: 14px;
    letter-spacing: 0;
}
/* Password field uses larger bullet glyphs for the placeholder so the dots are
   legible at the same visual weight as the email placeholder text. */
.x99-login-input--password::placeholder {
    font-size: 18px;
    letter-spacing: 2px;
    color: rgba(255,255,255,0.28);
    line-height: 1;
}
.x99-login-input:hover {
    background: rgba(255,255,255,0.04) !important;
    border-color: rgba(255,255,255,0.14) !important;
}
.x99-login-input:focus {
    background: rgba(255,255,255,0.05) !important;
    border-color: rgba(255,255,255,0.22) !important;
    box-shadow: none !important;
}
/* Autofill — keep the sober look */
.x99-login-input:-webkit-autofill,
.x99-login-input:-webkit-autofill:hover,
.x99-login-input:-webkit-autofill:focus {
    -webkit-text-fill-color: rgba(255,255,255,0.92) !important;
    -webkit-box-shadow: 0 0 0px 1000px rgba(30, 30, 36, 1) inset !important;
    transition: background-color 999999s ease-in-out 0s;
}

/* Remember me */
.x99-login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 0 0;
    font-size: 12px;
    font-weight: 500;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    user-select: none;
}
.x99-login-remember input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 4px;
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    position: relative;
    margin: 0;
    flex-shrink: 0;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.x99-login-remember input[type="checkbox"]:hover {
    border-color: rgba(255,255,255,0.3);
}
.x99-login-remember input[type="checkbox"]:checked {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.35);
}
.x99-login-remember input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 5px;
    width: 3px;
    height: 7px;
    border: solid rgba(255,255,255,0.95);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Captcha */
.x99-login-captcha {
    display: flex;
    justify-content: center;
    margin: 2px 0;
    min-height: 0;
}
.x99-login-captcha > * {
    max-width: 100%;
}

/* Submit button — red primary action */
.x99-login-submit {
    width: 100%;
    height: 50px;
    margin-top: -2px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    background: rgba(239,68,68,0.14);
    border: none;
    border-radius: 12px;
    color: #fca5a5;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.05s ease;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    padding: 0 16px;
    box-sizing: border-box;
}
.x99-login-submit:hover,
.x99-login-submit:focus {
    background: rgba(239,68,68,0.22);
    color: #fecaca;
    outline: none;
}
.x99-login-submit:active {
    transform: translateY(1px);
}
.x99-login-submit:disabled {
    opacity: 0.85;
    cursor: wait;
}
.x99-login-submit-loader {
    display: inline-flex;
    align-items: center;
}
.x99-login-submit-loader.hidden {
    display: none;
}

/* ─── Loading shimmer (on form submit) ─── */
.x99-login-submit.is-loading {
    cursor: wait;
    pointer-events: none;
    color: transparent !important;
    background: rgba(255,255,255,0.05);
    transition: background 0.25s ease, color 0.15s ease;
}
.x99-login-submit.is-loading .x99-login-submit-text,
.x99-login-submit.is-loading .x99-login-submit-loader {
    visibility: hidden;
}
.x99-login-submit.is-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255,255,255,0.06) 35%,
        rgba(255,255,255,0.18) 50%,
        rgba(255,255,255,0.06) 65%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: x99-login-shimmer 2.4s linear infinite;
    pointer-events: none;
}
@keyframes x99-login-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Divider */
.x99-login-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 2px 0;
}
.x99-login-divider-line {
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.06);
}
.x99-login-divider-text {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255,255,255,0.3);
}

/* Linked / social providers */
.x99-login-linked,
.x99-login-social {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.x99-login-linked a,
.x99-login-linked .btn,
.x99-login-social a,
.x99-login-social .btn {
    background: rgba(255,255,255,0.03) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 10px !important;
    color: rgba(255,255,255,0.75) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    padding: 9px 14px !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    transition: background 0.15s ease, border-color 0.15s ease !important;
    box-shadow: none !important;
}
.x99-login-linked a:hover,
.x99-login-linked .btn:hover,
.x99-login-social a:hover,
.x99-login-social .btn:hover {
    background: rgba(255,255,255,0.05) !important;
    border-color: rgba(255,255,255,0.14) !important;
    color: #fff !important;
}

/* Signup line */
.x99-login-signup {
    margin: 0;
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}
.x99-login-signup-link {
    color: #fca5a5;
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
    transition: color 0.15s ease;
}
.x99-login-signup-link:hover,
.x99-login-signup-link:focus {
    color: #fecaca;
    text-decoration: none;
    outline: none;
}

/* Footer under the card */
.x99-login-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
}
.x99-login-footer .login-language,
.x99-login-footer .dropdown {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}
.x99-login-footer .login-language a,
.x99-login-footer .dropdown-toggle {
    color: rgba(255,255,255,0.55) !important;
    text-decoration: none !important;
}
.x99-login-footer .login-language a:hover,
.x99-login-footer .dropdown-toggle:hover {
    color: rgba(255,255,255,0.85) !important;
}
.x99-login-copyright {
    font-size: 11px;
    color: rgba(255,255,255,0.25);
    letter-spacing: 0.02em;
}

/* ─── Neutralise the base .login / .login-wrapper / .login-body wrappers
   (used by the default Lagom layout) so they don't add an extra panel frame. */
body.page-login .login,
body.page-login .login-wrapper,
body.page-login .login-body,
body.page-login .login-header,
body.page-login .login-footer,
body.page-password-reset-container .login,
body.page-password-reset-container .login-wrapper,
body.page-password-reset-container .login-body,
body.page-password-reset-container .login-header,
body.page-password-reset-container .login-footer {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
}
/* If RSThemes uses the "sidebar" login page layout, hide its left info panel
   since we already have the actual navigation sidebar visible. */
body.page-login .main-body-sidebar,
body.page-password-reset-container .main-body-sidebar {
    display: none !important;
}
body.page-login .main-body-has-sidebar,
body.page-login .main-body-has-sidebar-left,
body.page-login .main-body-has-sidebar-right,
body.page-password-reset-container .main-body-has-sidebar,
body.page-password-reset-container .main-body-has-sidebar-left,
body.page-password-reset-container .main-body-has-sidebar-right {
    display: block !important;
}
body.page-login .main-body-content,
body.page-password-reset-container .main-body-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ─── Password reset — extra UI bits ─── */
/* Description line (one-liner under the title) */
.x99-login-desc {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255,255,255,0.5);
    text-align: center;
}

/* Back-to-login link (neutral, paired with signup link) */
.x99-login-back-link {
    color: rgba(255,255,255,0.6);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s ease;
}
.x99-login-back-link:hover,
.x99-login-back-link:focus {
    color: #fff;
    text-decoration: none;
    outline: none;
}

/* Inline message blocks (success confirmation, inline errors) */
.x99-login-message {
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.5;
}
.x99-login-message strong {
    display: block;
    margin-bottom: 4px;
    color: #fff;
    font-weight: 600;
}
.x99-login-message p {
    margin: 0;
    color: inherit;
}
.x99-login-message--success {
    background: rgba(34,197,94,0.08);
    border: 1px solid rgba(34,197,94,0.2);
    color: rgba(187,247,208,0.92);
}
.x99-login-message--error {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    color: rgba(254,202,202,0.92);
}

/* Strength meter label (right-aligned, subtle) */
.x99-login-strength-label {
    font-size: 10px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: rgba(255,255,255,0.45);
}
.x99-login-strength-label #passwordStrengthTextLabel {
    color: inherit;
    font-size: inherit;
}
/* The pwstrength.tpl script also sets an inline color on #passwordStrengthTextLabel;
   we override the dark theme defaults where possible. */
.x99-login-card #passwordStrengthTextLabel[style*="#198810"] { color: rgba(134,239,172,0.9) !important; }
.x99-login-card #passwordStrengthTextLabel[style*="#c59301"] { color: rgba(253,224,71,0.85) !important; }
.x99-login-card #passwordStrengthTextLabel[style*="#be0f1a"] { color: rgba(252,165,165,0.9) !important; }

/* Thin progress bar (stock WHMCS markup) */
.x99-login-card .x99-login-strength-bar,
.x99-login-card .progress {
    height: 4px;
    border-radius: 4px;
    background: rgba(255,255,255,0.06);
    margin-top: 8px;
    overflow: hidden;
    box-shadow: none !important;
}
.x99-login-card .progress-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.2s ease, background 0.2s ease;
    background: rgba(255,255,255,0.15);
}
.x99-login-card .progress-bar-danger  { background: rgba(239,68,68,0.7); }
.x99-login-card .progress-bar-warning { background: rgba(245,158,11,0.7); }
.x99-login-card .progress-bar-success { background: rgba(34,197,94,0.7); }

/* Field validation states (.has-error / .has-success add a border tint) */
.x99-login-field.has-error .x99-login-input {
    border-color: rgba(239,68,68,0.4) !important;
}
.x99-login-field.has-success .x99-login-input {
    border-color: rgba(34,197,94,0.35) !important;
}
.x99-login-field-msg .help-block {
    margin: 6px 0 0;
    font-size: 11px;
    color: rgba(252,165,165,0.9);
}

/* Password generate button (from pwstrength.tpl) — restyle to subtle ghost chip */
.x99-login-card .password-content-group {
    margin-top: 6px;
    display: flex;
    justify-content: flex-end;
}
.x99-login-card .password-content-group .generate-password {
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(255,255,255,0.08) !important;
    border-radius: 8px !important;
    color: rgba(255,255,255,0.65) !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    padding: 6px 10px !important;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    cursor: pointer;
}
.x99-login-card .password-content-group .generate-password:hover {
    background: rgba(255,255,255,0.06) !important;
    border-color: rgba(255,255,255,0.14) !important;
    color: #fff !important;
}
.x99-login-card .password-content-group .generate-password i {
    font-size: 11px;
}

/* Submit variant: <input type="submit"> can't show inner spans; keep text hidden
   via color:transparent during loading (already covered by .is-loading rules). */
.x99-login-submit--input {
    /* input type=submit resets to same tokens as .x99-login-submit (already applied by base selector) */
    text-align: center;
}
.x99-login-submit:disabled:not(.is-loading):not(.x99-login-submit--success) {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Hidden utility (used by the inline pwreset error box toggle) */
.x99-pwreset-error.hidden {
    display: none !important;
}

/* Success state — green button with checkmark, shown after link was sent. */
.x99-login-submit--success {
    background: rgba(34,197,94,0.16) !important;
    color: #86efac !important;
    cursor: default !important;
    opacity: 1 !important;
    pointer-events: none;
    animation: x99-login-success-pop 0.28s ease-out both;
}
.x99-login-submit--success .x99-login-check {
    color: #4ade80;
    flex-shrink: 0;
    animation: x99-login-check-draw 0.35s ease-out 0.05s both;
}
@keyframes x99-login-success-pop {
    0%   { transform: scale(0.96); background: rgba(34,197,94,0.08); }
    60%  { transform: scale(1.01); }
    100% { transform: scale(1); }
}
@keyframes x99-login-check-draw {
    from { opacity: 0; transform: scale(0.4); }
    to   { opacity: 1; transform: scale(1); }
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
    .x99-login-page {
        padding: 24px 12px;
        min-height: 70vh;
    }
    .x99-login-card {
        width: 100%;
        height: auto;
        min-height: 460px;
        padding: 36px 26px;
        border-radius: 14px;
    }
    .x99-login-title {
        font-size: 19px;
    }
}
