:root {
    --bg: #ffffff;
    --text: #1f2a37;
    --muted: #6b7280;
    --border: #e5e7eb;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100svh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 8px;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: url("../img/custom_login_background.jpg") center center / cover no-repeat fixed;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

.login-page {
    position: relative;
    z-index: 1;
    background: transparent;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.62);
    backdrop-filter: blur(10px);
    z-index: 0;
    pointer-events: none;
}


.intro-overlay {
    position: fixed;
    inset: 0;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

body.intro-active .intro-overlay,
body.show-overlay .intro-overlay {
    opacity: 1;
    pointer-events: auto;
}

body.intro-done .intro-overlay {
    opacity: 0;
    pointer-events: none;
}

body.show-overlay .intro-overlay {
    opacity: 1;
    pointer-events: auto;
}

body.fade-out .intro-overlay,
body.fade-out .login-page {
    opacity: 0;
    transition: opacity 3s ease;
}

body.success-active .login-page {
    opacity: 0;
    pointer-events: none;
}

#lottie-intro-container {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    transform: scale(1.15);
}

#lottie-intro-container svg {
    width: 100% !important;
    height: 100% !important;
}

.login-page {
    width: 100%;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    padding-top: 0;
    opacity: 1;
    transition: opacity 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

body.intro-active .login-page {
    opacity: 0;
    pointer-events: none;
}

.login-lottie {
    width: min(92vw, 600px);
    height: min(40svh, 360px);
    aspect-ratio: 1;
    overflow: hidden;
    opacity: 0;
    transform: translateY(0) scale(1.12);
    transition: opacity 1.2s cubic-bezier(0.22, 1, 0.36, 1),
        transform 1.4s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: 0.15s;
    margin-top: 0;
    margin-bottom: -6px;
}

body.intro-done .login-lottie {
    opacity: 1;
    transform: translateY(-6px) scale(1.15);
}

.login-lottie svg {
    width: 100% !important;
    height: 100% !important;
}

.login-form-card {
    width: min(88vw, 420px);
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 14px;
    padding: 6px 10px 6px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 1.1s cubic-bezier(0.22, 1, 0.36, 1),
        transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: 0.35s;
    margin-top: -6px;
}

body.form-visible .login-form-card {
    opacity: 1;
    transform: translateY(0);
}

.login-form-header {
    text-align: center;
    margin-bottom: 4px;
}

.login-form-header h1 {
    font-size: clamp(18px, 2.2vw, 22px);
    margin-bottom: 4px;
}

.login-form-header p {
    color: var(--muted);
    margin-bottom: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
}

.form-actions {
    margin-top: 0;
}

.form-label {
    color: var(--text);
    font-weight: 600;
}

.input-group-text {
    background: #f8fafc;
    border: 1px solid var(--border);
    color: #64748b;
}

.form-control {
    background: #ffffff;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 10px;
}

.form-control:focus {
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.18);
    background: #ffffff;
    color: var(--text);
}

.form-check-label {
    color: var(--muted);
}

.forgot-password-link {
    color: var(--accent);
    text-decoration: none;
    font-size: 0.85rem;
}

.forgot-password-link:hover {
    color: var(--accent-strong);
}

.btn-primary {
    background: var(--accent);
    border: none;
    padding: 8px 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.btn-primary:hover {
    background: var(--accent-strong);
}

.alert {
    font-size: 0.9rem;
}

.distrimayor-logo {
    color: var(--muted);
}

.distrimayor-logo-img {
    height: 24px;
    opacity: 0.9;
}

#lottie-debug {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 20;
    background: rgba(15, 23, 42, 0.92);
    color: #f8fafc;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    letter-spacing: 0.02em;
    min-width: 170px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.3);
}

#lottie-debug strong {
    display: block;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #94a3b8;
    margin-bottom: 6px;
}


@media (max-width: 720px) {
    body {
        padding: 8px;
    }

    .login-lottie {
        width: min(94vw, 520px);
        height: min(38svh, 320px);
        transform: translateY(-2px) scale(1.12);
    }

    .login-form-card {
        width: min(94vw, 400px);
        margin-top: -6px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-height: 700px) {
    .login-lottie {
        width: min(86vw, 520px);
        height: min(36svh, 300px);
    }

    .login-form-card {
        padding: 8px 10px 8px;
    }
}
