/*
========================================
Login page styles
Version 3 (versioned to bust cache)
========================================
*/
[data-page-id="login-login"],
[data-page-id="login-login-username"] {

    /* Fill the available height: logo stays at top, cluster centers, footer at bottom */
    #kc-header + div {
        justify-content: flex-start;
        overflow-y: auto;
        padding-bottom: 2rem;
    }

    #kc-content {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
    }

    #kc-content-wrapper {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
    }

    /* Title is rendered inside the centered cluster; hide the template's empty title */
    #kc-page-title {
        display: none;
    }

    header {
        margin: 0;
    }

    /* Centered main cluster (title + form + buttons) */
    .kc-login-main {
        flex: 1 1 auto;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .kc-login-title {
        text-align: center;
        font-size: 1.5rem;
        font-weight: 600;
        letter-spacing: -0.009rem;
        line-height: 28px;
        margin: 0 0 1.5rem;
    }

    @media (max-width: 480px) {
        .kc-login-title {
            font-size: 1.25rem;
            line-height: 24px;
        }
    }

    /* ========================================
       Social providers (top of form)
       ======================================== */
    #kc-social-providers-top {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 0.25rem;
    }

    .social-signup-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
        height: 2.75rem;
        padding: 0.5rem 1rem;
        border: 1px solid var(--border-01);
        border-radius: 0.5rem;
        background: var(--background);
        font-size: 0.875rem;
        font-weight: 500;
        color: var(--text-primary);
        text-decoration: none;
        cursor: pointer;
        transition: background-color 0.15s ease;
    }

    .social-signup-btn:hover {
        background-color: var(--surface-01);
    }

    .social-signup-btn .social-icon {
        width: 18px;
        height: 18px;
    }

    /* ========================================
       "OR" divider
       ======================================== */
    .login-divider {
        display: flex;
        align-items: center;
        text-align: center;
        margin: 1.25rem 0;
        color: var(--text-faint);
        font-size: 0.8125rem;
    }

    .login-divider::before,
    .login-divider::after {
        content: '';
        flex: 1;
        border-bottom: 1px solid var(--border-01);
    }

    .login-divider span {
        padding: 0 0.75rem;
        white-space: nowrap;
    }

    /* ========================================
       Form options row (Remember me + Forgot password)
       ======================================== */
    div:has(> #kc-form-options) {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        align-items: center;
    }

    /* Right-align the "Forgot password" link */
    div:has(> #kc-form-options) > div:nth-child(2) {
        text-align: right;
    }

    div:has(> #kc-form-options) > div:nth-child(2) a {
        color: var(--primary-400);
        font-size: 0.875rem;
        text-decoration: none;
    }

    div:has(> #kc-form-options) > div:nth-child(2) a:hover {
        text-decoration: underline;
    }

    /* ========================================
       "Don't have an account? Sign up." link
       ======================================== */
    #kc-form-signup-link {
        text-align: center;
        margin-top: 1.25rem;
        font-size: 0.875rem;
        color: var(--text-faint);
    }

    #kc-form-signup-link a {
        color: var(--text-primary);
        font-weight: 500;
        text-decoration: underline;
    }

    /* ========================================
       Download desktop app button
       ======================================== */
    #kc-desktop-download {
        display: flex;
        justify-content: center;
        margin-top: 1.5rem;
    }

    .desktop-download-btn {
        display: inline-flex;
        height: 40px;
        padding: 0 16px;
        justify-content: center;
        align-items: center;
        gap: var(--Spacing-1, 8px);
        border-radius: 10px;
        background: var(--background);
        color: var(--text-primary);
        font-size: 0.875rem;
        font-weight: 500;
        text-decoration: none;
        cursor: pointer;
        box-shadow:
            0 1px 2px 0 rgba(0, 0, 0, 0.05),
            0 0.5px 0 0 rgba(0, 0, 0, 0.08),
            0 0 0 0.5px var(--Colors-Semantic-border-defualt, rgba(39, 39, 42, 0.10));
        transition: background-color 0.15s ease;
    }

    .desktop-download-btn:hover {
        background-color: var(--surface-01);
    }

    .desktop-download-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
    }

    /* OS-aware icon: Apple by default, Windows when detected client-side */
    .desktop-download-icon .os-icon--windows {
        display: none;
    }

    .desktop-download-icon.is-windows .os-icon--mac {
        display: none;
    }

    .desktop-download-icon.is-windows .os-icon--windows {
        display: inline-block;
    }

    /* ========================================
       Terms & Privacy footer
       ======================================== */
    .terms-and-privacy {
        margin-top: 1rem;
        text-align: center;
        font-size: 0.75rem;
        color: var(--text-faint);
        line-height: 1.5;
    }

    .terms-and-privacy a {
        color: var(--primary-400);
    }

    /* ========================================
       Defensive: hide legacy sections if rendered
       ======================================== */
    #kc-social-providers,
    #kc-registration-container {
        display: none;
    }
}
