/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #09090b;
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* ===== 1. BACKGROUND GRID PATTERN (Garis Tipis) ===== */
.bg-grid {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background-size: 50px 50px;
    background-image: 
        linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    z-index: 0;
    pointer-events: none;
}

/* ===== 2. BACKGROUND BLOBS (Warna Dasar) ===== */
.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.4;
    z-index: 0;
    animation: moveBlob 15s infinite alternate;
}
.blob-1 { width: 500px; height: 500px; background: #7c3aed; top: -100px; left: -100px; }
.blob-2 { width: 450px; height: 450px; background: #2563eb; bottom: -80px; right: -80px; animation-delay: -5s; }

@keyframes moveBlob {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 60px) scale(1.15); }
}

/* ===== 3. STAR DUST (Ribuan Bintang Kecil) ===== */
.star-dust {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: 1;
    pointer-events: none;
}

.star-dust::after {
    content: "";
    position: absolute;
    width: 2px; height: 2px;
    background: transparent;
    /* Teknik box-shadow untuk membuat banyak titik tanpa elemen HTML */
    box-shadow: 
        10vw 10vh #fff, 20vw 80vh #fff, 30vw 30vh #fff, 40vw 60vh #fff, 
        50vw 10vh #fff, 60vw 90vh #fff, 70vw 40vh #fff, 80vw 70vh #fff, 
        90vw 20vh #fff, 15vw 55vh #fff, 85vw 15vh #fff, 5vw 95vh #fff,
        25vw 45vh rgba(167, 139, 250, 0.8), 75vw 85vh rgba(59, 130, 246, 0.8);
    border-radius: 50%;
    animation: twinkle 3s infinite alternate;
}

/* Layer kedua bintang (lebih kecil) */
.star-dust::before {
    content: "";
    position: absolute;
    width: 1px; height: 1px;
    background: transparent;
    box-shadow: 
        5vw 5vh #fff, 15vw 90vh #fff, 35vw 20vh #fff, 45vw 70vh #fff, 
        55vw 30vh #fff, 65vw 60vh #fff, 75vw 10vh #fff, 85vw 90vh #fff, 
        95vw 50vh #fff, 10vw 40vh #fff, 90vw 60vh #fff;
    border-radius: 50%;
    animation: twinkle 4s infinite alternate-reverse;
    opacity: 0.6;
}

@keyframes twinkle {
    0% { opacity: 0.3; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1.2); }
}

/* ===== 4. FLOATING ICONS (3 Layers) ===== */
.floating-icons-wrapper {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 2; overflow: hidden;
}

.parallax-layer { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.float-icon {
    position: absolute;
    object-fit: contain;
    
    /* ✅ TAMBAHKAN INI: Agar posisi dari HTML (--x dan --y) berfungsi */
    top: var(--y);
    left: var(--x);

    /* Parallax Variable (Gerakan mouse) */
    --px: 0px; --py: 0px;
    
    /* Transform untuk Parallax */
    transform: translate3d(var(--px), var(--py), 0);
    
    animation: float var(--duration) ease-in-out infinite;
    animation-delay: var(--delay);
}

/* LAYER 1: Belakang (Kecil, Pudar, Blur) */
.layer-back .float-icon {
    width: 30px; height: 30px;
    opacity: 0.15;
    filter: blur(3px);
    z-index: 1;
}

/* LAYER 2: Tengah (Normal) */
.layer-mid .float-icon {
    width: 55px; height: 55px;
    opacity: 0.4;
    filter: blur(1.5px);
    z-index: 2;
}

/* LAYER 3: Depan (Besar, Heavy Blur) */
.layer-front .float-icon {
    width: 120px; height: 120px;
    opacity: 0.25;
    filter: blur(6px);
    z-index: 3;
}

@keyframes float {
    0%, 100% { transform: translate3d(var(--px), var(--py), 0) translateY(0) rotate(0deg); }
    25% { transform: translate3d(var(--px), var(--py), 0) translateY(-20px) rotate(5deg); }
    50% { transform: translate3d(var(--px), var(--py), 0) translateY(0) rotate(0deg); }
    75% { transform: translate3d(var(--px), var(--py), 0) translateY(20px) rotate(-5deg); }
}

/* ===== 5. LOGIN CONTAINER & MASCOT ===== */
.login-container {
    position: relative; z-index: 10; width: 100%; max-width: 430px; padding: 20px;
}

/* Maskot Mengintip */
.mascot-peek {
    position: absolute;
    top: -60px; /* Posisi di atas kartu */
    left: 50%;
    transform: translateX(-50%);
    width: 120px; height: 120px;
    z-index: 12;
    animation: peekBounce 3s ease-in-out infinite;
    pointer-events: none;
}

.mascot-svg { width: 100%; height: auto; }

@keyframes peekBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(-10px); }
}

/* ===== 6. LOGIN CARD (Shadow Berwarna Ungu) ===== */
.login-card {
    background: rgba(20, 20, 25, 0.6); /* Sedikit lebih gelap agar maskot terlihat */
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border-radius: 24px;
    padding: 50px 35px 40px; /* Padding atas lebih besar untuk maskot */
    
    /* Shadow Ungu (Glow) */
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(124, 58, 237, 0.2); /* Glow Ungu Lembut */
    
    animation: slideInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ===== LOGO & HEADER ===== */
.logo-wrapper { text-align: center; margin-bottom: 25px; }
.logo-anim {
    width: 85px; height: auto;
    animation: floatLogo 4s ease-in-out infinite;
    filter: drop-shadow(0 0 15px rgba(124, 58, 237, 0.4));
}
@keyframes floatLogo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.card-header { text-align: center; margin-bottom: 35px; animation: fadeIn 1s ease 0.3s backwards; }
.card-header h2 { font-size: 24px; font-weight: 600; margin-bottom: 8px; }
.card-header p { color: #94a3b8; font-size: 14px; }

/* ===== INPUT FIELDS ===== */
.input-group {
    position: relative; margin-bottom: 20px;
    opacity: 0; animation: slideInUp 0.6s ease forwards; animation-delay: var(--delay);
}

.icon-box {
    position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
    color: #64748b; transition: color 0.3s; pointer-events: none;
}

.input-group input {
    width: 100%;
    padding: 14px 50px 14px 48px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: white;
    font-size: 15px;
    transition: all 0.3s ease;
}

.input-group input::placeholder { color: #64748b; }

.input-group input:focus {
    outline: none;
    border-color: #8b5cf6;
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.15);
}
.input-group input:focus ~ .icon-box { color: #8b5cf6; }

/* ===== TOGGLE PASSWORD ===== */
.toggle-password {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; color: #64748b; cursor: pointer;
    padding: 8px; border-radius: 8px; display: flex; align-items: center;
    justify-content: center; transition: all 0.3s ease;
}
.toggle-password:hover {
    color: #ffffff; background: rgba(255, 255, 255, 0.1); transform: translateY(-50%) scale(1.1);
}

/* ===== ERROR MESSAGE ===== */
.error-message {
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    opacity: 1;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.error-content {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 24px;
}

.error-content svg {
    flex-shrink: 0;
    color: #f87171;
}

.error-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: #fca5a5;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s;
}

.error-close:hover {
    background: rgba(220, 38, 38, 0.2);
}

.error-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: rgba(248, 113, 113, 0.6);
    border-radius: 0 0 10px 10px;
}

/* Animasi shake saat muncul */
@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    40%       { transform: translateX(6px); }
    60%       { transform: translateX(-4px); }
    80%       { transform: translateX(4px); }
}

.error-shake {
    animation: errorShake 0.5s ease;
}

/* Animasi saat dismiss */
.error-hiding {
    opacity: 0;
    transform: translateY(-8px);
}

/* ===== BUTTON STYLES ===== */
.button-group {
    opacity: 0; animation: slideInUp 0.6s ease forwards; animation-delay: var(--delay);
}

#submitBtn {
    width: 100%; padding: 14px;
    background: linear-gradient(135deg, #d946ef, #8b5cf6);
    border: none; border-radius: 12px; color: white; font-size: 16px; font-weight: 600;
    cursor: pointer; transition: all 0.3s ease; display: flex; align-items: center;
    justify-content: center; gap: 10px; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    position: relative; overflow: hidden;
}
#submitBtn:hover {
    transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5); filter: brightness(1.1);
}
#submitBtn:active { transform: scale(0.98); }
.arrow-icon { font-size: 18px; transition: transform 0.3s; }
#submitBtn:hover .arrow-icon { transform: translateX(5px); }

/* ===== LOADING STATE ===== */
.loading-content { display: none; align-items: center; gap: 10px; }
.loading-text { font-weight: 500; font-size: 0.95rem; white-space: nowrap; }
.car-group { display: flex; gap: 4px; align-items: center; }
.mini-car {
    width: 20px; height: 20px; object-fit: contain;
    animation: carBounce 0.5s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}
.mini-car:nth-child(1) { animation-delay: 0s; }
.mini-car:nth-child(2) { animation-delay: 0.2s; }
.mini-car:nth-child(3) { animation-delay: 0.4s; }

@keyframes carBounce {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-5px) scale(1.1); }
}

#submitBtn.loading .btn-text,
#submitBtn.loading .arrow-icon { display: none; }
#submitBtn.loading .loading-content { display: flex; }
#submitBtn.loading { pointer-events: none; opacity: 0.95; }

/* ===== FOOTER ===== */
.footer-text {
    text-align: center; margin-top: 25px; color: #475569; font-size: 12px;
    animation: fadeIn 1s ease 0.6s backwards;
}

/* ===== KEYFRAMES UTILS ===== */
@keyframes slideInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .floating-icons-wrapper, .star-dust { display: none; }
    .mascot-peek { display: none; } /* Maskot hilang di HP agar tidak menghalangi */
    .login-card { padding: 30px 20px; }
    .card-header h2 { font-size: 20px; }
}