/* Sign-in choice card.
   Desktop: 480 x 820 design card. Phones (<=520px): fluid card.
   Laptops (1024-1720px): the same 480px design card scaled as a whole with `zoom`. */

.signin-page {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.signin-page::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.62);
}

.signin-glass-filter {
    position: fixed;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* ---------- Overlay ---------- */
.signin-page .auth-page {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    min-height: 0;
    padding: clamp(20px, 5vh, 48px) 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

/* ---------- Card ---------- */
.signin-page .auth-card {
    --card-zoom: 1;
    position: relative;
    margin: auto;
    /* 480px design width, made 1cm narrower on screen (divided by zoom so the 1cm holds on laptops too). */
    width: calc(480px - 1cm / var(--card-zoom));
    max-width: none;
    height: 820px;
    flex-shrink: 0;
    padding: 42px 40px 38px;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 24px;
    background:
        radial-gradient(circle at 0% 0%, rgba(255, 255, 255, 0.34), transparent 34%),
        radial-gradient(circle at 100% 100%, rgba(255, 255, 255, 0.24), transparent 38%),
        linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.035) 48%, rgba(0, 210, 190, 0.04));
    box-shadow: 0 20px 70px rgba(0, 0, 0, 0.42), 0 0 12px rgba(255, 255, 255, 0.72), 0 0 28px rgba(255, 255, 255, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.24);
    animation: signin-border-glow 3.2s ease-in-out infinite;
    backdrop-filter: url("#glass-distortion") blur(26px) saturate(150%);
    -webkit-backdrop-filter: url("#glass-distortion") blur(26px) saturate(150%);
    display: flex;
    flex-direction: column;
    color: #fff;
    text-align: left;
}

.signin-page .auth-card::after {
    content: "";
    position: absolute;
    inset: 1px;
    z-index: -1;
    border-radius: 23px;
    background: rgba(5, 8, 9, 0.14);
}

.signin-stack {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Logo pinned top-left, outside the flow so it doesn't push the centred group down. */
.signin-brand {
    position: absolute;
    top: 24px;
    left: 26px;
    display: flex;
    align-items: center;
}

.signin-logo {
    display: block;
    width: 140px;
}

.signin-logo img {
    display: block;
    width: 140px;
    height: auto;
    object-fit: contain;
}

/* Title, actions and security info: one compact group, centred in the card. */
.signin-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ---------- Header ---------- */
.signin-heading {
    margin: 0 0 26px;
    text-align: center;
}

.signin-kicker {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.62rem;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.signin-page .signin-title {
    margin: 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.4;
}

/* ---------- Views (choice / email) ---------- */
.signin-view {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ---------- Buttons ---------- */
.provider-button,
.email-choice-button,
.email-signin-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: fit-content;
    max-width: 100%;
    min-height: 52px;
    padding: 11px 18px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 45px;
    color: #fff;
    background: rgba(255, 255, 255, 0.11);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
    cursor: pointer;
    font: inherit;
    font-weight: 400;
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.provider-button { font-size: 0.94rem; }
.email-choice-button,
.email-signin-button {
    gap: 11px;
    font-size: 0.9rem;
}

.provider-button:hover,
.email-choice-button:hover,
.email-signin-button:hover {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}

.provider-button:disabled,
.email-signin-button:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

.email-choice-button > i,
.email-signin-button > i {
    font-size: 1.1rem;
}

.provider-mark {
    display: grid;
    grid-template-columns: repeat(2, 7px);
    gap: 2px;
}

.provider-mark i {
    display: block;
    width: 7px;
    height: 7px;
}

.provider-mark i:nth-child(1) { background: #f35325; }
.provider-mark i:nth-child(2) { background: #81bc06; }
.provider-mark i:nth-child(3) { background: #05a6f0; }
.provider-mark i:nth-child(4) { background: #ffba08; }

.signin-page .signin-secured {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    margin: 13px 0 0;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.76rem;
    font-weight: 400;
}

.signin-secured i {
    color: #fff;
    font-size: 0.95rem;
}

.signin-or {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 220px;
    margin-top: 24px;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.75rem;
}

.signin-or::before,
.signin-or::after {
    content: "";
    height: 1px;
    flex: 1;
    background: rgba(255, 255, 255, 0.18);
}

.email-choice-button {
    margin-top: 18px;
}

/* ---------- Email view ---------- */
.signin-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: flex-start;
    margin-bottom: 18px;
    padding: 4px 0;
    border: 0;
    color: rgba(255, 255, 255, 0.72);
    background: none;
    cursor: pointer;
    font: inherit;
    font-size: 0.8rem;
}

.signin-back:hover {
    color: #fff;
}

.signin-back i {
    font-size: 1.1rem;
}

.signin-email-form {
    display: grid;
    gap: 6px;
    width: 100%;
}

.signin-email-form label {
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.8rem;
}

.signin-email-form input {
    width: 100%;
    min-height: 46px;
    box-sizing: border-box;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 12px;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    font: inherit;
    font-size: 0.9rem;
    outline: none;
}

.signin-email-form input:focus {
    border-color: rgba(255, 255, 255, 0.7);
}

.signin-email-form .email-signin-button {
    justify-self: center;
    margin-top: 18px;
}

/* ---------- Home button (styling unchanged) ---------- */
.signin-home {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    align-self: center;
    margin-top: 24px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 13px;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s ease;
}

.signin-home:hover {
    border-color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-2px);
}

.signin-home i {
    display: block;
    font-size: 1.25rem;
    line-height: 1;
    clip-path: inset(0 0 0.14em 0);
}

/* ---------- Bottom security info ---------- */
.signin-trust {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 28px;
    padding: 19px 0 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 400;
}

.signin-trust i {
    margin-right: 5px;
    color: #fff;
}

@keyframes signin-border-glow {
    0%, 100% {
        box-shadow: 0 20px 70px rgba(0, 0, 0, 0.42), 0 0 10px rgba(255, 255, 255, 0.58), 0 0 22px rgba(255, 255, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.24);
    }
    50% {
        box-shadow: 0 20px 70px rgba(0, 0, 0, 0.42), 0 0 16px rgba(255, 255, 255, 0.88), 0 0 36px rgba(255, 255, 255, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.34);
    }
}

@media (prefers-reduced-motion: reduce) {
    .signin-page .auth-card {
        animation: none;
    }
}

/* ---------- Phones (<=520px): fluid card ---------- */
@media (max-width: 520px) {
    .signin-page .auth-page {
        padding: 14px;
    }

    .signin-page .auth-card {
        width: 100%;
        max-width: none;
        height: auto;
        min-height: min(760px, calc(100vh - 28px));
        min-height: min(760px, calc(100dvh - 28px));
        padding: 28px 24px 29px;
        border-radius: 21px;
    }

    .signin-page .auth-card::after {
        border-radius: 20px;
    }

    .signin-brand {
        top: 18px;
        left: 18px;
    }

    .signin-logo,
    .signin-logo img {
        width: 120px;
    }

    .signin-home {
        margin-top: 18px;
    }
}

/* ---------- Laptops: scale the whole 480px design card ----------
   `zoom` scales every length inside the card (type, padding, radii, shadows), so the height is
   divided by the zoom factor to land on a rendered height of (viewport height - 3cm). */
@media (min-width: 1024px) and (max-width: 1289px) {
    .signin-page .auth-card { --card-zoom: 0.65; }
}

@media (min-width: 1290px) and (max-width: 1470px) {
    .signin-page .auth-card { --card-zoom: 0.67; }
}

@media (min-width: 1471px) and (max-width: 1720px) {
    .signin-page .auth-card { --card-zoom: 0.70; }
}

@media (min-width: 1024px) and (max-width: 1720px) {
    .signin-page .auth-card {
        zoom: var(--card-zoom);
        /* Laptops get 0.4cm extra on each side (0.8cm visible in total) on top of the base width. */
        width: calc(480px + (0.8cm - 1cm) / var(--card-zoom));
        height: calc((100vh - 3cm) / var(--card-zoom));
        height: calc((100dvh - 3cm) / var(--card-zoom));
    }
}

/* Wide but short screens (>=1721px wide, <=900px tall): full-size content, card fits the height
   (viewport height - 3cm) and keeps the 480 x 820 design proportions. */
@media (min-width: 1721px) and (max-height: 900px) {
    .signin-page .auth-card {
        height: calc(100vh - 3cm);
        height: calc(100dvh - 3cm);
        width: calc((100vh - 3cm) * 480 / 820);
        width: calc((100dvh - 3cm) * 480 / 820);
    }
}
