/* ============================================================
   LOGIN PAGE
   Card with a brand-colored toolbar (language + light/dark switch),
   labelled fields with inline icons, and pill-shaped social buttons.
   Colors come from the skyblue theme variables in site.css, so light
   and dark mode follow data-app-theme set by _LayoutWithouthNavBars.
   ============================================================ */

.login-page .login-box {
    max-width: 440px;
    padding: 1.25rem;
}

.login-shell .login-logo img {
    width: 65px;
}

/* White logo on the dark background, dark logo on the light one. */
.login-shell .login-logo-dark,
[data-app-theme$="-dark"] .login-shell .login-logo-light {
    display: none;
}

[data-app-theme$="-dark"] .login-shell .login-logo-dark {
    display: inline;
}

.login-card {
    background: var(--app-surface);
    color: var(--app-text);
    border: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

/* ---------- Toolbar ---------- */

.login-toolbar {
    background: var(--app-card-header);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.6rem;
}

.login-lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
}

    .login-lang-toggle:hover,
    .login-lang-toggle:focus-visible,
    .login-lang-toggle.show {
        background: rgba(255, 255, 255, 0.18);
        color: #fff;
    }

.login-lang-sep {
    opacity: 0.6;
}

.login-lang-menu .dropdown-item {
    color: var(--app-text) !important;
    font-size: 0.875rem;
}

    .login-lang-menu .dropdown-item.active {
        background: var(--app-brand);
        color: #fff !important;
    }

.login-mode-switch {
    display: inline-flex;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
}

    .login-mode-switch button {
        border: none;
        background: transparent;
        color: rgba(255, 255, 255, 0.85);
        width: 2.1rem;
        height: 1.8rem;
        border-radius: 7px;
        line-height: 1;
    }

        .login-mode-switch button[aria-pressed="true"] {
            background: #fff;
            color: var(--app-card-header);
        }

/* ---------- Body ---------- */

.login-card .login-card-body {
    padding: 1.75rem 1.75rem 1.5rem;
    text-align: left;
}

.login-title {
    font-size: 1.9rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 0.25rem;
    color: var(--app-text);
}

.login-subtitle {
    text-align: center;
    color: var(--app-text-muted);
    margin-bottom: 1.5rem;
}

.login-card .form-label {
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.login-field {
    position: relative;
}

    .login-field .login-field-icon {
        position: absolute;
        left: 0.9rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--app-text-muted);
        pointer-events: none;
    }

    .login-field .form-control {
        padding: 0.7rem 0.9rem 0.7rem 2.6rem;
        border-radius: 10px;
    }

        .login-field .form-control:focus {
            border-color: var(--app-brand);
            box-shadow: 0 0 0 0.2rem rgba(18, 116, 151, 0.2);
        }

    .login-field.has-action .form-control {
        padding-right: 2.9rem;
    }

    .login-field .login-field-action {
        position: absolute;
        right: 0.5rem;
        top: 50%;
        transform: translateY(-50%);
        border: none;
        background: transparent;
        color: var(--app-text-muted);
        padding: 0.25rem 0.45rem;
        font-size: 1.1rem;
        line-height: 1;
    }

        .login-field .login-field-action:hover {
            color: var(--app-text);
        }

.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin: 1rem 0 1.25rem;
    font-size: 0.9rem;
}

    .login-options .form-check {
        margin: 0;
        display: flex;
        align-items: center;
        gap: 0.45rem;
        padding-left: 0;
    }

        .login-options .form-check-input {
            margin: 0;
            float: none;
        }

.login-card a.login-link {
    color: var(--app-text) !important;
    font-weight: 500;
    text-decoration: none !important;
}

    .login-card a.login-link:hover {
        text-decoration: underline !important;
    }

.login-submit {
    width: 100%;
    padding: 0.7rem;
    border: none;
    border-radius: 10px;
    background: var(--app-brand-hover);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 500;
}

    .login-submit:hover,
    .login-submit:focus-visible {
        background: var(--app-brand);
        color: #fff;
    }

.login-legal {
    text-align: center;
    font-size: 0.85rem;
    color: var(--app-text-muted);
    margin: 1rem 0 0;
}

    .login-legal a {
        color: var(--app-text) !important;
        text-decoration: underline !important;
    }

.login-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0 1rem;
    color: var(--app-text-muted);
    font-size: 0.85rem;
    text-transform: lowercase;
}

    .login-divider::before,
    .login-divider::after {
        content: "";
        flex: 1;
        border-top: 1px solid var(--app-border);
    }

.login-social {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 1rem;
    margin-bottom: 0.6rem;
    border: 1px solid var(--app-border);
    border-radius: 999px;
    background: var(--app-surface);
    color: var(--app-text) !important;
    font-weight: 500;
    text-decoration: none !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

    .login-social:hover {
        background: var(--app-surface-alt);
    }

    .login-social svg {
        width: 1.2rem;
        height: 1.2rem;
        flex-shrink: 0;
    }

.login-register {
    text-align: center;
    font-size: 0.9rem;
    margin: 0.75rem 0 0;
}

    .login-register a {
        text-decoration: underline !important;
    }

/* Dark mode: borders on the light theme are near-invisible on the dark surface. */
[data-app-theme$="-dark"] .login-social,
[data-app-theme$="-dark"] .login-field .form-control {
    border-color: rgba(255, 255, 255, 0.18);
}

[data-app-theme$="-dark"] .login-divider::before,
[data-app-theme$="-dark"] .login-divider::after {
    border-top-color: rgba(255, 255, 255, 0.18);
}

/* ============================================================
   PHONES — fit on one screen without vertical scrolling.
   Vertical spacing is tied to the viewport height (--gap), so tall
   phones keep the airy layout and short ones tighten up. 100dvh is
   the visible area between the browser bars; 100vh is not.
   ============================================================ */
@media (max-width: 575.98px) {
    .login-page {
        --gap: clamp(0.35rem, 1.6dvh, 1rem);
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 0.25rem 0.75rem;
        justify-content: safe center;
    }

        /* Keep the translucent frame around the card, with slimmer padding. */
        .login-page .login-box {
            width: 100%;
            max-width: 420px;
            margin: 0;
            padding: calc(var(--gap) * 0.5) 0.6rem;
        }

    .login-shell .login-logo {
        padding-bottom: var(--gap);
    }

        .login-shell .login-logo img {
            width: auto;
            /* ~65px wide at the cap (logo is ~1.16:1). */
            height: clamp(2.5rem, 8dvh, 3.5rem);
        }

    .login-toolbar {
        padding: 0.5rem 0.75rem;
    }

    .login-card .login-card-body {
        padding: calc(var(--gap) * 1.25) 1rem var(--gap);
    }

    .login-title {
        font-size: clamp(1.4rem, 3.6dvh, 1.9rem);
    }

    .login-subtitle {
        margin-bottom: var(--gap);
    }

    .login-card form .mb-3 {
        margin-bottom: calc(var(--gap) * 0.75) !important;
    }

    .login-card .form-label {
        margin-bottom: 0.2rem;
    }

    .login-field .form-control {
        padding-top: clamp(0.4rem, 1.1dvh, 0.7rem);
        padding-bottom: clamp(0.4rem, 1.1dvh, 0.7rem);
    }

    .login-options {
        margin: calc(var(--gap) * 0.75) 0 var(--gap);
    }

    .login-submit {
        padding: clamp(0.45rem, 1.2dvh, 0.7rem);
    }

    .login-legal {
        font-size: 0.78rem;
        margin-top: calc(var(--gap) * 0.75);
    }

    .login-divider {
        margin: calc(var(--gap) * 0.75) 0;
    }

    .login-social {
        padding: clamp(0.35rem, 1dvh, 0.6rem) 1rem;
        margin-bottom: calc(var(--gap) * 0.6);
    }

    .login-register {
        margin-top: calc(var(--gap) * 0.5);
    }

    /* Sponsors: a single compact row under the card instead of 100px circles. */
    .login-page .sponsors-section {
        margin: var(--gap) 0 0 !important;
    }

        .login-page .sponsors-section .h5 {
            font-size: 0.8rem;
            margin-bottom: 0.25rem;
        }

        .login-page .sponsors-section .sponsor-logo {
            margin: 0 0.35rem !important;
        }

            .login-page .sponsors-section .sponsor-logo img {
                width: clamp(2rem, 6dvh, 3.5rem) !important;
                height: clamp(2rem, 6dvh, 3.5rem) !important;
            }
}

/* Hidden by default; the short-phone rules below swap it in. */
.login-social-short {
    display: none;
}

/* Short phones: smaller logo, social buttons side by side. */
@media (max-width: 575.98px) and (max-height: 700px) {
    .login-shell .login-logo img {
        height: clamp(1.75rem, 5dvh, 2.5rem);
    }

    .login-social-group {
        display: flex;
        gap: 0.5rem;
        margin-bottom: calc(var(--gap) * 0.6);
    }

        .login-social-group .login-social {
            margin-bottom: 0;
        }

    .login-social-long {
        display: none;
    }

    .login-social-short {
        display: inline;
    }
}

/* Very short screens (small phones with browser bars showing). */
@media (max-width: 575.98px) and (max-height: 600px) {
    .login-subtitle {
        font-size: 0.85rem;
    }

    .login-card .form-label {
        font-size: 0.85rem;
    }

    .login-page .sponsors-section {
        margin-top: calc(var(--gap) * 0.5) !important;
    }

        .login-page .sponsors-section .h5 {
            font-size: 0.7rem;
            line-height: 1;
            margin-bottom: 0;
        }

        .login-page .sponsors-section .sponsor-logo img {
            width: 1.6rem !important;
            height: 1.6rem !important;
        }
}
