/*
 * Login / authentication screen.
 *
 * Colors come from the theme layer (includes/theme-color.blade.php), so the
 * whole screen follows Settings > Appearance. Everything here uses logical
 * properties so the layout mirrors correctly in RTL.
 */

.auth-page {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    min-block-size: 100vh;
    min-block-size: 100svh;
    background-color: #f0f2f5;
}

/* ---------- Brand panel — map atmosphere ---------- */
.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: clamp(2.5rem, 5vw, 4.5rem);
    overflow: hidden;
    color: var(--primary-contrast, #fff);
    background:
        radial-gradient(ellipse 80% 60% at 70% 20%, rgba(255, 255, 255, 0.14), transparent 55%),
        linear-gradient(160deg, var(--bs-primary) 0%, var(--primary-d15) 55%, var(--primary-d15) 100%);
}

.auth-brand__map {
    position: absolute;
    inset: 0;
    pointer-events: none;
    color: rgba(255, 255, 255, 0.55);
}

/* Lat/long style grid */
.auth-brand__grid {
    position: absolute;
    inset: -10%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 3.5rem 3.5rem;
    mask-image: radial-gradient(ellipse 75% 70% at 55% 40%, #000 20%, transparent 75%);
    animation: auth-grid-drift 28s linear infinite;
}

.auth-brand__route {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    opacity: 0.85;
}

.auth-brand__path {
    stroke-dashoffset: 0;
    animation: auth-route-dash 18s linear infinite;
}

.auth-brand__beacon {
    filter: drop-shadow(0 0 0.5rem rgba(255, 255, 255, 0.55));
}

.auth-brand__pulse {
    opacity: 0.45;
    transform-origin: 460px 70px;
    animation: auth-beacon-pulse 2.4s ease-out infinite;
}

.auth-brand__dot {
    opacity: 0.7;
}

.auth-brand__content {
    position: relative;
    z-index: 1;
    max-inline-size: 28rem;
    animation: auth-rise 0.7s ease-out both;
}

.auth-brand__logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-block-end: 1.25rem;
}

.auth-brand__logo img {
    inline-size: 3.75rem;
    block-size: 3.75rem;
    object-fit: contain;
    padding: 0.45rem;
    border-radius: 1rem;
    background-color: rgba(255, 255, 255, 1);
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
}

.auth-brand__name {
    font-size: clamp(2rem, 3.2vw, 2.85rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.auth-brand__tagline {
    margin: 0;
    max-inline-size: 24rem;
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1.65;
    opacity: 0.88;
}

/* ---------- Form side ---------- */
.auth-form {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    background:
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(var(--bs-primary-rgb), 0.06), transparent 55%),
        #f0f2f5;
}

.auth-form__inner {
    inline-size: 100%;
    max-inline-size: 24.5rem;
    animation: auth-rise 0.65s ease-out 0.12s both;
}

/* Shown only when the brand panel is hidden */
.auth-form__logo {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-block-end: 2rem;
}

.auth-form__logo img {
    inline-size: 2.75rem;
    block-size: 2.75rem;
    object-fit: contain;
}

.auth-form__logo span {
    font-size: 1.35rem;
    font-weight: 700;
    color: #2f3a46;
}

.auth-form__title {
    margin-block: 0 0.35rem;
    font-size: clamp(1.55rem, 2.2vw, 1.85rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #2f3a46;
}

.auth-form__subtitle {
    margin-block: 0 1.85rem;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #8592a3;
}

/* The shared form component renders a Bootstrap row; the auth screen is a
   single column, so collapse the gutters it would otherwise add. */
.auth-form .form-layout {
    --bs-gutter-x: 0;
}

.auth-form .form-field-label {
    margin-block-end: 0.4rem;
    font-weight: 600;
    color: #566a7f;
}

.auth-form .form-field .form-control {
    padding-block: 0.75rem;
    border-radius: 0.55rem;
    border-color: #d9dee3;
    background-color: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-form .form-field .form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.18);
}

/* ---------- Password field ---------- */
.auth-password {
    position: relative;
}

.auth-password .form-control {
    /* room for the reveal button, on whichever side the text ends */
    padding-inline-end: 2.75rem;
}

/*
 * Anchored to the top of the wrapper (not centred on it) and given the input's
 * own box height, so it stays aligned with the input when a validation message
 * appears below and grows the wrapper.
 */
.auth-password__toggle {
    position: absolute;
    inset-block-start: 0;
    inset-inline-end: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 2.75rem;
    block-size: calc(1.5em + 1.5rem + 2px); /* mirrors .form-control: line-height + padding-block + border */
    padding: 0;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: #a1acb8;
    font-size: 0.9375rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.auth-password__toggle i {
    font-size: 1.15rem;
}

.auth-password__toggle:hover,
.auth-password__toggle:focus-visible {
    color: var(--bs-primary);
}

.auth-password__toggle:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 0.15rem rgba(var(--bs-primary-rgb), 0.3);
}

/* ---------- Options row & submit ---------- */
.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-block: 1.35rem 1.6rem;
}

/* Flex instead of Bootstrap's float + negative margin, which needs an RTL build to mirror */
.auth-options .form-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    min-block-size: auto;
}

.auth-options .form-check .form-check-input {
    flex-shrink: 0;
    float: none;
    margin: 0;
}

.auth-options .form-check-label {
    font-size: 0.9rem;
    color: #566a7f;
    cursor: pointer;
}

.auth-submit {
    inline-size: 100%;
    padding-block: 0.8rem;
    border-radius: 0.55rem;
    font-size: 1rem;
    font-weight: 600;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.auth-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0.65rem 1.35rem rgba(var(--bs-primary-rgb), 0.32);
}

.auth-submit:active:not(:disabled) {
    transform: translateY(0);
}

.auth-submit:disabled {
    transform: none;
}

.auth-footer {
    margin-block-start: 2.25rem;
    font-size: 0.8125rem;
    text-align: center;
    color: #a1acb8;
}

/* ---------- Motion ---------- */
@keyframes auth-rise {
    from {
        opacity: 0;
        transform: translateY(0.75rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes auth-grid-drift {
    from {
        transform: translate(0, 0);
    }
    to {
        transform: translate(3.5rem, 3.5rem);
    }
}

@keyframes auth-route-dash {
    to {
        stroke-dashoffset: -180;
    }
}

@keyframes auth-beacon-pulse {
    0% {
        opacity: 0.5;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(3.2);
    }
}

/* ---------- Responsive ---------- */
@media (max-width: 991.98px) {
    .auth-page {
        grid-template-columns: 1fr;
        background-color: #f0f2f5;
    }

    .auth-brand {
        display: none;
    }

    .auth-form__logo {
        display: flex;
    }

    .auth-form {
        min-block-size: 100vh;
        min-block-size: 100svh;
        background:
            radial-gradient(ellipse 80% 35% at 50% 0%, rgba(var(--bs-primary-rgb), 0.1), transparent 55%),
            #f0f2f5;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-brand__grid,
    .auth-brand__path,
    .auth-brand__pulse,
    .auth-brand__content,
    .auth-form__inner,
    .auth-submit,
    .auth-password__toggle {
        animation: none;
        transition: none;
    }

    .auth-submit:hover:not(:disabled) {
        transform: none;
    }
}
