/**
 * ISP360 NEXA — Portal cliente: login
 * Design system: ui-ux-pro-max (glassmorphism)
 */

.isp-portal-login-page {
    margin: 0;
    min-height: 100dvh;
    background: #0f172a;
    font-family: var(--isp-font, 'Plus Jakarta Sans', system-ui, sans-serif);
    color: #0f172a;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    position: relative;
    overflow-x: hidden;
}

.isp-portal-login-page::before {
    display: none;
}

/* ── Background ── */
.portal-login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.portal-login-bg__image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.04);
    animation: portal-login-kenburns 20s ease-out forwards;
}

.portal-login-bg__overlay {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(15, 23, 42, 0.8) 0%, rgba(15, 23, 42, 0.52) 45%, rgba(15, 23, 42, 0.76) 100%),
        radial-gradient(ellipse 75% 55% at 15% 0%, rgba(37, 99, 235, 0.24) 0%, transparent 55%),
        radial-gradient(ellipse 65% 45% at 90% 100%, rgba(22, 163, 74, 0.12) 0%, transparent 50%);
}

.portal-login-main,
.portal-login-page-footer {
    position: relative;
    z-index: 2;
}

.portal-login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1.5rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
        max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.portal-login-shell {
    width: 100%;
    max-width: 440px;
}

/* ── Card (glass) ── */
.portal-login-card {
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.93);
    backdrop-filter: blur(20px) saturate(1.35);
    -webkit-backdrop-filter: blur(20px) saturate(1.35);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.05),
        0 8px 24px rgba(15, 23, 42, 0.12),
        0 28px 64px rgba(15, 23, 42, 0.18);
    overflow: hidden;
}

.portal-login-card::before {
    content: '';
    display: block;
    height: 4px;
    background: linear-gradient(90deg, #2563eb 0%, #3b82f6 50%, #16a34a 100%);
}

/* ── Brand header ── */
.portal-login-brand {
    padding: 2rem 1.75rem 1.5rem;
    text-align: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.88) 100%);
    border-bottom: 1px solid rgba(226, 232, 240, 0.85);
}

.portal-login-brand img {
    max-height: 56px;
    max-width: 220px;
    width: auto;
    object-fit: contain;
    margin: 0 auto;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(15, 23, 42, 0.08));
}

.portal-login-brand img[data-error] {
    display: none;
}

.portal-login-brand .logo-fallback {
    display: none;
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.02em;
}

.portal-login-brand img[data-error] + .logo-fallback,
.portal-login-brand .logo-fallback.only {
    display: block;
}

.portal-login-empresa {
    margin: 0.65rem 0 0.35rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    letter-spacing: 0.01em;
}

.portal-login-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #2563eb;
    background: rgba(37, 99, 235, 0.1);
    border-radius: 999px;
    border: 1px solid rgba(37, 99, 235, 0.18);
}

.portal-login-badge i {
    font-size: 0.85em;
}

/* ── Card body ── */
.portal-login-body {
    padding: 1.75rem 1.75rem 1.85rem;
}

.portal-login-body h1 {
    font-size: 1.375rem;
    font-weight: 700;
    color: #0f172a;
    text-align: center;
    margin: 0 0 0.4rem;
    letter-spacing: -0.02em;
}

.portal-login-lead {
    font-size: 0.875rem;
    color: #475569;
    text-align: center;
    margin: 0 0 1.5rem;
    line-height: 1.5;
}

.portal-login-body .alert-danger {
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.22);
    background: rgba(254, 242, 242, 0.96);
    color: #b91c1c;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

/* ── Form ── */
.portal-login-form .mb-3 {
    margin-bottom: 1.125rem !important;
}

.portal-login-form .mb-4 {
    margin-bottom: 1.375rem !important;
}

.portal-login-form .form-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 0.4rem;
}

.portal-login-form .form-control {
    padding: 0.65rem 0.9rem;
    font-size: 0.9375rem;
    color: #0f172a;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    min-height: 44px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.portal-login-form .form-control::placeholder {
    color: #94a3b8;
}

.portal-login-form .form-control:hover {
    border-color: #cbd5e1;
    background-color: #fff;
}

.portal-login-form .form-control:focus {
    background-color: #fff;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    outline: none;
}

.portal-login-form .form-control:-webkit-autofill,
.portal-login-form .form-control:-webkit-autofill:hover,
.portal-login-form .form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: #0f172a;
    -webkit-box-shadow: 0 0 0 1000px #f8fafc inset;
    box-shadow: 0 0 0 1000px #f8fafc inset;
    border: 1px solid #2563eb;
    transition: background-color 99999s ease-out;
}

/* ── Remember me ── */
.portal-login-remember {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0;
    padding: 0.7rem 0.8rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.portal-login-remember:hover {
    border-color: #cbd5e1;
    background: #f1f5f9;
}

.portal-login-remember .form-check-input {
    width: 1.0625rem;
    height: 1.0625rem;
    margin: 0.15rem 0 0;
    flex-shrink: 0;
    border: 1.5px solid #cbd5e1;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.portal-login-remember .form-check-input:checked {
    background-color: #2563eb;
    border-color: #2563eb;
}

.portal-login-remember .form-check-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.portal-login-remember .form-check-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
    line-height: 1.45;
    cursor: pointer;
}

/* ── Submit ── */
.portal-login-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 44px;
    margin-top: 0.25rem;
    padding: 0.7rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #fff;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2), 0 4px 14px rgba(37, 99, 235, 0.28);
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.portal-login-submit:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25), 0 8px 22px rgba(37, 99, 235, 0.32);
    color: #fff;
}

.portal-login-submit:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* ── Trust note ── */
.portal-login-trust {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid #f1f5f9;
    text-align: center;
}

.portal-login-trust__text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0;
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.45;
}

.portal-login-trust__text .bi {
    color: #16a34a;
    font-size: 0.9375rem;
    flex-shrink: 0;
}

/* ── Page footer (barra inferior ancho completo) ── */
.portal-login-page-footer {
    flex-shrink: 0;
    width: 100%;
    max-width: none;
    align-self: stretch;
    box-sizing: border-box;
    margin-top: auto;
    padding: 0.75rem 1.25rem max(0.875rem, env(safe-area-inset-bottom));
    text-align: center;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.45) 0%, rgba(15, 23, 42, 0.78) 100%);
    backdrop-filter: blur(18px) saturate(1.15);
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: none;
    color: rgba(248, 250, 252, 0.95);
}

.portal-login-page-footer__brand {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem 0.5rem;
    margin-bottom: 0.35rem;
    font-size: 0.8125rem;
    line-height: 1.4;
}

.portal-login-page-footer__logo {
    object-fit: contain;
    border-radius: 6px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

.portal-login-page-footer__name {
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #f8fafc;
}

.portal-login-page-footer__divider {
    color: rgba(148, 163, 184, 0.9);
}

.portal-login-page-footer__copy {
    color: rgba(226, 232, 240, 0.92);
}

.portal-login-page-footer__tagline {
    margin: 0;
    max-width: 36rem;
    margin-inline: auto;
    font-size: 0.75rem;
    line-height: 1.5;
    color: rgba(203, 213, 225, 0.88);
}

/* ── Motion ── */
@keyframes portal-login-kenburns {
    from { transform: scale(1.04); }
    to   { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .portal-login-bg__image {
        animation: none;
        transform: none;
    }

    .portal-login-form .form-control,
    .portal-login-submit,
    .portal-login-remember,
    .portal-login-remember .form-check-input {
        transition: none;
    }
}

@media (min-width: 480px) {
    .portal-login-body {
        padding: 1.85rem 2rem 2rem;
    }

    .portal-login-brand {
        padding: 2.15rem 2rem 1.6rem;
    }
}

@media (max-width: 576px) {
    .portal-login-bg__overlay {
        background:
            linear-gradient(180deg, rgba(15, 23, 42, 0.84) 0%, rgba(15, 23, 42, 0.6) 100%),
            radial-gradient(ellipse 80% 50% at 50% 0%, rgba(37, 99, 235, 0.2) 0%, transparent 55%);
    }
}
