:root {
    --login-bg: #080d16;
    --login-surface: #111b2c;
    --login-input: #1c293e;
    --login-blue: #347ef5;
    --login-cyan: #08bdcf;
    --login-text: #edf5ff;
    --login-muted: #91a4bd;
    --login-border: rgba(56, 189, 248, 0.28);
    --login-transition: 180ms ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--login-bg);
}

body {
    min-width: 320px;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    overflow-x: hidden;
    color: var(--login-text);
    background: var(--login-bg);
    font-family: 'Inter', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--login-cyan);
    outline-offset: 3px;
}

.login-backdrop {
    position: fixed;
    z-index: 0;
    inset: 0;
    background-image:
        linear-gradient(90deg, rgba(3, 10, 22, 0.46) 0%, rgba(3, 10, 22, 0.36) 49%, rgba(3, 10, 22, 0.78) 100%),
        linear-gradient(0deg, rgba(2, 8, 18, 0.24), rgba(2, 8, 18, 0.12)),
        url('../public/assets/images/login-background.webp');
    background-position: center;
    background-size: cover;
    background-repeat: no-repeat;
}

.login-layout {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

.brand-panel {
    display: none;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(42px, 7.5vh, 78px) clamp(28px, 5vw, 88px) 42px clamp(34px, 10.5vw, 184px);
    animation: brand-enter 720ms ease-out both;
    pointer-events: none;
}

.brand-main {
    width: 100%;
    max-width: 360px;
}

.brand-logo,
.card-logo {
    display: block;
    object-fit: cover;
    object-position: center 46%;
}

.brand-logo {
    width: clamp(245px, 22vw, 340px);
    height: clamp(98px, 8.4vw, 136px);
    margin-left: -8px;
    filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.28));
}

.brand-specialty {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 14px;
    color: #a1b2cc;
}

.brand-rule {
    display: block;
    width: 34px;
    height: 2px;
    flex: 0 0 auto;
    background: var(--login-cyan);
    box-shadow: 0 0 14px rgba(8, 189, 207, 0.5);
}

.brand-specialty p {
    margin: 0;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.14em;
    line-height: 1.7;
    text-transform: uppercase;
}

.brand-specialty p span {
    margin: 0 6px;
    color: #6f88a8;
}

.brand-copy {
    margin-top: clamp(30px, 5.4vh, 54px);
}

.brand-copy h1 {
    margin: 0;
    color: #f7faff;
    font-family: 'Manrope', 'Inter', sans-serif;
    font-size: clamp(3.2rem, 4vw, 4.6rem);
    font-weight: 800;
    letter-spacing: -0.065em;
    line-height: 1.02;
}

.brand-copy h1 span {
    color: #12b9ef;
    background: linear-gradient(100deg, #378af8 5%, #04c5e4 95%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-copy > p {
    margin: 15px 0 0;
    color: #9aacc7;
    font-size: clamp(16px, 1.35vw, 20px);
    font-weight: 500;
    line-height: 1.48;
}

.brand-footer {
    color: #859ab8;
    font-size: 11px;
    line-height: 1.8;
}

.brand-footer p {
    margin: 0;
}

.brand-footer a {
    margin-left: 8px;
    color: #eff5ff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.25em;
    text-decoration: none;
    pointer-events: auto;
}

.brand-footer a:hover {
    color: var(--login-cyan);
}

.gestiva-mark {
    margin-right: 3px;
    color: #e9f2ff;
    font-size: 13px;
}

.brand-footer p + p {
    margin-top: 2px;
}

.brand-footer p + p span {
    padding: 0 5px;
}

.auth-panel {
    display: grid;
    width: 100%;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    place-items: center;
    padding: 32px clamp(20px, 4vw, 72px);
}

.login-card {
    width: min(100%, 520px);
    padding: 38px clamp(28px, 3.1vw, 48px) 29px;
    border: 1px solid var(--login-border);
    border-radius: 24px;
    background: rgba(5, 12, 24, 0.86);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.035);
    -webkit-backdrop-filter: blur(22px);
    backdrop-filter: blur(22px);
    animation: card-enter 680ms 80ms ease-out both;
}

.card-header {
    text-align: center;
}

.card-logo {
    width: 190px;
    height: 78px;
    margin: -1px auto 5px;
}

.card-header h2 {
    margin: 0;
    color: #f5f8fd;
    font-family: 'Manrope', 'Inter', sans-serif;
    font-size: clamp(25px, 2vw, 31px);
    font-weight: 800;
    letter-spacing: -0.045em;
    line-height: 1.25;
}

.card-header p {
    margin: 6px 0 0;
    color: var(--login-muted);
    font-size: 15px;
    line-height: 1.55;
}

.access-status {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 11px;
    margin: 20px 0 25px;
    border: 1px solid rgba(8, 189, 207, 0.34);
    border-radius: 999px;
    background: rgba(3, 39, 56, 0.23);
    color: var(--login-cyan);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.access-status > svg.lucide {
    color: #168bf4;
    font-size: 14px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 9px rgba(56, 189, 248, 0.35);
}

.field-group + .field-group {
    margin-top: 19px;
}

.field-group > label {
    display: block;
    margin-bottom: 8px;
    color: #d8e4f4;
    font-size: 14px;
    font-weight: 600;
}

.input-shell {
    display: flex;
    height: 58px;
    align-items: center;
    border: 1px solid rgba(141, 165, 197, 0.2);
    border-radius: 11px;
    background: var(--login-input);
    transition: border-color var(--login-transition), box-shadow var(--login-transition), background var(--login-transition);
}

.input-shell:focus-within {
    border-color: #38bdf8;
    background: #1d2c43;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.12);
}

.input-icon {
    width: 54px;
    flex: 0 0 54px;
    color: #99abc5;
    font-size: 16px;
    text-align: center;
    transition: color var(--login-transition);
}

.input-shell:focus-within .input-icon {
    color: #55bdfa;
}

.input-shell input {
    width: 100%;
    min-width: 0;
    height: 100%;
    padding: 0 12px 0 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--login-text);
    font-size: 14px;
    font-weight: 500;
}

.input-shell input::placeholder {
    color: #8295b1;
    opacity: 1;
}

.input-shell input:focus-visible {
    outline: 0;
}

.input-shell input:-webkit-autofill,
.input-shell input:-webkit-autofill:hover,
.input-shell input:-webkit-autofill:focus,
.input-shell input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 100px var(--login-input) inset;
    -webkit-text-fill-color: var(--login-text);
    caret-color: var(--login-text);
    transition: background-color 5000s ease-in-out 0s;
}

.password-toggle {
    display: grid;
    width: 50px;
    height: 100%;
    flex: 0 0 50px;
    place-items: center;
    border: 0;
    border-radius: 0 10px 10px 0;
    background: transparent;
    color: #96a9c5;
    cursor: pointer;
    font-size: 16px;
    transition: color var(--login-transition), background var(--login-transition);
}

.password-toggle:hover {
    background: rgba(255, 255, 255, 0.035);
    color: #f2f7ff;
}

.password-toggle:focus-visible {
    outline-offset: -5px;
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 19px 0 25px;
}

.remember-option {
    position: relative;
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    gap: 9px;
    color: #c0cde0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    user-select: none;
}

.remember-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.custom-check {
    display: grid;
    width: 21px;
    height: 21px;
    flex: 0 0 21px;
    place-items: center;
    border: 1px solid rgba(155, 177, 205, 0.6);
    border-radius: 5px;
    background: rgba(28, 41, 62, 0.75);
    color: #fff;
    font-size: 12px;
    transition: background var(--login-transition), border-color var(--login-transition), box-shadow var(--login-transition);
}

.custom-check svg.lucide {
    opacity: 0;
    transform: scale(0.75);
    transition: opacity var(--login-transition), transform var(--login-transition);
}

.remember-option input:checked + .custom-check {
    border-color: var(--login-blue);
    background: var(--login-blue);
}

.remember-option input:checked + .custom-check svg.lucide {
    opacity: 1;
    transform: scale(1);
}

.remember-option input:focus-visible + .custom-check {
    outline: 2px solid var(--login-cyan);
    outline-offset: 3px;
}

.remember-option:hover {
    color: #f1f6ff;
}

.btn-login {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 60px;
    align-items: center;
    justify-content: center;
    gap: 12px;
    overflow: hidden;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(100deg, #347ef5 0%, #08bdcf 100%);
    box-shadow: 0 9px 24px rgba(14, 141, 224, 0.17);
    color: #fff;
    cursor: pointer;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    transition: transform var(--login-transition), box-shadow var(--login-transition), filter var(--login-transition), background var(--login-transition);
}

.btn-login::before {
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 18%, rgba(255, 255, 255, 0.15) 50%, transparent 78%);
    content: '';
    opacity: 0;
    transform: translateX(-65%);
    transition: opacity var(--login-transition), transform 360ms ease;
}

.btn-login:hover:not(:disabled) {
    box-shadow: 0 13px 30px rgba(14, 141, 224, 0.3);
    filter: saturate(1.08) brightness(1.04);
    transform: translateY(-2px);
}

.btn-login:hover:not(:disabled)::before {
    opacity: 1;
    transform: translateX(65%);
}

.btn-login:active:not(:disabled) {
    transform: translateY(0);
}

.btn-login:disabled {
    cursor: wait;
}

.button-label,
.button-arrow,
.button-spinner {
    position: relative;
    z-index: 1;
}

.button-arrow {
    font-size: 16px;
    transition: transform var(--login-transition);
}

.btn-login:hover:not(:disabled) .button-arrow {
    transform: translateX(3px);
}

.button-spinner {
    display: none;
    width: 17px;
    height: 17px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
}

.btn-login.is-loading .button-spinner {
    display: inline-block;
    animation: spinner-turn 700ms linear infinite;
}

.btn-login.is-loading .button-arrow {
    display: none;
}

.btn-login.is-success {
    background: linear-gradient(100deg, #059669, #10b981);
    box-shadow: 0 9px 24px rgba(16, 185, 129, 0.2);
}

.error-message {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin-top: 15px;
    padding: 12px 13px;
    border: 1px solid rgba(248, 113, 113, 0.28);
    border-radius: 9px;
    background: rgba(127, 29, 29, 0.2);
    color: #fecaca;
    font-size: 13px;
    line-height: 1.5;
}

.error-message[hidden] {
    display: none;
}

.error-message > svg.lucide {
    padding-top: 2px;
    color: #f87171;
}

.card-footer {
    margin-top: 27px;
    padding-top: 20px;
    border-top: 1px solid rgba(145, 164, 189, 0.16);
    color: #8295b1;
    text-align: center;
}

.card-footer p {
    margin: 0;
    font-size: 10px;
    font-weight: 500;
    line-height: 1.8;
    text-transform: uppercase;
}

.card-footer p + p {
    color: #7185a2;
    text-transform: none;
}

.card-footer p span {
    padding: 0 5px;
}

.card-footer strong {
    color: #c0cee0;
    font-size: 9px;
    letter-spacing: 0.18em;
}

@keyframes brand-enter {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes card-enter {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spinner-turn {
    to { transform: rotate(360deg); }
}

@media (min-width: 1200px) {
    .brand-panel {
        position: absolute;
        inset: 0 auto 0 0;
        z-index: 1;
        display: flex;
        width: 50%;
        min-height: 100%;
        padding: clamp(34px, 7.5vh, 76px) 0 34px clamp(28px, 6vw, 96px);
    }

    .brand-main {
        width: clamp(240px, calc(50vw - 360px), 360px);
        max-width: none;
    }

    .brand-logo {
        width: clamp(225px, 20vw, 310px);
        height: clamp(92px, 8vw, 128px);
    }

    .brand-specialty {
        align-items: flex-start;
        gap: 10px;
        margin-top: 10px;
    }

    .brand-specialty p {
        font-size: 9px;
        letter-spacing: 0.09em;
    }

    .brand-specialty p span {
        margin: 0 3px;
    }

    .brand-copy {
        margin-top: clamp(24px, 4vh, 40px);
    }

    .brand-copy h1 {
        font-size: clamp(2rem, 2.8vw, 2.75rem);
    }

    .brand-copy > p {
        font-size: clamp(15px, 1.05vw, 17px);
    }

    .brand-footer {
        position: absolute;
        bottom: 34px;
        left: clamp(28px, 6vw, 96px);
    }
}

@media (max-width: 1100px) {
    .auth-panel {
        padding-right: 22px;
        padding-left: 22px;
    }

    .login-card {
        padding-right: 28px;
        padding-left: 28px;
    }
}

@media (max-height: 760px) and (min-width: 768px) {
    body {
        overflow-y: auto;
    }

    .login-layout {
        min-height: 760px;
    }

    .brand-panel,
    .auth-panel {
        min-height: 760px;
    }

    .brand-panel {
        padding-top: 34px;
        padding-bottom: 30px;
    }

    .brand-copy {
        margin-top: 28px;
    }

}

@media (max-width: 767px) {
    .login-backdrop {
        background-image:
            linear-gradient(180deg, rgba(3, 10, 22, 0.62), rgba(3, 10, 22, 0.76)),
            url('../public/assets/images/login-background.webp');
        background-position: center;
    }

    .login-layout {
        display: block;
        min-height: 100vh;
        min-height: 100dvh;
    }

    .brand-panel {
        display: none;
    }

    .auth-panel {
        min-height: 100vh;
        min-height: 100dvh;
        padding: 24px 16px;
    }

    .login-card {
        width: min(100%, 520px);
        padding: 29px 25px 24px;
        border-radius: 21px;
    }

    .card-logo {
        width: 174px;
        height: 72px;
        margin-bottom: 3px;
    }

    .card-header h2 {
        font-size: 27px;
    }

    .access-status {
        margin: 19px 0 23px;
    }

    .card-footer {
        margin-top: 23px;
        padding-top: 17px;
    }
}

@media (max-width: 390px) {
    .auth-panel {
        padding: 16px 12px;
    }

    .login-card {
        padding: 25px 19px 21px;
    }

    .card-header p {
        font-size: 14px;
    }

    .access-status {
        min-height: 39px;
        font-size: 10px;
    }

    .form-options {
        margin-top: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
