/**
 * Centered Login Page Styles
 * Logo top-right with tagline, centered card layout
 * Respects PortalConfig background via portal.css
 */

/* Reset for login page */
.login-page,
.login-page body,
.login-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    position: relative;
}

/* Background layer - inherits from portal.css .bg-login-splash */
.login-background {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Background layer picks up the theme's Page Background so the centered
   layout matches the split layout's `.bg-login-splash` (both driven by
   portal.content_bg_color via portal.css). Fallback matches v5.scss's
   --page-bg default. */
.login-body .login-background {
    background-color: var(--page-bg, #F2F2F2);
}

/* Header - Logo and tagline top-right. Text color follows the theme so the
   tagline stays legible on both light and dark surfaces. */
.login-header {
    position: absolute;
    top: 28px;
    right: 36px;
    text-align: right;
    z-index: 10;
    color: var(--fg-1, #244A5D);
}

.login-logo-wrapper {
    margin-bottom: 8px;
}

.login-logo {
    height: 40px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

.login-tagline {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    opacity: 0.8;
    color: inherit;
    max-width: 280px;
    margin-left: auto;
}

/* Card */
.login-card {
    background: var(--surface, #FFFFFF);
    color: var(--fg-1, #1B1F1E);
    border: 1px solid var(--neutral-250, #E2E8ED);
    border-radius: 16px;
    padding: 40px 48px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 1;
}

.login-title {
    font-weight: 600;
    margin: 0 0 24px 0;
    line-height: 1.3;
}

.login-content {
    margin-bottom: 0;
}

/* Form styling */
.login-card .form-floating {
    margin-bottom: 16px;
}

/* The login fields carry no placeholder, so their .form-floating labels are
   always floated. Let Bootstrap own the "label inside the top of the field"
   geometry (padding / transform) and only theme the cosmetics here, so the
   text inputs and the Domain <select> all render identically. */
.login-card .form-control,
.login-card .form-select {
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-card .form-control:focus,
.login-card .form-select:focus {
    border-color: var(--bs-primary, #008386);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--bs-primary, #008386) 15%, transparent);
    outline: none;
}

/* Floated label color. Bootstrap doesn't set one, so the label inherited a
   color that matched the field/surface background and disappeared. Use a
   muted theme-text tone so it stays legible on light and dark themes. */
.login-card .form-floating > label {
    color: color-mix(in srgb, var(--fg-1, #1B1F1E) 65%, var(--surface, #FFFFFF));
}

/* Nudge the password show/hide eye in from the right border so it isn't
   touching the field edge / rounded corner. */
.login-card .toggle-password {
    padding-right: 2em;
    margin-top: -2.5em;
}

/* Error messages */
.login-card .form-control-feedback {
    margin-top: 4px;
    min-height: 20px;
}

.login-card .form-control-feedback span[data-alert] {
    color: var(--cb-accent, #CF4064);
    font-size: 13px;
}

/* Alert boxes */
.login-card .alert {
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 14px;
}

/* Buttons */
.login-card .btn-primary {
    background: var(--bs-primary, #008386);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.2s ease, transform 0.1s ease;
}

.login-card .btn-primary:hover {
    background: color-mix(in srgb, var(--bs-primary, #008386) 82%, #000);
}

.login-card .btn-primary:active {
    transform: scale(0.98);
}

.login-card .btn-outline-primary {
    border: 1.5px solid var(--bs-primary, #008386);
    color: var(--bs-primary, #008386);
    border-radius: 8px;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    background: transparent;
}

.login-card .btn-outline-primary:hover {
    background: color-mix(in srgb, var(--bs-primary, #008386) 8%, transparent);
    color: color-mix(in srgb, var(--bs-primary, #008386) 85%, var(--fg-1, #1B1F1E));
    border-color: color-mix(in srgb, var(--bs-primary, #008386) 85%, var(--fg-1, #1B1F1E));
}

/* Links */
.login-card .link-secondary {
    color: color-mix(in srgb, var(--fg-1, #1B1F1E) 75%, var(--surface, #FFFFFF)) !important;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

/* Dark theme's default text/surface pair (#C9D1D9 on #21262D) reaches AA
   contrast (4.5:1) at a lower mix % than the light theme's, so give it its
   own weight instead of reusing light mode's higher-contrast %. */
html[data-bs-theme="dark"] .login-card .link-secondary {
    color: color-mix(in srgb, var(--fg-1, #C9D1D9) 65%, var(--surface, #21262D)) !important;
}

.login-card .link-secondary:hover {
    color: var(--bs-primary, #008386);
}

/* Footer actions */
.login-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--neutral-250, #E0E0E0);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: color-mix(in srgb, var(--fg-1, #1B1F1E) 75%, var(--surface, #FFFFFF));
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

html[data-bs-theme="dark"] .back-link {
    color: color-mix(in srgb, var(--fg-1, #C9D1D9) 65%, var(--surface, #21262D));
}

.back-link:hover {
    color: var(--bs-primary, #008386);
}

.back-link svg {
    flex-shrink: 0;
}

/* SSO divider */
.login-card .hrdivider {
    margin: 24px 0;
    position: relative;
}

.login-card .hrdivider hr {
    border: none;
    border-top: 1px solid var(--neutral-250, #E0E0E0);
    margin: 0;
    opacity: 1;
}

.login-card .hrdivider span {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Match the login card surface (override portal.css's content-bg rule,
       which uses !important) so the "or" sits flush on the card. */
    background: var(--surface, #FFFFFF) !important;
    padding: 0 12px;
    text-align: center;
    color: var(--fg-2, #878888);
    font-size: 13px;
    text-transform: lowercase;
}

/* Mobile footer */
.login-mobile-footer {
    display: none;
    margin-top: 32px;
    text-align: center;
    font-size: 13px;
    z-index: 1;
}

.login-mobile-footer .portal-name {
    display: block;
    margin-bottom: 8px;
}

.login-mobile-footer .footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.login-mobile-footer .footer-links a {
    color: inherit;
    text-decoration: none;
}

.login-mobile-footer .footer-links a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .login-container {
        padding: 24px 16px 48px;
        justify-content: flex-start;
        padding-top: 50px;
    }

    .login-header {
        position: static;
        text-align: center;
        margin-bottom: 32px;
    }

    .login-tagline {
        margin-left: auto;
        margin-right: auto;
        text-align: center;
    }

    .login-card {
        padding: 32px 24px;
        border-radius: 12px;
    }


    .login-mobile-footer {
        display: block;
    }
}

/* Token field (MFA) */
.login-card .token {
    margin-top: 8px;
}

/* Admin-only mode warning */
.login-card .text-danger {
    color: var(--cb-accent, #CF4064);
    font-size: 14px;
    margin-bottom: 16px;
}

.login-card .text-danger i {
    margin-right: 8px;
}
