/* 
 * SPACE/UNIVERSE THEME FOR HAPB POPUP
 * Tema luar angkasa dengan efek nebula, bintang, dan planet
 */

/* --- RESET & OVERLAY SPACE THEME --- */
.hapb-overlay {
    position: fixed;
    z-index: 999999;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 5, 20, 0.95);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}

/* Nebula background dengan gradien biru-ungu */
.hapb-overlay::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(100, 100, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(150, 100, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(50, 150, 255, 0.1) 0%, transparent 50%);
    animation: hapbSpaceNebulaFloat 20s infinite alternate ease-in-out;
}

@keyframes hapbSpaceNebulaFloat {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -20px) scale(1.05); }
    100% { transform: translate(-20px, 10px) scale(1); }
}

/* Efek bintang berkelap-kelip */
.hapb-overlay::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: 
        radial-gradient(2px 2px at 50px 100px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 150px 50px, #aaccff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 250px 200px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(3px 3px at 350px 150px, #88aaff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 450px 80px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(1px 1px at 550px 250px, #ccddff, rgba(0,0,0,0)),
        radial-gradient(2px 2px at 650px 180px, #ffffff, rgba(0,0,0,0)),
        radial-gradient(3px 3px at 750px 120px, #99bbff, rgba(0,0,0,0));
    background-repeat: no-repeat;
    animation: hapbSpaceStars 60s linear infinite;
    opacity: 0.6;
}

@keyframes hapbSpaceStars {
    from { background-position: 0 0; }
    to { background-position: 1000px 500px; }
}

/* --- MODAL CONTENT SPACE THEME --- */
.hapb-modal-content {
    background: rgba(10, 15, 30, 0.9);
    width: 100%;
    max-width: 420px;
    padding: 40px;
    position: relative;
    border: 1px solid rgba(100, 150, 255, 0.5);
    box-shadow: 
        0 0 40px rgba(80, 120, 255, 0.3),
        inset 0 0 30px rgba(50, 100, 255, 0.1),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    color: #e0f0ff;
    font-family: 'Segoe UI', Roboto, 'SF Pro Display', sans-serif;
    border-radius: 16px;
    backdrop-filter: blur(10px);
    overflow: hidden;
    z-index: 1;
    animation: hapbSpaceModalAppear 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes hapbSpaceModalAppear {
    0% {
        transform: translateY(100px) scale(0.8) rotateX(10deg);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1) rotateX(0);
        opacity: 1;
    }
}

/* Planet floating di background modal */
.hapb-modal-content::before {
    content: "";
    position: absolute;
    top: -50px;
    right: -50px;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle at 30% 30%, #4a6fa5, #2a4565);
    border-radius: 50%;
    opacity: 0.2;
    z-index: -1;
    animation: hapbSpacePlanetFloat 20s infinite linear;
    box-shadow: 
        inset -10px -10px 20px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(74, 111, 165, 0.3);
}

@keyframes hapbSpacePlanetFloat {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Rings around planet */
.hapb-modal-content::after {
    content: "";
    position: absolute;
    top: -60px;
    right: -60px;
    width: 170px;
    height: 170px;
    border: 2px solid rgba(150, 200, 255, 0.1);
    border-radius: 50%;
    opacity: 0.3;
    z-index: -1;
    animation: hapbSpaceRingRotate 15s infinite linear;
}

@keyframes hapbSpaceRingRotate {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

/* Glowing corners */
.hapb-modal-content .hapb-auth-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    background: 
        linear-gradient(45deg, transparent 50%, rgba(100, 150, 255, 0.05) 100%),
        linear-gradient(135deg, transparent 50%, rgba(150, 100, 255, 0.05) 100%);
    z-index: -1;
}

/* --- HEADER SPACE THEME --- */
.hapb-auth-header h2 {
    color: #88ccff;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 
        0 0 15px rgba(136, 204, 255, 0.7),
        0 0 30px rgba(100, 150, 255, 0.4),
        0 2px 0 rgba(0, 20, 40, 0.8);
    margin-bottom: 10px;
    font-size: 26px;
    font-weight: 300;
    position: relative;
    padding-bottom: 15px;
}

.hapb-auth-header h2::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 2px;
    background: linear-gradient(90deg, transparent, #66aaff, transparent);
    box-shadow: 0 0 10px rgba(102, 170, 255, 0.5);
}

/* Pulsing satellite dots */
.hapb-auth-header h2::before {
    content: "🛰️";
    position: absolute;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 20px;
    animation: hapbSpaceSatelliteOrbit 4s infinite linear;
}

@keyframes hapbSpaceSatelliteOrbit {
    0% { transform: translateY(-50%) rotate(0deg) translateX(0); }
    25% { transform: translateY(-50%) rotate(90deg) translateX(10px); }
    50% { transform: translateY(-50%) rotate(180deg) translateX(0); }
    75% { transform: translateY(-50%) rotate(270deg) translateX(-10px); }
    100% { transform: translateY(-50%) rotate(360deg) translateX(0); }
}

.hapb-auth-header p {
    text-align: center;
    color: #aaccff;
    font-size: 14px;
    margin-bottom: 35px;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 300;
    opacity: 0.8;
    position: relative;
}

.hapb-auth-header p::before {
    content: "✦";
    display: inline-block;
    margin-right: 10px;
    animation: hapbSpaceStarTwinkle 2s infinite;
}

@keyframes hapbSpaceStarTwinkle {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* --- INPUTS SPACE THEME --- */
.hapb-input-group { 
    margin-bottom: 25px;
    position: relative;
}

.hapb-input-group label {
    display: block; 
    color: #88bbff;
    font-size: 12px; 
    text-transform: uppercase; 
    margin-bottom: 8px;
    font-weight: 400;
    letter-spacing: 1.5px;
    text-shadow: 0 0 5px rgba(136, 187, 255, 0.3);
}

.hapb-input-group input {
    width: 100%; 
    background: rgba(20, 30, 50, 0.6);
    border: 1px solid rgba(100, 150, 255, 0.4);
    padding: 14px 15px 14px 45px; 
    color: #cce5ff;
    border-radius: 8px; 
    outline: none;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 
        inset 0 2px 10px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* Ikon input space */
.hapb-input-group::before {
    content: "🛸";
    position: absolute;
    left: 15px;
    top: 38px;
    font-size: 16px;
    opacity: 0.6;
    transition: all 0.3s ease;
}

.hapb-input-group:nth-child(2)::before {
    content: "🔒";
}

.hapb-input-group input::placeholder {
    color: rgba(204, 229, 255, 0.4);
    font-style: italic;
}

.hapb-input-group input:focus {
    border-color: #66aaff;
    box-shadow: 
        0 0 20px rgba(102, 170, 255, 0.4),
        inset 0 2px 10px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(102, 170, 255, 0.2);
    background: rgba(25, 40, 65, 0.8);
    transform: translateY(-2px);
}

.hapb-input-group:focus-within::before {
    opacity: 1;
    transform: scale(1.2);
    animation: hapbSpaceIconFloat 0.5s ease-out;
}

@keyframes hapbSpaceIconFloat {
    0% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.3) translateY(-5px); }
    100% { transform: scale(1.2) translateY(0); }
}

/* --- BUTTONS SPACE THEME --- */
.hapb-btn-primary {
    width: 100%; 
    padding: 16px;
    background: linear-gradient(135deg, #3366cc 0%, #6699ff 50%, #3366cc 100%);
    background-size: 200% 100%;
    border: none;
    color: #ffffff;
    font-weight: 500; 
    text-transform: uppercase;
    cursor: pointer; 
    transition: all 0.3s ease;
    border-radius: 10px;
    font-size: 15px;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
    margin-top: 10px;
    box-shadow: 
        0 5px 20px rgba(51, 102, 204, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: hapbSpaceButtonGlow 4s infinite alternate;
}

@keyframes hapbSpaceButtonGlow {
    0%, 100% {
        box-shadow: 
            0 5px 20px rgba(51, 102, 204, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
    }
    50% {
        box-shadow: 
            0 5px 25px rgba(102, 153, 255, 0.6),
            0 0 15px rgba(102, 153, 255, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

.hapb-btn-primary:hover {
    background-position: right center;
    transform: translateY(-3px);
    animation: hapbSpaceButtonLaunch 0.6s forwards;
}

@keyframes hapbSpaceButtonLaunch {
    0% { transform: translateY(-3px); }
    50% { 
        transform: translateY(-3px) scale(1.05);
        box-shadow: 
            0 8px 30px rgba(102, 153, 255, 0.7),
            0 0 20px rgba(102, 153, 255, 0.5),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }
    100% { transform: translateY(-3px); }
}

.hapb-btn-primary:active {
    transform: translateY(1px);
}

/* Rocket icon in button */
.hapb-btn-primary::before {
    content: "🚀";
    position: absolute;
    left: 20px;
    font-size: 18px;
    animation: hapbSpaceRocketPulse 2s infinite;
}

@keyframes hapbSpaceRocketPulse {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Particle effect on hover */
.hapb-btn-primary::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 20px;
    width: 20px;
    height: 4px;
    background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,255,255,0.5), rgba(255,255,255,0));
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hapb-btn-primary:hover::after {
    opacity: 1;
    animation: hapbSpaceParticles 0.5s linear;
}

@keyframes hapbSpaceParticles {
    0% { transform: translateY(-50%) translateX(0); opacity: 1; }
    100% { transform: translateY(-50%) translateX(30px); opacity: 0; }
}

/* --- TOMBOL PEMICU DI HALAMAN SPACE THEME --- */
.hapb-open-popup {
    background: linear-gradient(135deg, #4455aa 0%, #6677cc 100%);
    color: #ffffff;
    padding: 14px 30px; 
    border: none;
    font-weight: 500;
    cursor: pointer;
    border-radius: 25px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 14px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 
        0 5px 15px rgba(68, 85, 170, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    animation: hapbSpaceTriggerOrbit 3s infinite alternate;
}

@keyframes hapbSpaceTriggerOrbit {
    0% {
        box-shadow: 
            0 5px 15px rgba(68, 85, 170, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.2);
        transform: translateY(0);
    }
    100% {
        box-shadow: 
            0 5px 20px rgba(102, 119, 204, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
        transform: translateY(-5px);
    }
}

.hapb-open-popup:hover {
    background: linear-gradient(135deg, #6677cc 0%, #8899ff 100%);
    transform: translateY(-3px);
    animation: hapbSpaceTriggerBeam 0.5s forwards;
}

@keyframes hapbSpaceTriggerBeam {
    0% {
        transform: translateY(-3px);
        box-shadow: 
            0 5px 20px rgba(102, 119, 204, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    50% {
        transform: translateY(-3px) scale(1.05);
        box-shadow: 
            0 8px 25px rgba(136, 153, 255, 0.8),
            0 0 15px rgba(136, 153, 255, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }
    100% {
        transform: translateY(-3px);
        box-shadow: 
            0 5px 20px rgba(102, 119, 204, 0.6),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
}

.hapb-open-popup:active {
    transform: translateY(1px);
}

/* Planet icon in trigger button */
.hapb-open-popup::before {
    content: "🌌";
    display: inline-block;
    margin-right: 8px;
    animation: hapbSpaceTriggerSpin 10s infinite linear;
}

@keyframes hapbSpaceTriggerSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- CLOSE BUTTON SPACE THEME --- */
.hapb-close-btn {
    position: absolute; 
    top: 20px; 
    right: 20px;
    color: #88ccff; 
    cursor: pointer; 
    font-size: 24px;
    width: 36px;
    height: 36px;
    background: rgba(20, 40, 80, 0.7);
    border-radius: 50%;
    border: 1px solid rgba(136, 204, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 300;
    transition: all 0.3s ease;
    z-index: 10;
    animation: hapbSpaceCloseFloat 3s infinite alternate;
}

@keyframes hapbSpaceCloseFloat {
    0%, 100% {
        transform: translateY(0);
        box-shadow: 0 0 10px rgba(136, 204, 255, 0.3);
    }
    50% {
        transform: translateY(-5px);
        box-shadow: 0 0 15px rgba(136, 204, 255, 0.5);
    }
}

.hapb-close-btn:hover {
    background: rgba(136, 204, 255, 0.2);
    color: #ffffff;
    border-color: #ffffff;
    transform: rotate(90deg) scale(1.1);
    animation: hapbSpaceCloseWarp 0.5s forwards;
}

@keyframes hapbSpaceCloseWarp {
    0% { transform: rotate(0deg) scale(1.1); }
    100% { transform: rotate(90deg) scale(1.1); }
}

/* --- SWITCH LINK SPACE THEME --- */
.hapb-switch {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(100, 150, 255, 0.2);
    color: #aaccff;
    font-size: 13px;
    position: relative;
}

.hapb-switch::before {
    content: "•••";
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(100, 150, 255, 0.5);
    letter-spacing: 5px;
}

.hapb-switch a {
    color: #88ddff;
    text-decoration: none;
    font-weight: 500;
    margin-left: 5px;
    border-bottom: 1px dotted rgba(136, 221, 255, 0.5);
    padding-bottom: 1px;
    transition: all 0.3s ease;
    position: relative;
}

.hapb-switch a:hover {
    color: #ffffff;
    border-bottom: 1px solid #88ddff;
    text-shadow: 0 0 10px rgba(136, 221, 255, 0.5);
}

.hapb-switch a::after {
    content: "→";
    margin-left: 5px;
    display: inline-block;
    transition: transform 0.3s ease;
}

.hapb-switch a:hover::after {
    transform: translateX(5px);
}

/* --- RESPONSE MESSAGE SPACE THEME --- */
#hapb-response-msg {
    margin-bottom: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: 400;
    animation: hapbSpaceMessageBeam 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 3px solid transparent;
    background: rgba(20, 30, 50, 0.7);
    position: relative;
    overflow: hidden;
}

@keyframes hapbSpaceMessageBeam {
    0% {
        transform: translateY(-20px) scale(0.95);
        opacity: 0;
    }
    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

#hapb-response-msg::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
}

#hapb-response-msg.success {
    border-left-color: #00ffaa;
    color: #88ffcc;
    box-shadow: 
        0 0 20px rgba(0, 255, 170, 0.2),
        inset 0 0 10px rgba(0, 255, 170, 0.1);
}

#hapb-response-msg.error {
    border-left-color: #ff6688;
    color: #ffaacc;
    box-shadow: 
        0 0 20px rgba(255, 102, 136, 0.2),
        inset 0 0 10px rgba(255, 102, 136, 0.1);
}

/* --- LOADING STATE SPACE THEME --- */
.hapb-btn-primary.loading {
    color: transparent;
    position: relative;
}

.hapb-btn-primary.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: hapbSpaceLoading 0.8s linear infinite;
}

@keyframes hapbSpaceLoading {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- FORM TRANSITIONS SPACE THEME --- */
#hapb-login-box,
#hapb-register-box {
    animation: hapbSpaceFormWarp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes hapbSpaceFormWarp {
    0% {
        opacity: 0;
        transform: translateX(-30px) perspective(500px) rotateY(10deg);
    }
    100% {
        opacity: 1;
        transform: translateX(0) perspective(500px) rotateY(0);
    }
}

/* --- ANIMASI TAMBAHAN UNTUK INTERAKSI --- */
.hapb-input-group:focus-within label {
    animation: hapbSpaceLabelGlow 0.5s ease-out;
}

@keyframes hapbSpaceLabelGlow {
    0% { text-shadow: 0 0 5px rgba(136, 187, 255, 0.3); }
    50% { text-shadow: 0 0 10px rgba(136, 187, 255, 0.6); }
    100% { text-shadow: 0 0 5px rgba(136, 187, 255, 0.3); }
}

/* Shooting stars effect on hover */
.hapb-modal-content:hover::before {
    animation: hapbSpacePlanetFloat 20s infinite linear, hapbSpacePlanetGlow 2s infinite alternate;
}

@keyframes hapbSpacePlanetGlow {
    0% { opacity: 0.2; }
    100% { opacity: 0.3; }
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 768px) {
    .hapb-modal-content {
        max-width: 90%;
        padding: 30px 20px;
        margin: 15px;
    }
    
    .hapb-auth-header h2 {
        font-size: 22px;
        letter-spacing: 2px;
    }
    
    .hapb-btn-primary,
    .hapb-open-popup {
        padding: 14px 20px;
    }
    
    /* Smaller planet on mobile */
    .hapb-modal-content::before {
        width: 100px;
        height: 100px;
        top: -30px;
        right: -30px;
    }
    
    .hapb-modal-content::after {
        width: 120px;
        height: 120px;
        top: -40px;
        right: -40px;
    }
}

@media (max-width: 480px) {
    .hapb-modal-content {
        padding: 25px 15px;
        border-radius: 12px;
    }
    
    .hapb-auth-header h2 {
        font-size: 20px;
    }
    
    .hapb-input-group input {
        padding: 12px 12px 12px 40px;
    }
    
    .hapb-open-popup {
        padding: 12px 20px;
        font-size: 13px;
    }
    
    .hapb-btn-primary::before,
    .hapb-open-popup::before {
        font-size: 16px;
    }
}

/* --- CUSTOM SCROLLBAR SPACE THEME --- */
.hapb-modal-content::-webkit-scrollbar {
    width: 6px;
}

.hapb-modal-content::-webkit-scrollbar-track {
    background: rgba(20, 30, 50, 0.3);
    border-radius: 3px;
}

.hapb-modal-content::-webkit-scrollbar-thumb {
    background: linear-gradient(transparent, #6699ff, transparent);
    border-radius: 3px;
}

.hapb-modal-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(transparent, #88aaff, transparent);
}

/* --- FADE OUT ANIMATION --- */
.hapb-overlay.fade-out {
    animation: hapbSpaceFadeOut 0.4s ease-out forwards;
}

@keyframes hapbSpaceFadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

/* --- PULSING BORDER EFFECT --- */
@keyframes hapbSpaceBorderPulse {
    0%, 100% {
        box-shadow: 
            0 0 40px rgba(80, 120, 255, 0.3),
            inset 0 0 30px rgba(50, 100, 255, 0.1),
            0 0 0 1px rgba(255, 255, 255, 0.1);
    }
    50% {
        box-shadow: 
            0 0 50px rgba(102, 153, 255, 0.4),
            inset 0 0 35px rgba(80, 140, 255, 0.15),
            0 0 0 1px rgba(255, 255, 255, 0.15);
    }
}

.hapb-modal-content {
    animation: 
        hapbSpaceModalAppear 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275),
        hapbSpaceBorderPulse 4s infinite alternate;
}