/*
 * Login screen: a dark brand panel on the left, the form on the right.
 * Plain CSS because Filament ships pre-built styles. This file is loaded only
 * on the login page (see AdminPanelProvider), so targeting .fi-body is safe.
 */

.fi-body {
    --tf-brand: #b11811;
    --tf-brand-bright: #e3261b;
    --tf-night: #0b0d14;
    --tf-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Layout ---------- */

.fi-body .fi-simple-layout {
    position: relative;
}

.fi-body .fi-simple-main-ctn {
    padding-inline: 1rem;
}

/* The form sits on the page itself instead of in a floating card. */
.fi-body .fi-simple-main {
    max-width: 25rem;
    margin-block: 3rem;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    animation: tf-rise 0.7s var(--tf-ease) both;
}

.fi-body .fi-simple-page-content {
    row-gap: 2rem;
}

/* The logo lives on the brand panel at every size, so Filament's own logo is not needed. */
.fi-body .fi-simple-header .fi-logo {
    display: none;
}

/*
 * Phones and tablets: the brand panel becomes a short dark banner on top,
 * and the form slides up over it as a rounded sheet.
 */
@media (max-width: 1023.98px) {
    .fi-body .fi-simple-layout {
        align-items: stretch;
    }

    /* ".fi-body" in front so these win over the brand-panel rules further down. */
    .fi-body .tf-login-brand {
        min-height: 0;
        padding: 1.5rem 1.5rem 3.5rem;
        gap: 2rem;
    }

    .fi-body .tf-login-brand-glow {
        width: 110%;
        inset: -60% -40% auto auto;
    }

    .fi-body .tf-login-brand-body {
        margin-block: 0;
    }

    .fi-body .tf-login-logo {
        width: min(14rem, 65vw);
        margin-bottom: 0;
    }

    .fi-body .tf-login-logo-link {
        margin-bottom: 0;
    }

    .fi-body .tf-login-brand-title,
    .fi-body .tf-login-brand-list,
    .fi-body .tf-login-brand-footer {
        display: none;
    }

    .fi-body .fi-simple-main-ctn {
        position: relative;
        z-index: 1;
        align-items: flex-start;
        margin-top: -1.75rem;
        padding: 0.5rem 1.5rem 2rem;
        border-radius: 1.75rem 1.75rem 0 0;
        background: var(--tf-sheet);
    }

    .fi-body .fi-simple-main {
        margin-block: 2rem;
    }

    .fi-body .fi-simple-header-heading {
        font-size: 1.625rem;
    }
}

/* Short phones (iPhone SE and smaller): tighten everything so the page fits without scrolling. */
@media (max-width: 1023.98px) and (max-height: 760px) {
    .fi-body .tf-login-brand {
        padding: 1.25rem 1.5rem 2.75rem;
    }

    .fi-body .tf-login-brand-eyebrow {
        display: none;
    }

    .fi-body .tf-login-logo {
        width: min(11rem, 55vw);
    }

    .fi-body .fi-simple-main {
        margin-block: 1.5rem;
    }

    .fi-body .fi-simple-page-content {
        row-gap: 1.5rem;
    }

    .fi-body .fi-simple-header-heading {
        font-size: 1.5rem;
    }
}

@media (max-width: 1023.98px) and (max-height: 620px) {
    .fi-body .fi-simple-header-subheading {
        display: none;
    }

    .fi-body .fi-simple-main {
        margin-block: 1.25rem;
    }

    .fi-body .fi-input-wrp {
        min-height: 2.625rem;
    }

    .fi-body .fi-input {
        padding-block: 0.5rem;
    }
}

@media (min-width: 1024px) {
    .fi-body .fi-simple-layout {
        display: grid;
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
        align-items: stretch;
    }

    .tf-login-brand {
        display: flex;
        grid-column: 1;
        grid-row: 1 / span 10;
    }

    .fi-body .fi-simple-main-ctn {
        grid-column: 2;
        grid-row: 1;
        min-height: 100dvh;
        padding-inline: 3rem;
    }
}

/* ---------- Form header ---------- */

.fi-body .fi-simple-header {
    align-items: flex-start;
    gap: 0.5rem;
}

.fi-body .fi-simple-header-heading {
    text-align: left;
    font-size: 1.875rem;
    line-height: 1.2;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.fi-body .fi-simple-header-subheading {
    text-align: left;
    font-size: 0.9375rem;
    color: var(--gray-500);
}

/* ---------- Fields ---------- */

.fi-body .fi-fo-field-label-content {
    font-weight: 500;
}

.fi-body .fi-input-wrp {
    min-height: 2.875rem;
    border-radius: 0.75rem;
    transition: box-shadow 0.2s var(--tf-ease), background-color 0.2s var(--tf-ease);
}

.fi-body .fi-input-wrp:focus-within {
    --tw-ring-color: var(--tf-brand);
    box-shadow:
        0 0 0 1.5px var(--tf-brand),
        0 0 0 5px color-mix(in oklab, var(--tf-brand) 14%, transparent);
}

.fi-body .fi-input {
    padding-block: 0.75rem;
    font-size: 0.9375rem;
}

.fi-body .fi-checkbox-input:checked {
    background-color: var(--tf-brand);
}

/* ---------- Sign-in button ---------- */

/* Flat, no shadow. Dark "night" like the brand panel; turns light in dark mode. */
.fi-body {
    --tf-btn-bg: var(--tf-night);
    --tf-btn-bg-hover: #2b3040;
    --tf-btn-text: #fff;
    --tf-sheet: var(--gray-50);
}

.dark .fi-body {
    --tf-btn-bg: #e9eaef;
    --tf-btn-bg-hover: #fff;
    --tf-btn-text: var(--tf-night);
    --tf-sheet: var(--gray-950);
}

.fi-body .fi-sc-actions .fi-btn.fi-color-primary {
    min-height: 3rem;
    border-radius: 0.75rem;
    background: var(--tf-btn-bg);
    color: var(--tf-btn-text);
    font-weight: 600;
    letter-spacing: 0.01em;
    box-shadow: none;
    transition: background-color 0.2s var(--tf-ease), transform 0.15s var(--tf-ease);
}

.fi-body .fi-sc-actions .fi-btn.fi-color-primary:hover {
    background: var(--tf-btn-bg-hover);
    color: var(--tf-btn-text);
    box-shadow: none;
}

.fi-body .fi-sc-actions .fi-btn.fi-color-primary:active {
    transform: scale(0.985);
}

.fi-body .fi-sc-actions .fi-btn.fi-color-primary:focus-visible {
    box-shadow: none;
    outline: 2px solid var(--tf-btn-bg);
    outline-offset: 3px;
}

/* ---------- Brand panel ---------- */

.tf-login-brand {
    display: flex;
    position: relative;
    isolation: isolate;
    overflow: hidden;
    flex-direction: column;
    justify-content: space-between;
    min-height: 100dvh;
    padding: 3rem 3.5rem;
    background: var(--tf-night);
    color: #fff;
}

.tf-login-brand-glow {
    position: absolute;
    inset: -20% -30% auto auto;
    z-index: -1;
    width: 75%;
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in oklab, var(--tf-brand-bright) 55%, transparent) 0%, transparent 65%);
    filter: blur(20px);
    animation: tf-drift 14s ease-in-out infinite alternate;
}

.tf-login-brand-grid {
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image:
        linear-gradient(rgb(255 255 255 / 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgb(255 255 255 / 0.05) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse at 30% 60%, #000 10%, transparent 70%);
    mask-image: radial-gradient(ellipse at 30% 60%, #000 10%, transparent 70%);
}

.tf-login-brand-body {
    max-width: 32rem;
    margin-block: auto;
}

/* ---------- Logo: written in, shape by shape ---------- */

.tf-login-logo {
    display: block;
    width: clamp(17rem, 10rem + 11vw, 25rem);
    height: auto;
    margin-bottom: 3rem;
    overflow: visible;
}

.tf-login-logo path {
    stroke: #d4dbe0;
    stroke-width: 0.3;
    stroke-linejoin: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    fill-opacity: 0;
    animation:
        tf-write 1s var(--tf-ease) calc(0.3s + var(--i) * 75ms) forwards,
        tf-fill 0.7s ease-out calc(0.9s + var(--i) * 75ms) forwards;
}

@keyframes tf-write {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes tf-fill {
    to {
        fill-opacity: 1;
        stroke-opacity: 0;
    }
}

.tf-login-logo-link {
    display: inline-block;
    margin-bottom: 3rem;
    border-radius: 0.75rem;
    transition: opacity 0.3s var(--tf-ease);
}

.tf-login-logo-link .tf-login-logo {
    margin-bottom: 0;
}

.tf-login-logo-link:hover {
    opacity: 0.8;
}

.tf-login-logo-link:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 8px;
}

/* Small label in the panel's top-left corner. */
.tf-login-brand-eyebrow {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    border: 1px solid rgb(255 255 255 / 0.14);
    border-radius: 999px;
    background: rgb(255 255 255 / 0.06);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgb(255 255 255 / 0.75);
}

.tf-login-brand-eyebrow::before {
    content: "";
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    background: var(--tf-brand-bright);
    box-shadow: 0 0 10px var(--tf-brand-bright);
}

.tf-login-brand-title {
    margin-top: 0;
    font-size: clamp(2.25rem, 1.4rem + 1.6vw, 3rem);
    line-height: 1.1;
    font-weight: 500;
    letter-spacing: -0.03em;
}

.tf-login-brand-title span {
    color: rgb(255 255 255 / 0.5);
}

.tf-login-brand-list {
    display: grid;
    gap: 1rem;
    margin-top: 2.5rem;
    font-size: 0.9375rem;
    color: rgb(255 255 255 / 0.78);
}

.tf-login-brand-list li {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.tf-login-brand-icon {
    flex-shrink: 0;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0.5rem;
    border: 1px solid rgb(255 255 255 / 0.12);
    border-radius: 0.625rem;
    background: rgb(255 255 255 / 0.05);
    color: #fff;
}

.tf-login-brand-footer {
    font-size: 0.8125rem;
    color: rgb(255 255 255 / 0.4);
}

/* ---------- Motion ---------- */

@keyframes tf-rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

@keyframes tf-drift {
    to {
        transform: translate(-8%, 10%) scale(1.08);
    }
}

@media (prefers-reduced-motion: reduce) {
    .fi-body .fi-simple-main,
    .tf-login-brand-glow {
        animation: none;
    }

    .tf-login-logo path {
        animation: none;
        stroke-opacity: 0;
        fill-opacity: 1;
    }

    .fi-body .fi-sc-actions .fi-btn.fi-color-primary:active {
        transform: none;
    }
}
