:root {
    --bg-color: #f4f7f6;
    --primary: #10b981; /* Hijau Amogenz */
    --primary-dark: #059669;
    --card-bg: #ffffff;
    --text-main: #1f2937;
    --text-light: #6b7280;
    --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

/* ========================================= */
/* 1. SPLASH SCREEN (LOADING AWAL)           */
/* ========================================= */
#splash-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #0f172a; /* Gelap Premium */
    z-index: 9999;
    display: flex; flex-direction: column;
    justify-content: space-between; align-items: center;
    padding: 50px 20px;
    transition: opacity 0.6s ease-out, visibility 0.6s;
}

.splash-content { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; }
.rocket-loader { font-size: 80px; color: var(--primary); margin-bottom: 20px; animation: launchRocket 1.5s infinite ease-in-out; }
.loading-text { color: #94a3b8; font-size: 0.9rem; letter-spacing: 1px; opacity: 0.8; }

.splash-footer { display: flex; flex-direction: column; align-items: center; margin-bottom: 20px; }
.splash-footer p { color: #64748b; font-size: 0.75rem; margin-bottom: 5px; }
.brand-logo { height: 35px; object-fit: contain; filter: drop-shadow(0 0 5px rgba(255,255,255,0.1)); }

@keyframes launchRocket {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    50% { transform: translateY(-20px) scale(1.1); opacity: 0.7; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.splash-hidden { opacity: 0; visibility: hidden; }


/* ========================================= */
/* 2. PORTAL TRANSITION (HYPERSPACE)         */
/* ========================================= */
#portal-transition {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: black; /* Gelap Total */
    z-index: 10000;
    display: flex; justify-content: center; align-items: center;
    overflow: hidden;
    transform: translateY(100%); /* Sembunyi di bawah */
    transition: transform 0.5s cubic-bezier(0.77, 0, 0.175, 1);
}
.show-portal { transform: translateY(0) !important; }

/* Efek Bintang Warp */
.stars, .stars2 {
    position: absolute; top: 50%; left: 50%; width: 2px; height: 2px;
    background: transparent; box-shadow: 0 0 0 white;
    border-radius: 50%; animation: warpSpeed 3s linear infinite;
}
.stars2 { animation-delay: 1.5s; }

@keyframes warpSpeed {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0; box-shadow: 0 0 0 0 transparent; }
    10% { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(40); opacity: 0; 
           box-shadow: -200px -300px 2px white, 200px 300px 2px var(--primary), 
                       -400px 100px 2px white, 400px -100px 2px var(--primary), 
                       -100px -500px 2px white, 100px 500px 2px var(--primary); }
}

/* Konten Tengah Portal */
.portal-center { position: relative; z-index: 2; text-align: center; display: flex; flex-direction: column; align-items: center; }

.portal-ring-container {
    position: relative; width: 140px; height: 140px; margin-bottom: 30px;
    display: flex; justify-content: center; align-items: center;
}

.portal-ring-spin {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    border-radius: 50%; border: 3px solid transparent;
    border-top-color: var(--primary); border-bottom-color: white;
    box-shadow: 0 0 40px rgba(16, 185, 129, 0.4);
    animation: spinRing 1s linear infinite;
}
@keyframes spinRing { 100% { transform: rotate(360deg); } }

.portal-logo-static {
    width: 70%; height: auto; object-fit: contain;
    position: relative; z-index: 2;
    filter: drop-shadow(0 0 5px rgba(255,255,255,0.5));
}

.portal-text-glitch {
    font-size: 1.1rem; font-weight: 700; color: white; letter-spacing: 2px;
    position: relative; animation: pulseText 1s infinite; text-transform: uppercase;
}
@keyframes pulseText {
    0% { opacity: 0.8; } 50% { opacity: 1; text-shadow: 0 0 15px var(--primary); } 100% { opacity: 0.8; }
}


/* ========================================= */
/* 3. APLIKASI UTAMA (LAYOUT)                */
/* ========================================= */
.app-container { width: 100%; max-width: 450px; }

/* HEADER STYLE (RAPAT & MANIS) */
header { text-align: center; margin-bottom: 20px; margin-top: 10px; }

.logo-wrapper {
    display: flex; align-items: center; justify-content: center;
    gap: 5px; /* Jarak dekat */
    margin-bottom: 5px;
}

.header-logo-img {
    height: 35px; width: auto; object-fit: contain; display: block;
}

.logo { 
    font-size: 1.8rem; font-weight: 700; letter-spacing: -1px;
    color: var(--text-main); line-height: 1; margin: 0;
    display: flex; align-items: center;
}
.dot { color: var(--primary); }

.subtitle { font-size: 0.9rem; color: var(--text-light); margin-top: 5px; }
.warn-text {
    font-size: 0.8rem; color: #ef4444; background: #fef2f2;
    padding: 8px; border-radius: 8px; margin-top: 10px;
    display: inline-block; border: 1px solid #fee2e2;
}

/* CARD & INPUTS */
.card {
    background: var(--card-bg); padding: 25px; border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    display: flex; flex-direction: column; gap: 15px;
}

input[type="text"] {
    width: 100%; padding: 14px; border: 2px solid #e5e7eb; border-radius: 12px;
    font-family: inherit; outline: none; transition: 0.3s;
}
input[type="text"]:focus { border-color: var(--primary); }

/* STYLE INPUT PASSWORD */
.password-wrapper { position: relative; width: 100%; margin-bottom: 5px; }
.password-wrapper input {
    width: 100%; padding: 14px 14px 14px 45px;
    border: 2px solid #e5e7eb; border-radius: 12px;
    outline: none; transition: 0.3s; background: #f9fafb; font-size: 0.9rem;
}
.password-wrapper input:focus { border-color: var(--primary); background: #fff; }
.lock-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-light); font-size: 20px;
}

/* FILE INPUT (FIX NAMA PANJANG JEBOL) */
input[type="file"] { display: none; }
.file-trigger {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 15px; border: 2px dashed #e5e7eb; border-radius: 12px;
    cursor: pointer; color: var(--text-light); font-weight: 500; transition: 0.3s;
    overflow: hidden; /* Mencegah jebol */
}
.file-trigger:hover { border-color: var(--primary); color: var(--primary); background: #ecfdf5; }

/* FIX TAMPILAN NAMA FILE DI INPUT */
#fileNameDisplay {
    white-space: nowrap;      /* Dilarang turun baris */
    overflow: hidden;         /* Kalau lebih, sembunyikan */
    text-overflow: ellipsis;  /* Ganti lebihannya dengan ... */
    max-width: 220px;         /* Batas lebar maksimal */
    display: inline-block;
    vertical-align: middle;
}

button {
    background: var(--primary); color: white; border: none;
    padding: 16px; border-radius: 12px; font-size: 1rem; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    gap: 8px; transition: 0.2s; font-family: inherit;
}
button:active { transform: scale(0.98); }
button:disabled { background: #9ca3af; cursor: not-allowed; }

/* STATUS MESSAGE */
.status-msg { text-align: center; font-size: 0.9rem; margin-top: 10px; }
.status-msg.success { color: #10b981; }
.status-msg.error { color: #ef4444; }
.hidden { display: none; }


/* ========================================= */
/* 4. TOMBOL PORTAL (COMMAND CENTER STYLE)   */
/* ========================================= */
.portal-card {
    display: flex; align-items: center; justify-content: space-between;
    background: #ffffff; padding: 16px 20px; border-radius: 16px;
    margin-top: 25px; margin-bottom: 25px;
    cursor: pointer; transition: all 0.3s ease; border: 2px solid transparent;
    box-shadow: 0 4px 15px rgba(0,0,0,0.03); position: relative; overflow: hidden;
}
.portal-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 8px 20px rgba(16, 185, 129, 0.15); }

.portal-icon-box {
    position: relative; width: 45px; height: 45px;
    background: #ecfdf5; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; color: var(--primary);
}
.portal-icon-box .material-icons-round { font-size: 24px; }

.online-dot {
    position: absolute; top: -2px; right: -2px; width: 10px; height: 10px;
    background-color: #10b981; border: 2px solid white; border-radius: 50%;
    animation: pulseDot 2s infinite;
}
@keyframes pulseDot {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.portal-info { flex-grow: 1; margin-left: 15px; display: flex; flex-direction: column; }
.portal-title { font-weight: 700; color: var(--text-main); font-size: 0.95rem; }
.portal-desc { font-size: 0.75rem; color: var(--text-light); margin-top: 2px; }

.portal-arrow { font-size: 16px; color: #cbd5e1; transition: 0.3s; }
.portal-card:hover .portal-arrow { color: var(--primary); transform: translateX(3px); }


/* ========================================= */
/* 5. RADAR FILE (LIST)                      */
/* ========================================= */
.file-section { margin-top: 10px; }
h3 { font-size: 1.1rem; margin-bottom: 15px; color: var(--text-main); }

.file-item {
    background: var(--card-bg); padding: 15px; border-radius: 12px; margin-bottom: 12px;
    display: flex; justify-content: space-between; align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    max-width: 100%; /* Cegah item melebar dari layar */
}

/* FIX NAMA FILE JEBOL DI LIST */
.file-info {
    flex-grow: 1;
    min-width: 0; /* MAGIC: Ini biar text-overflow jalan di flexbox */
    margin-right: 15px; /* Jarak aman ke tombol download */
}

.file-info strong { 
    display: block; 
    font-size: 0.95rem;
    white-space: nowrap;      /* Jangan turun baris */
    overflow: hidden;         /* Sembunyikan lebihan */
    text-overflow: ellipsis;  /* Ganti dengan ... */
}

.file-info span { font-size: 0.75rem; color: var(--text-light); }
.file-info .timer { color: #ef4444; font-weight: bold; }

/* Icon Download Biasa */
.download-icon {
    background: #ecfdf5; color: var(--primary);
    width: 40px; height: 40px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; text-decoration: none;
    flex-shrink: 0; /* Biar tombol gak gepeng kalau nama panjang */
}
/* Icon Download Terkunci */
.download-icon.locked {
    background: #fee2e2; color: #ef4444; cursor: pointer;
}
/* Icon Download Terbuka */
.download-icon.unlocked {
    background: #d1fae5; color: #10b981; cursor: pointer;
    animation: popIn 0.3s ease; border: 2px solid #10b981;
}

@keyframes popIn {
    0% { transform: scale(0); } 80% { transform: scale(1.1); } 100% { transform: scale(1); }
}

.empty, .loading { text-align: center; color: var(--text-light); font-size: 0.9rem; margin-top: 20px; font-style: italic; }
footer { text-align: center; margin-top: 50px; color: #d1d5db; font-size: 0.8rem; }


/* ========================================= */
/* 6. MODAL PASSWORD CANGGIH (HOLOGRAPHIC)   */
/* ========================================= */

/* Overlay Background */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 10, 20, 0.9); /* Sangat Gelap */
    backdrop-filter: blur(12px);
    z-index: 10001; /* Paling Depan */
    display: flex; justify-content: center; align-items: center;
    opacity: 1; visibility: visible; transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
.hidden-modal { opacity: 0; visibility: hidden; }

/* Kotak Hologram */
.modal-holo-box {
    position: relative;
    background: rgba(30, 41, 59, 0.4); /* Semi-transparan */
    border: 1px solid rgba(16, 185, 129, 0.2);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.1), inset 0 0 20px rgba(16, 185, 129, 0.05);
    border-radius: 24px; padding: 40px 30px; width: 90%; max-width: 380px;
    text-align: center; color: white; overflow: hidden;
    transform: scale(1) translateY(0); transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
.hidden-modal .modal-holo-box { transform: scale(0.9) translateY(30px); opacity: 0; }

/* Efek Scanline */
.scanline {
    position: absolute; top: 0; left: 0; width: 100%; height: 2px;
    background: linear-gradient(to right, transparent, var(--primary), transparent);
    opacity: 0.3; animation: scanMove 3s linear infinite;
}
@keyframes scanMove { 0% { top: -10%; } 100% { top: 110%; } }

/* Modal Header */
.modal-header { margin-bottom: 20px; }
.icon-glow-wrapper {
    display: inline-flex; padding: 15px;
    background: rgba(16, 185, 129, 0.1); border-radius: 50%;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.2); margin-bottom: 15px;
}
.modal-icon { font-size: 32px; color: var(--primary); }
.modal-header h3 { font-size: 1.4rem; font-weight: 600; letter-spacing: 1px; margin: 0; }

/* Modal Text (FIX NAMA PANJANG DI MODAL) */
.modal-file-name { 
    font-weight: 500; 
    color: #e2e8f0; 
    margin-bottom: 8px; 
    font-size: 1rem;
    white-space: nowrap;      /* Cegah turun baris */
    overflow: hidden;         /* Sembunyikan lebihan */
    text-overflow: ellipsis;  /* Kasih titik tiga ... */
    max-width: 100%;          /* Jangan melebihi kotak */
    display: block;
}
.modal-desc { font-size: 0.85rem; color: #94a3b8; margin-bottom: 30px; }

/* Modal Input Minimalis */
.holo-input-wrapper { position: relative; margin-bottom: 30px; }
.holo-input-wrapper input {
    width: 100%; padding: 12px 12px 12px 40px;
    background: transparent; border: none;
    border-bottom: 2px solid #334155; border-radius: 0; outline: none;
    color: white; font-size: 1.1rem; letter-spacing: 3px; font-family: inherit; transition: 0.3s;
}
.holo-input-wrapper input:focus { border-bottom-color: var(--primary); }
.input-lock-icon { position: absolute; left: 5px; top: 50%; transform: translateY(-50%); color: #64748b; font-size: 22px; transition: 0.3s; }
.holo-input-wrapper input:focus ~ .input-lock-icon { color: var(--primary); }

/* Modal Buttons */
.modal-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.btn-ghost {
    background: transparent; color: #94a3b8; padding: 12px 20px; border: none;
    font-weight: 500; cursor: pointer; font-family: inherit; font-size: 0.95rem; transition: 0.2s;
}
.btn-ghost:hover { color: white; }

.btn-glow {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; border: none; padding: 12px 25px; border-radius: 30px;
    font-weight: 600; cursor: pointer; font-family: inherit; font-size: 0.95rem;
    display: flex; align-items: center; gap: 8px;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3); transition: 0.3s;
}
.btn-glow:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5); }
.btn-glow .material-icons-round { font-size: 18px; }

/* Shake Animation */
@keyframes shakeGlow {
    0%, 100% { transform: translateX(0); border-color: rgba(16, 185, 129, 0.2); box-shadow: 0 0 30px rgba(16, 185, 129, 0.1); }
    20%, 60% { transform: translateX(-8px); border-color: rgba(239, 68, 68, 0.6); box-shadow: 0 0 40px rgba(239, 68, 68, 0.3); }
    40%, 80% { transform: translateX(8px); border-color: rgba(239, 68, 68, 0.6); box-shadow: 0 0 40px rgba(239, 68, 68, 0.3); }
}
.shake-anim .modal-holo-box { animation: shakeGlow 0.5s ease-in-out; }
.shake-anim .modal-icon, .shake-anim .input-lock-icon { color: #ef4444 !important; transition: 0.2s; }
.shake-anim .holo-input-wrapper input { border-bottom-color: #ef4444; color: #ef4444; }

/* ========================================= */
/* FIX BUG: MATIKAN SELECT & LONG PRESS      */
/* ========================================= */

/* Daftar elemen yang dilarang disentuh lama */
button, 
.download-icon, 
.file-trigger, 
.portal-card, 
.modal-actions button,
.logo-wrapper,
.icon-glow-wrapper {
    /* 1. Mencegah teks bisa diblok/disalin */
    -webkit-user-select: none; /* Safari/Chrome */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE/Edge */
    user-select: none;         /* Standar */

    /* 2. Mencegah menu konteks (Copy/Search) muncul saat ditekan lama */
    -webkit-touch-callout: none; 

    /* 3. Menghilangkan kedipan biru (Highlight) saat diklik di Android */
    -webkit-tap-highlight-color: transparent; 
    
    /* 4. Menghilangkan garis fokus */
    outline: none; 
}
