/* =========================================
   Variabel warna & dasar tampilan
   ========================================= */
:root {
    --primary: #0b255c;
    --primary-soft: #1f3e90;
    --primary-light: #e6edff;
    --danger: #dc2626;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-soft: #e5e7eb;
    --bg-page: #f3f4f6;
}

html,
body {
    height: 100%;
}

/* =========================================
   Base (Luxury animated mesh + grain)
   ========================================= */
body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    color: var(--text-main);
    overflow-x: hidden;

    /* Luxury mesh background */
    background: radial-gradient(
            1200px 800px at 20% 10%,
            rgba(120, 170, 255, 0.22),
            transparent 55%
        ),
        radial-gradient(
            900px 700px at 85% 25%,
            rgba(90, 120, 255, 0.18),
            transparent 60%
        ),
        radial-gradient(
            900px 900px at 50% 95%,
            rgba(255, 255, 255, 0.08),
            transparent 55%
        ),
        linear-gradient(135deg, #071a43 0%, var(--primary) 45%, #1f4aa0 100%);
    background-size: 140% 140%;
    animation: meshMove 16s ease-in-out infinite;
}

@keyframes meshMove {
    0% {
        background-position: 0% 0%, 100% 0%, 50% 100%, 0% 0%;
    }
    50% {
        background-position: 30% 15%, 70% 20%, 50% 80%, 100% 100%;
    }
    100% {
        background-position: 0% 0%, 100% 0%, 50% 100%, 0% 0%;
    }
}

/* Grain overlay biar terasa “mewah” */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.1;
    mix-blend-mode: overlay;
    background-image: repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.035) 0 1px,
            transparent 1px 3px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(0, 0, 0, 0.03) 0 1px,
            transparent 1px 4px
        );
    animation: grainShift 6s steps(6) infinite;
}

@keyframes grainShift {
    0% {
        transform: translate3d(0, 0, 0);
    }
    20% {
        transform: translate3d(-2px, 1px, 0);
    }
    40% {
        transform: translate3d(1px, -2px, 0);
    }
    60% {
        transform: translate3d(2px, 1px, 0);
    }
    80% {
        transform: translate3d(-1px, 2px, 0);
    }
    100% {
        transform: translate3d(0, 0, 0);
    }
}

/* =========================================
   Layout halaman login
   (Grid + scanline layer ada di pseudo element)
   ========================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 24px;
    box-sizing: border-box;

    position: relative;
    overflow: hidden; /* semua layer animasi stay di frame */
    z-index: 1; /* di atas body::before */
}

/* Moving grid (futuristic) */
.login-page::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.18;

    background-image: repeating-linear-gradient(
            0deg,
            rgba(255, 255, 255, 0.085) 0 1px,
            transparent 1px 34px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(255, 255, 255, 0.085) 0 1px,
            transparent 1px 34px
        );

    transform: perspective(900px) rotateX(55deg);
    transform-origin: center;
    animation: gridDrift 10s linear infinite;
}

@keyframes gridDrift {
    0% {
        background-position: 0 0, 0 0;
    }
    100% {
        background-position: 0 220px, 220px 0;
    }
}

/* Scanline */
.login-page::after {
    content: "";
    position: absolute;
    left: -20%;
    right: -20%;
    top: 0;
    height: 180px;
    z-index: 0;
    pointer-events: none;
    opacity: 0.14;

    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(255, 255, 255, 0.25) 40%,
        transparent 100%
    );
    filter: blur(1px);
    animation: scanDown 4.8s ease-in-out infinite;
}

@keyframes scanDown {
    0% {
        transform: translateY(-220px) skewX(-8deg);
    }
    50% {
        transform: translateY(40vh) skewX(-8deg);
    }
    100% {
        transform: translateY(110vh) skewX(-8deg);
    }
}

/* =========================================
   Sparkles layer (butuh <div class="sparkles"></div>)
   ========================================= */
.login-page .sparkles {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.9;
}

.login-page .sparkles::before,
.login-page .sparkles::after {
    content: "";
    position: absolute;
    inset: -20%;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    filter: blur(0.2px);
    opacity: 0.55;
    animation: sparkleDrift 12s linear infinite;
}

.login-page .sparkles::before {
    background-image: radial-gradient(
            circle,
            rgba(255, 255, 255, 0.9) 0 1px,
            transparent 2px
        ),
        radial-gradient(circle, rgba(180, 220, 255, 0.9) 0 1px, transparent 2px),
        radial-gradient(circle, rgba(255, 255, 255, 0.8) 0 1px, transparent 2px);
    background-position: 10% 20%, 60% 35%, 80% 70%;
}

.login-page .sparkles::after {
    opacity: 0.35;
    filter: blur(0.6px);
    animation-duration: 18s;
    background-image: radial-gradient(
            circle,
            rgba(255, 255, 255, 0.9) 0 2px,
            transparent 3px
        ),
        radial-gradient(circle, rgba(160, 200, 255, 0.9) 0 2px, transparent 3px),
        radial-gradient(
            circle,
            rgba(255, 255, 255, 0.75) 0 2px,
            transparent 3px
        );
    background-position: 25% 75%, 70% 15%, 90% 45%;
}

@keyframes sparkleDrift {
    0% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(-30px, 18px, 0);
    }
    100% {
        transform: translate3d(0, 0, 0);
    }
}

/* =========================================
   Kartu utama login
   ========================================= */
.login-box {
    background-color: #ffffff;
    width: 100%;
    max-width: 420px;
    border-radius: 18px;
    padding: 28px 28px 24px;
    box-shadow: 0 15px 30px rgba(15, 23, 42, 0.15),
        0 1px 3px rgba(15, 23, 42, 0.08);
    border-top: 4px solid var(--primary);
    margin-top: 120px;

    /* Pastikan di atas animasi */
    position: relative;
    z-index: 2;
}

/* =========================================
   Area logo + animasi
   ========================================= */
.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.75rem;
    margin-bottom: 1.75rem;
    animation: logoFadeIn 0.7s ease-out both;
}

.logo-container img {
    height: 60px;
    width: auto;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(15, 23, 42, 0.18));
    animation: logoFloat 4s ease-in-out infinite;
    transform-origin: center;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.logo-container img:nth-child(1) {
    animation-delay: 0.1s;
}
.logo-container img:nth-child(2) {
    animation-delay: 0.4s;
}
.logo-container img:nth-child(3) {
    animation-delay: 0.8s;
}

.logo-container img:hover {
    transform: translateY(-3px) scale(1.03);
    filter: drop-shadow(0 8px 16px rgba(15, 23, 42, 0.25));
}

@keyframes logoFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes logoFloat {
    0% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
    100% {
        transform: translateY(0);
    }
}

/* =========================================
   Judul & subjudul login
   ========================================= */
.login-title {
    font-size: 1.4rem;
    text-align: center;
    margin: 2px 0 4px;
    color: var(--primary);
    font-weight: 700;
}

.login-subtitle {
    font-size: 0.9rem;
    text-align: center;
    margin: 0 0 16px;
    color: var(--text-muted);
}

/* =========================================
   Alert error
   ========================================= */
.login-alert {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.85rem;
    margin-bottom: 14px;
}

/* =========================================
   Form & grup input
   ========================================= */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.login-form input[type="text"],
.login-form input[type="password"] {
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease,
        background-color 0.15s ease;
    background-color: #f9fafb;
}

.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* =========================================
   Tombol login
   ========================================= */
.btn-login {
    margin-top: 8px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 999px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--primary-soft));
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn-login:hover {
    filter: brightness(1.03);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.22);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.18);
}

/* =========================================
   Link "Forgot password?"
   ========================================= */
.forgot-password {
    display: block;
    margin-top: 14px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--primary-soft);
    text-decoration: none;
    transition: color 0.12s ease, text-decoration-color 0.12s ease;
}

.forgot-password:hover {
    color: var(--primary);
    text-decoration: underline;
    text-decoration-color: var(--primary);
}

/* =========================================
   Footer (dekat dengan login-box)
   ========================================= */
.login-footer {
    margin-top: 130px;
    padding-top: 8px;
    padding-bottom: 10px;
    width: 100%;
    text-align: center;
    font-size: 18px;
    color: #ffffff;
    letter-spacing: 0.2px;

    position: relative;
    z-index: 2; /* di atas animasi */
}

.login-footer-link {
    position: relative;
    display: inline-block;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    padding: 2px 2px;
    transition: transform 0.18s ease, text-shadow 0.18s ease, opacity 0.18s ease;
    cursor: pointer;
}

.login-footer-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -3px;
    width: 100%;
    height: 2px;
    background: rgba(255, 255, 255, 0.95);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.18s ease;
    border-radius: 2px;
}

.login-footer-link:hover {
    transform: translateY(-1px);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.35);
    opacity: 0.98;
}

.login-footer-link:hover::after {
    transform: scaleX(1);
}

.login-footer-link:active {
    transform: translateY(0);
    opacity: 0.92;
}

.login-footer-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.7);
    outline-offset: 4px;
    border-radius: 6px;
}

/* =========================================
   Responsif
   ========================================= */
@media (max-width: 480px) {
    .login-box {
        padding: 22px 18px 18px;
        border-radius: 14px;
        margin-top: 28px;
    }

    .logo-container img {
        height: 44px;
    }

    .login-title {
        font-size: 1.2rem;
    }

    .login-footer {
        font-size: 14px;
    }
}

/* =========================================
   Reduce motion (semua animasi dimatikan)
   ========================================= */
@media (prefers-reduced-motion: reduce) {
    body {
        animation: none;
    }
    body::before {
        animation: none;
    }
    .login-page::before,
    .login-page::after {
        animation: none;
    }
    .login-page .sparkles::before,
    .login-page .sparkles::after {
        animation: none;
    }
}
