/* ==========================================================================
   CollabX - Login page
   The desktop layout is a "poster" laid out on the 1672 x 863 design grid of
   the reference mockup. --s is one design pixel, so the whole scene scales
   with the window (height-limited on wide screens, width-limited otherwise).
   ========================================================================== */

/* The shared auth layout centers .app-content; let the stage span the full width */
body.auth-page .app-content {
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.login-stage {
    --stage-h: calc(100vh - var(--header-height, 60px));
    --s: min(calc(var(--stage-h) / 863), calc(100vw / 1672));

    position: relative;
    isolation: isolate;
    flex: 1;
    width: 100%;
    min-height: max(var(--stage-h), 540px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    box-sizing: border-box;
    overflow: hidden;
    background:
        radial-gradient(calc(var(--s) * 520) calc(var(--s) * 420) at 34% 40%, rgba(255, 255, 255, 0.85), transparent 70%),
        radial-gradient(calc(var(--s) * 900) calc(var(--s) * 600) at 8% 0%, rgba(240, 246, 255, 0.95), transparent 70%),
        linear-gradient(180deg, #EAF1FE 0%, #E2EBFD 55%, #DCE6FC 100%);
}

/* --------------------------------------------------------------------------
   Scene artwork
   -------------------------------------------------------------------------- */
.login-desk {
    position: absolute;
    z-index: 0;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--s) * 104);
    background:
        linear-gradient(100deg, transparent 30%, rgba(255, 244, 248, 0.7) 48%, transparent 66%),
        linear-gradient(180deg, #EEF0FD 0%, #E3E8FB 40%, #DAE2F9 100%);
    box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.9);
    pointer-events: none;
}

.login-art,
.login-leaf {
    position: absolute;
    z-index: 1;
    display: block;
    height: auto;
    pointer-events: none;
    user-select: none;
}
.login-art--left  { left: 0;  bottom: 0; width: calc(var(--s) * 622); }
.login-art--right { right: 0; bottom: 0; width: calc(var(--s) * 612); }
.login-leaf       { left: 0;  top: calc(var(--s) * 192); width: calc(var(--s) * 112); opacity: 0.9; }

/* --------------------------------------------------------------------------
   Hero copy (positioned on the design grid)
   -------------------------------------------------------------------------- */
.login-hero {
    position: absolute;
    z-index: 2;
    left: calc(var(--s) * 115);
    top: calc(var(--s) * 70);
}

.login-hero-title {
    margin: 0;
    font-size: max(32px, calc(var(--s) * 60));
    line-height: 0.95;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0B1533;
}
.login-hero-title .accent {
    position: relative;
    display: inline-block;
    color: #1F5EF2;
}
.login-swoosh {
    position: absolute;
    left: 78%;
    bottom: -0.2em;
    width: 66%;
    height: auto;
    color: #2F6BFF;
    opacity: 0.9;
}

.login-hero-sub {
    margin: max(12px, calc(var(--s) * 22)) 0 0;
    max-width: max(250px, calc(var(--s) * 300));
    font-size: max(14px, calc(var(--s) * 19.5));
    line-height: 1.5;
    color: #475569;
}

.login-chips {
    display: grid;
    grid-template-columns: repeat(2, max-content);
    gap: max(10px, calc(var(--s) * 16)) max(12px, calc(var(--s) * 22));
    margin: max(16px, calc(var(--s) * 30)) 0 0 calc(var(--s) * 12);
}
.login-chip {
    display: inline-flex;
    align-items: center;
    gap: max(8px, calc(var(--s) * 12));
    height: max(34px, calc(var(--s) * 48));
    padding: 0 max(12px, calc(var(--s) * 18)) 0 max(6px, calc(var(--s) * 9));
    box-sizing: border-box;
    border-radius: max(10px, calc(var(--s) * 13));
    font-size: max(12px, calc(var(--s) * 15));
    font-weight: 500;
    color: #1E293B;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
    backdrop-filter: blur(6px);
}
.login-chip-icon {
    width: max(24px, calc(var(--s) * 32));
    height: max(24px, calc(var(--s) * 32));
    border-radius: max(7px, calc(var(--s) * 9));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    flex-shrink: 0;
}
.login-chip-icon .material-symbols-outlined { font-size: max(16px, calc(var(--s) * 20)); font-variation-settings: 'FILL' 1, 'wght' 600; }
.login-chip--green  { background: rgba(225, 247, 236, 0.85); }
.login-chip--purple { background: rgba(236, 232, 255, 0.85); }
.login-chip--amber  { background: rgba(255, 243, 222, 0.85); }
.login-chip--rose   { background: rgba(255, 233, 240, 0.85); }
.login-chip--green  .login-chip-icon { background: #22C17A; }
.login-chip--purple .login-chip-icon { background: #7C5CFA; }
.login-chip--amber  .login-chip-icon { background: #F6A623; }
.login-chip--rose   .login-chip-icon { background: #F23E6D; }


/* --------------------------------------------------------------------------
   Sign-in card
   Everything inside is sized in em, so the card scales as one unit with the
   scene (from ~14.5px on small laptops up to 22px on 1440p+ monitors).
   -------------------------------------------------------------------------- */
.login-card {
    position: relative;
    z-index: 3;
    font-size: clamp(14.5px, calc(var(--s) * 16.5), 22px);
    width: min(27.5em, 100%);
    box-sizing: border-box;
    margin-bottom: calc(var(--s) * 56);
    padding: 2.5em 2.375em 1.875em;
    background: #FFFFFF;
    border-radius: 1.5em;
    box-shadow: 0 30px 70px rgba(30, 50, 110, 0.12), 0 2px 6px rgba(15, 23, 42, 0.04);
}
.login-card-title {
    margin: 0;
    text-align: center;
    font-size: 1.75em;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0B1533;
}
.login-card-sub {
    margin: 0.5em 0 1.8em;
    text-align: center;
    font-size: 0.97em;
    color: #475569;
}
.login-alert {
    margin-bottom: 1.125em;
    padding: 0.75em 1em;
    border-radius: 0.625em;
    font-size: 0.875em;
    font-weight: 500;
    background-color: var(--color-danger-bg);
    color: var(--color-danger);
}
.login-success {
    margin-bottom: 1.125em;
    padding: 0.75em 1em;
    border-radius: 0.625em;
    font-size: 0.875em;
    font-weight: 500;
    background: #ECFDF3;
    color: #15803D;
}
.login-field { margin-bottom: 1.25em; }
.login-field label {
    display: block;
    margin-bottom: 0.55em;
    font-size: 0.906em;
    font-weight: 600;
    color: #0B1533;
}
.login-card .form-input,
.login-card input[type="text"],
.login-card input[type="email"],
.login-card input[type="password"] {
    width: 100%;
    height: 3.125em;
    padding: 0 1em;
    font-size: 0.9375em;
    border-radius: 0.625em;
    box-sizing: border-box;
    background-color: #F1F5FE !important;
    border: 1.5px solid #DCE4F5 !important;
    color: #0B1533 !important;
    color-scheme: light !important;
    outline: none;
    transition: all 0.15s ease;
}
.login-card .form-input::placeholder,
.login-card input::placeholder {
    color: #8C9BB4 !important;
    opacity: 1 !important;
}
.login-card .form-input:focus,
.login-card input[type="text"]:focus,
.login-card input[type="email"]:focus,
.login-card input[type="password"]:focus {
    background-color: #FFFFFF !important;
    border-color: #1F5EF2 !important;
    box-shadow: 0 0 0 3px rgba(31, 94, 242, 0.15) !important;
}
/* Ensure browser autofill / password managers do not make inputs dark */
.login-card input:-webkit-autofill,
.login-card input:-webkit-autofill:hover, 
.login-card input:-webkit-autofill:focus,
.login-card input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px #F1F5FE inset !important;
    -webkit-text-fill-color: #0B1533 !important;
    caret-color: #0B1533 !important;
    transition: background-color 5000s ease-in-out 0s;
}
.login-password { position: relative; display: flex; align-items: center; width: 100%; }
.login-password .form-input,
.login-password input[type="password"],
.login-password input[type="text"] { padding-right: 3em !important; }
.login-password button {
    position: absolute;
    right: 0.625em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.375em;
    border: none;
    border-radius: 0.375em;
    background: none;
    color: #334155;
    cursor: pointer;
}
.login-password button:hover {
    color: #1F5EF2;
}
.login-password button .material-symbols-outlined { font-size: 1.375em; pointer-events: none; user-select: none; }
.login-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75em;
    margin: 0.125em 0 1.5em;
}
.login-remember {
    display: inline-flex;
    align-items: center;
    gap: 0.6em;
    cursor: pointer;
    user-select: none;
}
.login-remember input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.2em;
    height: 1.2em;
    margin: 0;
    border: 1.5px solid #CBD5E1;
    border-radius: 0.35em;
    background-color: #FFFFFF;
    cursor: pointer;
    display: grid;
    place-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}
.login-remember input[type="checkbox"]::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
    transform: scale(0);
    transform-origin: bottom left;
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em #FFFFFF;
    background-color: #FFFFFF;
}
.login-remember input[type="checkbox"]:checked {
    background-color: #1F5EF2;
    border-color: #1F5EF2;
}
.login-remember input[type="checkbox"]:checked::before {
    transform: scale(1);
}
.login-remember input[type="checkbox"]:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(31, 94, 242, 0.2);
}
.login-remember label {
    margin: 0;
    font-size: 0.906em;
    font-weight: 500;
    color: #1E293B !important;
    cursor: pointer;
    user-select: none;
}
.login-forgot { font-size: 0.906em; font-weight: 600; color: #1F5EF2 !important; text-decoration: none; }
.login-forgot:hover { text-decoration: underline; }
.login-submit {
    width: 100%;
    height: 3.375em;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.0625em;
    font-weight: 700;
    border-radius: 0.6em;
    background: #1F5EF2;
    color: #FFFFFF !important;
    box-shadow: 0 10px 22px rgba(31, 94, 242, 0.25);
    cursor: pointer;
}
.login-divider {
    display: flex;
    align-items: center;
    gap: 0.875em;
    margin: 1.375em 0 1em;
    font-size: 0.84em;
    color: #64748B;
}
.login-divider::before,
.login-divider::after { content: ""; flex: 1; height: 1px; background: #E5E9F2; }
.login-signup { text-align: center; font-size: 0.97em; color: #334155; }
.login-signup a { color: #1F5EF2; font-weight: 700; text-decoration: none; }

/* --------------------------------------------------------------------------
   Responsive

   1. Poster layout (default): landscape screens wider than 1180px.
   2. Compact poster: landscape 861-1180px - team scene hidden, card on the right.
   3. Stacked layout: phones, portrait tablets and landscape phones -
      headline, chips, card, then the illustration, in one column.
   -------------------------------------------------------------------------- */

/* Short windows (e.g. a maximised browser on a 125%-scaled laptop):
   tighten the card so it sits comfortably inside the scene */
@media (min-width: 861px) and (max-height: 760px) {
    .login-card { padding: 1.9em 2em 1.5em; }
    .login-card-sub { margin-bottom: 1.25em; }
    .login-field { margin-bottom: 0.875em; }
    .login-field label { margin-bottom: 0.4em; }
    .login-card .form-input { height: 2.75em; }
    .login-row { margin-bottom: 1.125em; }
    .login-submit { height: 3em; }
    .login-divider { margin: 1em 0 0.75em; }
}

/* Very short windows: the left illustration would collide with the copy */
@media (min-width: 861px) and (max-height: 600px) {
    .login-art--left,
    .login-leaf { display: none; }
}

/* 2. Compact poster */
@media (max-width: 1180px) {
    .login-art--right { display: none; }
    .login-stage { justify-content: flex-end; padding-right: max(32px, 6vw); }
}

/* 3. Stacked layout */
@media (max-width: 860px),
       (max-width: 1180px) and (orientation: portrait),
       (max-width: 1180px) and (max-height: 500px) {
    .login-stage {
        --art-w: min(calc(100vw - 32px), 620px);
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: clamp(24px, 5vw, 56px) 16px 0;
        background:
            radial-gradient(120vw 60vh at 50% 0%, rgba(255, 255, 255, 0.85), transparent 70%),
            linear-gradient(180deg, #EEF3FF 0%, #E4ECFD 60%, #DCE6FC 100%);
    }

    /* Let the title, subtitle and chips join the column so they can be reordered */
    .login-hero { display: contents; }

    .login-hero-title {
        order: 1;
        text-align: center;
        font-size: clamp(30px, 6.4vw, 56px);
        line-height: 1.05;
    }
    .login-hero-title br,
    .login-swoosh { display: none; }

    .login-hero-sub {
        order: 2;
        max-width: 460px;
        margin: 12px auto 0;
        text-align: center;
        font-size: clamp(15px, 2.1vw, 18px);
    }

    .login-chips {
        order: 3;
        margin: 22px auto 0;
        gap: 10px 12px;
        justify-content: center;
    }
    .login-chip {
        height: 40px;
        gap: 10px;
        padding: 0 16px 0 7px;
        border-radius: 12px;
        font-size: 14px;
    }
    .login-chip-icon { width: 27px; height: 27px; border-radius: 8px; }
    .login-chip-icon .material-symbols-outlined { font-size: 17px; }

    .login-card {
        order: 4;
        font-size: 15.5px;
        width: 100%;
        max-width: 460px;
        margin: 26px 0 0;
        padding: 2.1em 1.75em 1.7em;
    }

    /* Illustration sits on the desk at the bottom of the page */
    .login-art--left {
        order: 6;
        position: relative;
        left: auto;
        bottom: auto;
        width: var(--art-w);
        margin-top: auto;
        padding-top: 28px;
        -webkit-mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
                mask-image: linear-gradient(to right, transparent 0, #000 9%, #000 91%, transparent 100%);
    }
    .login-desk { height: calc(var(--art-w) * 0.15); }
    .login-art--right,
    .login-leaf { display: none; }
}

/* --------------------------------------------------------------------------
   Phones (portrait): app-style screen
   Illustrated header on a soft blue panel, then the form as a white
   bottom sheet that overlaps the art and runs to the bottom of the screen,
   with the four features as small tiles at the end of the sheet.
   -------------------------------------------------------------------------- */
@media (max-width: 599px) and (orientation: portrait) {
    .login-stage {
        padding: 0;
        background:
            radial-gradient(90% 55% at 50% 0%, #FFFFFF 0%, rgba(255, 255, 255, 0) 70%),
            linear-gradient(180deg, #E9F0FF 0%, #DCE7FF 100%);
    }
    .login-desk { display: none; }

    /* Header copy */
    .login-hero-title {
        order: 1;
        margin-top: clamp(18px, 3.5vh, 30px);
        padding: 0 20px;
        font-size: clamp(28px, 8.4vw, 36px);
        line-height: 1.08;
    }
    .login-hero-title .accent { padding-bottom: 0.12em; }
    .login-swoosh {
        display: block;
        left: 8%;
        bottom: -0.12em;
        width: 92%;
    }
    .login-hero-sub {
        order: 2;
        margin: 12px auto 0;
        padding: 0 24px;
        max-width: 360px;
        font-size: 14.5px;
        color: #52607A;
    }

    /* Illustration banner, cropped to the person and laptop */
    .login-art--left {
        order: 3;
        width: 100%;
        max-width: 460px;
        height: clamp(150px, 27vh, 250px);
        margin: 10px auto 0;
        padding: 0;
        object-fit: cover;
        object-position: 50% 30%;
        -webkit-mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%);
                mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%);
    }

    /* Form as a bottom sheet */
    .login-card {
        order: 4;
        width: 100%;
        max-width: none;
        margin: -26px 0 0;
        padding: 26px 22px 6px;
        font-size: 15.5px;
        border-radius: 28px 28px 0 0;
        box-shadow: 0 -14px 34px rgba(30, 50, 110, 0.10);
    }
    .login-card::before {            /* sheet grab handle */
        content: "";
        position: absolute;
        top: 10px;
        left: 50%;
        width: 40px;
        height: 4px;
        margin-left: -20px;
        border-radius: 2px;
        background: #E2E8F3;
    }
    .login-card-title { font-size: 1.6em; }
    .login-card-sub { margin-bottom: 1.4em; }
    .login-card .form-input { height: 3.1em; border-radius: 0.8em; }
    .login-submit { height: 3.3em; border-radius: 0.8em; }
    .login-divider { margin: 1.2em 0 0.9em; }

    /* Feature tiles close the sheet and fill the rest of the screen */
    .login-chips {
        order: 5;
        position: relative;
        z-index: 3;
        flex: 1 0 auto;
        align-content: start;
        width: 100%;
        box-sizing: border-box;
        margin: 0;
        padding: 18px 16px max(26px, env(safe-area-inset-bottom));
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px;
        background: #FFFFFF;
        border-top: 1px solid #EEF1F7;
    }
    .login-chip {
        flex-direction: column;
        justify-content: flex-start;
        gap: 7px;
        height: auto;
        padding: 12px 4px 10px;
        border-radius: 14px;
        font-size: 11.5px;
        font-weight: 600;
        line-height: 1.25;
        text-align: center;
        box-shadow: none;
        backdrop-filter: none;
    }
    .login-chip-icon { width: 32px; height: 32px; border-radius: 10px; }
    .login-chip-icon .material-symbols-outlined { font-size: 18px; }
}

/* Short phones (iPhone SE etc.): drop the subtitle so the Log In button stays on screen */
@media (max-width: 599px) and (orientation: portrait) and (max-height: 800px) {
    .login-hero-sub { display: none; }
    .login-hero-title { margin-top: 14px; font-size: clamp(26px, 7.8vw, 32px); }
    .login-art--left { height: clamp(118px, 20vh, 170px); margin-top: 6px; }
    .login-card { padding-top: 24px; }
    .login-card-sub { margin-bottom: 1em; }
    .login-field { margin-bottom: 0.9em; }
    .login-row { margin-bottom: 1.1em; }
}

/* Very short phones (320x568): keep only a slim slice of the illustration */
@media (max-width: 599px) and (orientation: portrait) and (max-height: 620px) {
    .login-hero-title { margin-top: 10px; font-size: 24px; }
    .login-art--left { height: 96px; object-position: 50% 22%; }
    .login-card-title { font-size: 1.45em; }
}

/* Phones: slimmer page header so the logo and buttons don't collide */
@media (max-width: 599px) {
    body.auth-page .app-header { padding: 0 16px !important; }
}
@media (max-width: 365px) {
    body.auth-page .auth-header-logo .sidebar-logo-text { display: none; }
}

/* Narrow phones */
@media (max-width: 359px) and (orientation: portrait) {
    .login-card { font-size: 15px; padding: 24px 16px 6px; }
    .login-row { gap: 0.5em; }
    .login-chips { padding-left: 10px; padding-right: 10px; gap: 6px; }
    .login-chip { font-size: 10.5px; }
}

/* Landscape phones: there is no room for the illustration */
@media (max-height: 500px) and (orientation: landscape) and (max-width: 1180px) {
    .login-art--left,
    .login-desk { display: none; }
    .login-stage { padding: 20px 16px 28px; }
    .login-hero-title { font-size: clamp(26px, 8vh, 38px); }
    .login-hero-sub { margin-top: 8px; font-size: 14.5px; max-width: 520px; }
    .login-chips { order: 5; margin-top: 22px; }
    .login-card { margin-top: 18px; }
}
