/* =========================================================
   PAPELECTO · LOGIN
   Línea visual unificada con Portal / Facturación / Precios
   ========================================================= */

:root {
    --pap-primary: #577ab4;
    --pap-primary-dark: #47699f;
    --pap-primary-deep: #294d7f;
    --pap-primary-soft: #edf3fb;
    --pap-bg: #f5f7fb;
    --pap-card: #ffffff;
    --pap-text: #183451;
    --pap-muted: #6c7d91;
    --pap-border: #d9e3f0;
    --pap-danger: #bd4a4a;
    --pap-danger-soft: #fff1f1;
    --pap-shadow: 0 18px 50px rgba(43, 67, 98, 0.12);
    --pap-shadow-soft: 0 10px 28px rgba(43, 67, 98, 0.08);
}

* {
    box-sizing: border-box;
}

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

body.login-page {
    margin: 0;
    min-height: 100vh;
    color: var(--pap-text);
    background:
        radial-gradient(circle at 14% 18%, rgba(87, 122, 180, 0.12), transparent 28rem),
        radial-gradient(circle at 88% 84%, rgba(87, 122, 180, 0.08), transparent 25rem),
        var(--pap-bg);
    font-family: "Montserrat", Arial, Helvetica, sans-serif;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

button,
input {
    font: inherit;
}

button {
    -webkit-tap-highlight-color: transparent;
}

/* ---------- Header ---------- */
.login-header {
    position: relative;
    z-index: 10;
    width: 100%;
    min-height: 106px;
    padding: 20px max(24px, env(safe-area-inset-right)) 20px max(24px, env(safe-area-inset-left));
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--pap-primary-dark), var(--pap-primary));
    border-radius: 0 0 26px 26px;
    box-shadow: 0 8px 26px rgba(50, 78, 116, 0.18);
}

.login-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    text-decoration: none;
}

.login-brand img {
    display: block;
    width: auto;
    height: auto;
    max-width: 230px;
    max-height: 64px;
    object-fit: contain;
    filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.08));
}

/* ---------- Layout ---------- */
.login-main {
    min-height: calc(100vh - 106px);
    padding: 46px 24px 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-shell {
    width: min(960px, 100%);
    display: grid;
    grid-template-columns: minmax(0, 0.92fr) minmax(390px, 1.08fr);
    gap: 26px;
    align-items: stretch;
}

/* ---------- Left copy ---------- */
.login-copy {
    position: relative;
    overflow: hidden;
    min-height: 475px;
    padding: 48px 42px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid rgba(87, 122, 180, 0.17);
    border-radius: 24px;
    background:
        linear-gradient(145deg, rgba(255,255,255,0.94), rgba(241,246,252,0.96));
    box-shadow: var(--pap-shadow-soft);
}

.login-copy::before,
.login-copy::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.login-copy::before {
    width: 290px;
    height: 290px;
    right: -120px;
    top: -120px;
    background: rgba(87, 122, 180, 0.08);
}

.login-copy::after {
    width: 180px;
    height: 180px;
    left: -92px;
    bottom: -100px;
    border: 24px solid rgba(87, 122, 180, 0.055);
}

.login-eyebrow {
    position: relative;
    z-index: 1;
    width: max-content;
    margin-bottom: 13px;
    padding: 7px 11px;
    border-radius: 999px;
    background: var(--pap-primary-soft);
    color: var(--pap-primary-deep);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.login-copy h1 {
    position: relative;
    z-index: 1;
    margin: 0 0 13px;
    max-width: 430px;
    color: var(--pap-text);
    font-size: clamp(30px, 4vw, 42px);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -0.035em;
}

.login-copy > p {
    position: relative;
    z-index: 1;
    max-width: 450px;
    margin: 0;
    color: var(--pap-muted);
    font-size: 13px;
    line-height: 1.7;
}

.login-copy-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    margin-top: 34px;
    padding: 16px;
    display: flex;
    gap: 13px;
    align-items: center;
    border: 1px solid var(--pap-border);
    border-radius: 16px;
    background: rgba(255,255,255,0.8);
}

.login-copy-icon {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--pap-primary-soft);
    color: var(--pap-primary);
}

.login-copy-icon svg {
    width: 23px;
    height: 23px;
}

.login-copy-card strong,
.login-copy-card span {
    display: block;
}

.login-copy-card strong {
    margin-bottom: 2px;
    color: var(--pap-text);
    font-size: 12px;
    font-weight: 800;
}

.login-copy-card span {
    color: var(--pap-muted);
    font-size: 10px;
    line-height: 1.45;
}

/* ---------- Login card ---------- */
.login-card {
    min-width: 0;
    padding: 38px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid var(--pap-border);
    border-radius: 24px;
    background: var(--pap-card);
    box-shadow: var(--pap-shadow);
}

.login-card-top {
    margin-bottom: 29px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.login-icon {
    flex: 0 0 auto;
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: var(--pap-primary-soft);
    color: var(--pap-primary);
}

.login-icon svg {
    width: 28px;
    height: 28px;
}

.login-badge {
    display: block;
    margin: 1px 0 7px;
    color: var(--pap-primary);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.login-card h2 {
    margin: 0 0 5px;
    color: var(--pap-text);
    font-size: 25px;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.025em;
}

.login-card-top p {
    margin: 0;
    color: var(--pap-muted);
    font-size: 11px;
    line-height: 1.5;
}

.login-form {
    width: 100%;
}

.field-group {
    margin-bottom: 17px;
}

.field-group label {
    display: block;
    margin: 0 0 7px;
    color: #344b65;
    font-size: 10px;
    font-weight: 800;
}

.input-wrap {
    position: relative;
}

.input-icon {
    position: absolute;
    z-index: 2;
    left: 13px;
    top: 50%;
    width: 20px;
    height: 20px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7a8ba0;
    pointer-events: none;
}

.input-icon svg {
    width: 19px;
    height: 19px;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    display: block;
    width: 100%;
    min-height: 50px;
    margin: 0;
    padding: 12px 44px 12px 43px;
    border: 1px solid #ccd8e6;
    border-radius: 12px;
    outline: none;
    background: #fff;
    color: #223b55;
    font-size: 12px;
    font-weight: 500;
    box-shadow: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.login-form input::placeholder {
    color: #9aa7b7;
    opacity: 1;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    border-color: var(--pap-primary);
    box-shadow: 0 0 0 4px rgba(87, 122, 180, 0.13);
}

.input-wrap:focus-within .input-icon {
    color: var(--pap-primary);
}

.password-toggle {
    position: absolute;
    z-index: 3;
    right: 8px;
    top: 50%;
    width: 36px;
    height: 36px;
    padding: 0;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #7a8ba0;
    cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    background: var(--pap-primary-soft);
    color: var(--pap-primary);
    outline: none;
}

.password-toggle svg {
    width: 19px;
    height: 19px;
}

.login-error {
    display: none;
    margin: -3px 0 15px;
    padding: 11px 12px;
    border: 1px solid rgba(189, 74, 74, 0.16);
    border-radius: 10px;
    background: var(--pap-danger-soft);
    color: var(--pap-danger);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.5;
}

.login-error.is-visible {
    display: block;
}

.login-submit {
    width: 100%;
    min-height: 50px;
    margin-top: 3px;
    padding: 12px 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 0;
    border-radius: 12px;
    background: var(--pap-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    cursor: pointer;
    box-shadow: 0 9px 20px rgba(87, 122, 180, 0.25);
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.login-submit svg {
    width: 18px;
    height: 18px;
    transition: transform 0.15s ease;
}

.login-submit:hover {
    background: var(--pap-primary-dark);
    box-shadow: 0 12px 24px rgba(71, 105, 159, 0.27);
    transform: translateY(-1px);
}

.login-submit:hover svg {
    transform: translateX(2px);
}

.login-submit:active {
    transform: translateY(0);
}

.login-submit:focus-visible {
    outline: 3px solid rgba(87, 122, 180, 0.24);
    outline-offset: 3px;
}

.login-footer-note {
    margin-top: 23px;
    padding-top: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border-top: 1px solid #edf1f6;
    color: #8997a9;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #78a64f;
    box-shadow: 0 0 0 3px rgba(120, 166, 79, 0.12);
}

/* ---------- Tablet ---------- */
@media (max-width: 860px) {
    .login-main {
        align-items: flex-start;
        padding-top: 34px;
    }

    .login-shell {
        grid-template-columns: 1fr;
        width: min(560px, 100%);
        gap: 18px;
    }

    .login-copy {
        min-height: 0;
        padding: 28px 30px;
    }

    .login-copy h1 {
        font-size: 30px;
    }

    .login-copy-card {
        margin-top: 22px;
    }
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
    body.login-page {
        background:
            radial-gradient(circle at 12% 9%, rgba(87, 122, 180, 0.10), transparent 18rem),
            var(--pap-bg);
    }

    .login-header {
        min-height: 82px;
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: 12px;
        border-radius: 0 0 20px 20px;
    }

    .login-brand {
        min-height: 48px;
    }

    .login-brand img {
        max-width: 190px;
        max-height: 50px;
    }

    .login-main {
        min-height: calc(100vh - 82px);
        padding: 24px 13px max(28px, env(safe-area-inset-bottom));
    }

    .login-shell {
        gap: 14px;
    }

    .login-copy {
        padding: 23px 20px;
        border-radius: 18px;
    }

    .login-copy h1 {
        margin-bottom: 8px;
        font-size: 25px;
    }

    .login-copy > p {
        font-size: 11px;
        line-height: 1.6;
    }

    .login-eyebrow {
        margin-bottom: 10px;
        font-size: 8px;
    }

    .login-copy-card {
        display: none;
    }

    .login-card {
        padding: 24px 20px 21px;
        border-radius: 18px;
    }

    .login-card-top {
        margin-bottom: 23px;
        gap: 12px;
    }

    .login-icon {
        width: 47px;
        height: 47px;
        border-radius: 14px;
    }

    .login-icon svg {
        width: 24px;
        height: 24px;
    }

    .login-badge {
        margin-bottom: 5px;
        font-size: 8px;
    }

    .login-card h2 {
        font-size: 21px;
    }

    .login-card-top p {
        font-size: 10px;
    }

    .field-group {
        margin-bottom: 15px;
    }

    .login-form input[type="text"],
    .login-form input[type="password"] {
        min-height: 49px;
        font-size: 16px; /* evita zoom automático en iPhone */
    }

    .login-submit {
        min-height: 50px;
    }

    .login-footer-note {
        margin-top: 18px;
        padding-top: 15px;
    }
}

@media (max-width: 370px) {
    .login-card-top {
        align-items: center;
    }

    .login-card-top p {
        display: none;
    }

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}
