/* =========================================================
   VARIABLES
========================================================= */

:root {
    --primary: #a90003;
    --primary-dark: #8a0002;
    --primary-focus: rgba(169, 0, 3, 0.20);

    --secondary: #565e74;

    --on-primary: #ffffff;
    --on-surface: #0b1c30;

    --background: #f8f9ff;
    --surface: #f8f9ff;

    --surface-container-low: #eff4ff;
    --surface-container-lowest: #ffffff;

    --outline: #926f69;
    --outline-variant: #e7bdb6;

    --error: #ba1a1a;
    --error-background: #ffdad6;

    --success: #176b37;
    --success-background: #ddf5e5;

    --margin-mobile: 20px;
    --margin-desktop: 40px;

    --stack-base: 4px;
    --stack-sm: 8px;
    --stack-md: 16px;
    --stack-lg: 32px;

    --touch-target: 48px;
}


/* =========================================================
   RESET
========================================================= */

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

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

html {
    background: var(--background);
}

body {
    min-height: 100vh;
    min-height: 100dvh;

    display: flex;
    flex-direction: column;

    font-family: "Inter", sans-serif;
    color: var(--on-surface);
    background: var(--background);

    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button,
input {
    font: inherit;
}

button,
a,
input,
label {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

.material-symbols-outlined {
    font-variation-settings:
        "FILL" 0,
        "wght" 400,
        "GRAD" 0,
        "opsz" 24;
}


/* =========================================================
   ACCESIBILIDAD
========================================================= */

*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}


/* =========================================================
   HEADER
========================================================= */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;

    width: 100%;
    height: var(--touch-target);

    flex-shrink: 0;

    background: var(--surface);

    box-shadow:
        0 4px 20px rgba(15, 23, 42, 0.05);
}

.topbar__inner {
    width: 100%;
    height: 100%;

    padding: 0 var(--margin-mobile);

    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar__brand {
    display: flex;
    align-items: center;

    gap: 8px;

    color: var(--primary);
}

.topbar__icon {
    font-size: 24px;
}

.topbar__name {
    color: var(--primary);

    font-size: 20px;
    line-height: 28px;

    font-weight: 700;
}


/* =========================================================
   LOGIN BACKGROUND
========================================================= */

.login-page {
    position: relative;

    flex: 1;

    width: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: var(--margin-mobile);

    overflow: hidden;

    background:
        linear-gradient(
            rgba(119, 152, 204, 0.85),
            rgba(6, 18, 35, 0.85)
        ),
        url("/static/images/hero_siderurgica2.0570350f4925.jpg")
        center center / cover no-repeat;
}


/* =========================================================
   CARD
========================================================= */

.login-card {
    position: relative;
    z-index: 1;

    width: 100%;
    max-width: 448px;

    padding: 20px;

    border-radius: 24px;

    background-color: rgba(235, 239, 243, 0.45); 
         


    border: 1px solid rgba(255, 255, 255, 0.10);

    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25);

    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    
}


/* =========================================================
   CARD HEADER
========================================================= */

.login-card__header {
    display: flex;
    flex-direction: column;
    align-items: center;

    margin-bottom: 32px;

    text-align: center;
}

.login-card__logo {
    display: block;

    width: auto;
    height: 64px;

    margin-bottom: 16px;

    object-fit: contain;
}

.login-card__title {
    margin: 0;

    color: var(--on-surface);

    font-size: 24px;
    line-height: 32px;

    font-weight: 700;

    letter-spacing: -0.01em;
}

.login-card__subtitle {
    margin:
        4px
        0
        0;

    color: var(--secondary);

    font-size: 16px;
    line-height: 24px;

    font-weight: 400;
}


/* =========================================================
   ALERTAS
========================================================= */

.login-alert {
    width: 100%;

    display: flex;
    align-items: center;

    gap: 8px;

    margin-bottom: 16px;

    padding: 11px 12px;

    border-radius: 10px;

    color: #93000a;
    background: rgba(255, 218, 214, 0.80);

    border: 1px solid rgba(186, 26, 26, 0.15);

    font-size: 13px;
    line-height: 18px;

    font-weight: 500;
}

.login-alert__icon {
    flex-shrink: 0;

    font-size: 19px;
}

.login-alert--success {
    color: var(--success);
    background: var(--success-background);

    border-color: rgba(23, 107, 55, 0.16);
}


/* =========================================================
   FORM
========================================================= */

.login-form {
    width: 100%;

    display: flex;
    flex-direction: column;

    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;

    gap: 4px;
}

.form-label {
    color: var(--on-surface);

    font-size: 14px;
    line-height: 20px;

    font-weight: 500;

    letter-spacing: 0.01em;
}


/* =========================================================
   INPUT
========================================================= */

.input-wrapper {
    position: relative;

    width: 100%;
}

.input-icon {
    position: absolute;

    top: 50%;
    left: 12px;

    z-index: 2;

    transform: translateY(-50%);

    color: var(--secondary);

    font-size: 20px;

    pointer-events: none;
}

.form-input {
    display: block;

    width: 100%;
    min-height: 52px;

    padding:
        14px
        12px
        14px
        40px;

    border:
        1px
        solid
        rgba(231, 189, 182, 0.30);

    border-radius: 12px;

    outline: none;

    color: var(--on-surface);

    background:
        rgba(239, 244, 255, 0.50);

    font-size: 16px;
    line-height: 24px;

    font-weight: 400;

    transition:
        border-color 160ms ease,
        background-color 160ms ease,
        box-shadow 160ms ease;
}

.form-input--password {
    padding-right: 48px;
}

.form-input::placeholder {
    color: rgba(86, 94, 116, 0.50);
}

.form-input:hover {
    border-color: rgba(146, 111, 105, 0.35);
}

.form-input:focus {
    border-color: var(--primary);

    background: var(--surface-container-lowest);

    box-shadow:
        0 0 0 3px
        var(--primary-focus);
}


/* =========================================================
   PASSWORD TOGGLE
========================================================= */

.password-toggle {
    position: absolute;

    top: 50%;
    right: 7px;

    width: 38px;
    height: 38px;

    transform: translateY(-50%);

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 0;

    border-radius: 8px;

    color: var(--secondary);
    background: transparent;

    cursor: pointer;

    transition:
        color 150ms ease,
        background-color 150ms ease;
}

.password-toggle:hover {
    color: var(--primary);

    background: rgba(169, 0, 3, 0.05);
}

.password-toggle .material-symbols-outlined {
    font-size: 20px;
}


/* =========================================================
   OPTIONS
========================================================= */

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    margin:
        8px
        0;
}

.remember {
    display: flex;
    align-items: center;

    cursor: pointer;

    flex-shrink: 0;
}

.remember__checkbox {
    width: 16px;
    height: 16px;

    margin: 0;

    accent-color: var(--primary);

    cursor: pointer;
}

.remember__label {
    display: block;

    margin-left: 8px;

    color: var(--secondary);

    font-size: 14px;
    line-height: 20px;

    font-weight: 500;

    letter-spacing: 0.01em;
}

.forgot-password {
    color: var(--primary);

    font-size: 14px;
    line-height: 20px;

    font-weight: 500;

    letter-spacing: 0.01em;

    text-decoration: none;

    text-align: right;

    transition: color 150ms ease;
}

.forgot-password:hover {
    color: #930002;

    text-decoration: underline;
    text-underline-offset: 4px;
}


/* =========================================================
   LOGIN BUTTON
========================================================= */

.login-button {
    position: relative;

    width: 100%;
    min-height: 48px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 8px;

    padding: 0 16px;

    border: 0;

    border-radius: 12px;

    color: var(--on-primary);

    background:
        linear-gradient(
            90deg,
            var(--primary),
            var(--primary-dark)
        );

    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.10),
        0 2px 4px -2px rgba(0, 0, 0, 0.10);

    font-size: 14px;
    line-height: 20px;

    font-weight: 700;

    letter-spacing: 0.01em;

    cursor: pointer;

    transition:
        opacity 160ms ease,
        box-shadow 160ms ease,
        transform 80ms ease;
}

.login-button:hover {
    opacity: 0.95;

    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.14),
        0 4px 6px -4px rgba(0, 0, 0, 0.10);
}

.login-button:active {
    transform: scale(0.98);
}

.login-button:disabled {
    cursor: wait;

    opacity: 0.78;
}

.login-button__icon {
    font-size: 20px;
}


/* =========================================================
   SPINNER
========================================================= */

.login-spinner {
    display: none;

    width: 18px;
    height: 18px;

    border:
        2px
        solid
        rgba(255, 255, 255, 0.35);

    border-top-color: #ffffff;

    border-radius: 50%;

    animation:
        login-spinner-rotation
        700ms
        linear
        infinite;
}

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

.login-button.is-loading .login-spinner {
    display: block;
}

@keyframes login-spinner-rotation {

    from {
        transform: rotate(0);
    }

    to {
        transform: rotate(360deg);
    }

}


/* =========================================================
   AUTH EXTRAS (recuperación de contraseña)
========================================================= */

.login-card__icon-circle {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 56px;
    height: 56px;

    margin-bottom: 16px;

    border-radius: 50%;

    color: var(--primary);
    background: var(--surface-container-low);
}

.login-card__icon-circle .material-symbols-outlined {
    font-size: 30px;
}

.login-card__icon-circle--success {
    color: var(--success);
    background: var(--success-background);
}

.login-card__icon-circle--error {
    color: var(--error);
    background: var(--error-background);
}

.form-hint {
    margin: 4px 0 0;

    color: var(--secondary);

    font-size: 12px;
    line-height: 16px;
}

.field-errors {
    margin: 4px 0 0;
    padding: 0;

    list-style: none;

    color: var(--error);

    font-size: 12px;
    line-height: 16px;
}

.field-errors li + li {
    margin-top: 2px;
}

.login-links {
    display: flex;
    justify-content: center;

    margin-top: 4px;
}


/* =========================================================
   FOOTER
========================================================= */

.footer {
    width: 100%;

    flex-shrink: 0;

    margin-top: auto;

    background: var(--surface);

    border-top:
        1px
        solid
        var(--outline-variant);
}

.footer__inner {
    width: 100%;

    padding:
        16px
        var(--margin-mobile);

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: space-between;

    gap: 8px;
}

.footer__copyright,
.footer__nav a {
    color: var(--secondary);

    font-size: 12px;
    line-height: 16px;

    font-weight: 600;

    letter-spacing: 0.05em;
}

.footer__copyright {
    text-align: center;
}

.footer__nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;

    gap: 16px;
}

.footer__nav a {
    text-decoration: none;

    transition: color 150ms ease;
}

.footer__nav a:hover {
    color: var(--primary);

    text-decoration: underline;
    text-underline-offset: 4px;
}


/* =========================================================
   TABLET / DESKTOP
========================================================= */

@media (min-width: 768px) {

    .topbar__inner {
        padding:
            0
            var(--margin-desktop);
    }

    .topbar__name {
        font-size: 24px;
        line-height: 32px;
    }

    .login-page {
        padding: var(--margin-desktop);
    }

    .login-card {
        padding: 32px;
    }

    .footer__inner {
        padding:
            16px
            var(--margin-desktop);

        flex-direction: row;
    }

    .footer__copyright {
        text-align: left;
    }

}


/* =========================================================
   MÓVILES PEQUEÑOS
========================================================= */

@media (max-width: 480px) {

    .login-page {
        padding:
            16px
            14px;
    }

    .login-card {
        padding: 20px;

        border-radius: 20px;
    }

    .login-card__header {
        margin-bottom: 24px;
    }

    .login-card__logo {
        height: 58px;

        margin-bottom: 14px;
    }

    .login-card__title {
        font-size: 21px;
        line-height: 28px;
    }

    .login-card__subtitle {
        font-size: 15px;
        line-height: 22px;
    }

    .login-options {
        gap: 12px;
    }

    .remember__label,
    .forgot-password {
        font-size: 13px;
        line-height: 18px;
    }

    .footer__inner {
        padding:
            13px
            14px;
    }

}


/* =========================================================
   MÓVILES MUY ESTRECHOS
========================================================= */

@media (max-width: 365px) {

    .topbar__inner {
        padding:
            0
            14px;
    }

    .login-card {
        padding:
            18px
            16px;
    }

    .login-options {
        align-items: flex-start;
        flex-direction: column;

        gap: 8px;
    }

    .forgot-password {
        text-align: left;
    }

    .footer__nav {
        gap:
            8px
            12px;
    }

}


/* =========================================================
   PANTALLAS BAJAS
========================================================= */

@media (max-height: 700px) and (min-width: 481px) {

    .login-page {
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .login-card__header {
        margin-bottom: 22px;
    }

    .login-card__logo {
        height: 54px;
        margin-bottom: 10px;
    }

    .login-form {
        gap: 12px;
    }

}


/* =========================================================
   REDUCIR MOVIMIENTO
========================================================= */

@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;
    }

}
