/* =========================================
   1. VARIABLES & RESET (UTAMA)
   ========================================= */
:root {
    --primary: #39FF14; /* Hijau Neon Amogenz */
    --primary-dim: rgba(57, 255, 20, 0.1);
    --bg-dark: #050505;
    --glass-bg: rgba(20, 20, 20, 0.9); /* Lebih pekat biar card jelas */
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-main: #ffffff;
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Outfit', sans-serif;
    --tick-read: #34b7f1; /* Biru Centang WA */
    --chat-bubble-me: #005c4b; /* Hijau Tua WA */
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    height: 100%; width: 100%;
    overflow: hidden; /* Scroll body mati */
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    position: fixed; inset: 0;
}

/* =========================================
   2. GLOBAL UTILS
   ========================================= */
.app-container {
    width: 100%; 
    height: 100dvh;
    /* Jangan gunakan overflow: auto di sini jika page-section sudah punya scroll sendiri */
    overflow: hidden; 
    position: relative;
}


.hidden { display: none !important; }

/* Visuals */
.orb { position: fixed; border-radius: 50%; filter: blur(100px); z-index: -2; opacity: 0.3; }
.orb-1 { top: -10%; left: -10%; width: 50vw; height: 50vw; background: var(--primary); }
.orb-2 { bottom: -10%; right: -10%; width: 40vw; height: 40vw; background: #004400; }
.noise-overlay { position: fixed; inset: 0; pointer-events: none; z-index: -1; opacity: 0.05; background: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MDAiIGhlaWdodD0iNDAwIj48ZmlsdGVyIGlkPSJnoiPjxmZVR1cmJ1bGVuY2UgdHlwZT0iZnJhY3RhbE5vaXNlIiBiYXNlRnJlcXVlbmN5PSIwLjY1IiAvPjwvZmlsdGVyPjxyZWN0IHdpZHRoPSIxMDAlIiBoZWlnaHQ9IjEwMCUiIGZpbHRlcj0idXJsKCNnKSIgb3BhY2l0eT0iMC41Ii8+PC9zdmc+'); }

/* SPA Sections sumber ada kotak hitam bawah*/

/* SPA Sections */
.page-section { 
    display: none; 
    width: 100%; 
    height: 100%; 
    /* UBAH INI: Izinkan scroll vertikal */
    overflow-y: auto; 
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch; /* Biar scroll halus di iPhone */
    padding-bottom: 120px; /* Ruang untuk navbar bawah */
}

.page-section.active { 
    display: block; 
}


.page-section.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* =========================================
   3. NAVIGATION (BOTTOM)
   ========================================= */
.glass-nav {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 50px;
    padding: 15px 40px; z-index: 1000; width: auto;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.nav-list { display: flex; gap: 40px; list-style: none; padding: 0; margin: 0; }
.nav-item { cursor: pointer; opacity: 0.5; transition: 0.3s; display: flex; flex-direction: column; align-items: center; }
.nav-item img, .nav-item svg { width: 28px; height: 28px; filter: grayscale(100%); transition: 0.3s; }
.nav-item.active { opacity: 1; transform: scale(1.15); }
.nav-item.active img, .nav-item.active svg { filter: none; color: var(--primary); stroke: var(--primary); drop-shadow: 0 0 10px var(--primary); }
.nav-label { display: none; }

/* =========================================
   4. UNIVERSE FEED (RAPAT, TIDAK MELAR, GAMBAR UTUH)
   ========================================= */
.universe-header {
    position: fixed; top: 0; left: 0; right: 0; height: 70px;
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 20px; z-index: 800; background: rgba(5,5,5,0.9); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
}
.header-title { font-family: var(--font-heading); font-size: 1.2rem; margin: 0; color: #fff; }
.highlight { color: var(--primary); }
.btn-icon-header { background: none; border: none; color: #fff; cursor: pointer; }

/* Feed Container (Block) */
.feed-container { 
    width: 100%; max-width: 600px; margin: 0 auto; 
    padding: 0 15px; margin-top: 20px;
    display: block !important; /* Mencegah flex stretch */
}
/* --- CARD POSTINGAN (FIX HEIGHT & PADDING) --- */
.feed-item {
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    margin-bottom: 20px;
    overflow: hidden;
    
    /* FIX: Pastikan card bersifat block murni */
    display: block !important; 
    height: auto !important; 
    min-height: 0 !important;
}

/* 1. HEADER (Rapat) */
.feed-header { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    /* UBAH DISINI: Atas 12px, Kanan 15px, Bawah 10px (Jarak Aman), Kiri 15px */
    padding: 12px 15px 10px 15px; 
    margin-bottom: 0;
}

.feed-avatar-wrapper img, .avatar-img-custom { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 1px solid var(--glass-border); }
/* Update agar Bulat Sempurna (Anti-Gepeng) */
.avatar-letter { 
    width: 40px; 
    height: 40px; 
    
    /* TAMBAHAN PENTING: */
    min-width: 40px;    /* Kunci lebar minimal */
    flex-shrink: 0;     /* Melarang flexbox menggencet elemen ini */
    
    border-radius: 50%; 
    background: #333; 
    color: var(--primary); 
    border: 1px solid var(--primary); 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: bold; 
}

.feed-user-info { display: flex; flex-direction: column; }
.feed-name { font-weight: bold; font-size: 0.95rem; color: #fff; display: flex; align-items: center; gap: 5px; }
.feed-time { font-size: 0.7rem; color: #888; }
.btn-delete-post { margin-left: auto; background: none; border: none; cursor: pointer; color: #666; padding: 5px; }
/* Pastikan class induk ini tetap seperti fix sebelumnya (biar gak ada gap hantu) */
.feed-content { 
    padding: 0 15px; 
    font-size: 0 !important; 
    line-height: 0 !important;
    margin: 0;
}
/* UBAH BAGIAN INI: Jarak antar elemen teks */
.feed-content div {
    font-size: 0.95rem; 
    font-weight: 600;
    line-height: 1.4; 
    color: #ddd; 
    white-space: pre-wrap; 
    
    margin-top: 0;       /* Atas 0 (karena Header sudah nyumbang 10px) */
    margin-bottom: 12px; /* Jarak Teks ke Gambar/Tombol di bawahnya */
    display: block;
}
/* 3. GAMBAR (Rapat Total) */
.feed-image-wrapper { 
    width: 100%; 
    background: transparent; 
    display: block; 
    line-height: 0; 
    
    margin-top: 0; /* Tetap 0, biar jarak diatur elemen atasnya */
    
    border-bottom: 1px solid rgba(255,255,255,0.05); 
}

.feed-image-wrapper img { 
    width: 100%; 
    height: auto !important; 
    display: block; 
    max-height: 600px; 
    object-fit: cover; 
}


/* Actions Bar */
.feed-actions { 
    display: flex; align-items: center; gap: 20px; 
    padding: 8px 15px; /* Rapat */
}
.btn-feed-action { background: transparent !important; border: none !important; color: #aaa; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 0.9rem; font-weight: 600; padding: 0; }
.btn-feed-action svg { width: 22px; height: 22px; stroke-width: 2px; }
.btn-feed-action.liked { color: #ff4757; }

/* Comments (Default Muncul) */
.comment-section { 
    padding: 10px 15px; background: rgba(0,0,0,0.2); 
    border-top: 1px solid var(--glass-border); 
    display: block !important; 
}
.comment-list { 
    max-height: 150px; /* Batasi tinggi list komentar */
    overflow-y: auto; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; 
}
.comment-input-box { display: flex; gap: 8px; }
.input-rounded { flex: 1; background: rgba(255,255,255,0.05); border: none; border-radius: 20px; padding: 8px 15px; color: #fff; outline: none; }
.btn-send-icon { background: var(--primary); border: none; width: 35px; height: 35px; border-radius: 50%; cursor: pointer; color: #000; font-weight: bold; display: flex; justify-content: center; align-items: center; }
/* --- POSISI FAB DITURUNKAN --- */
.fab-btn {
    position: fixed; 
    bottom: 85px; /* GANTI INI (Turun dari 120px) */
    right: 20px;
    width: 50px; height: 50px; 
    border-radius: 50%;
    background: rgba(57, 255, 20, 0.2); 
    border: 1px solid var(--primary);
    backdrop-filter: blur(5px); 
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    z-index: 900; 
    cursor: pointer; 
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.3);
}
.fab-btn svg { width: 24px; height: 24px; }

/* =========================================
   5. SIDEBAR UI
   ========================================= */
.sidebar-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); z-index: 1001; }
.sidebar {
    position: fixed; top: 0; right: -300px; width: 280px; height: 100%;
    background: #111; border-left: 1px solid var(--primary);
    z-index: 1002; transition: right 0.3s; padding: 20px;
    display: flex; flex-direction: column;
}
.sidebar.active { right: 0; }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; color: var(--primary); font-family: var(--font-heading); }
#btn-close-sidebar { background: transparent !important; border: none !important; color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; }

.profile-upload-wrapper { width: 90px; height: 90px; margin: 0 auto 15px; position: relative; }
#sidebar-avatar { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; border: 2px solid var(--primary); background: #000; }
#sidebar-avatar img, .avatar-img-custom { width: 100%; height: 100%; object-fit: cover; }
.avatar-letter { width: 100%; height: 100%; background: #333; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: bold; }

.edit-icon { position: absolute; bottom: 0; right: -5px; width: 30px; height: 30px; background: var(--primary); border-radius: 50%; border: 3px solid #111; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #000; }
.edit-icon svg { width: 16px; height: 16px; }

.sidebar-form { width: 100%; margin-top: 15px; }
.sidebar-form label { color: #888; font-size: 0.8rem; margin-bottom: 5px; display: block; }
.input-sidebar { width: 100%; background: #222; border: 1px solid #333; padding: 10px; color: #fff; border-radius: 8px; margin-bottom: 10px; }
.btn-sidebar { width: 100%; padding: 10px; border-radius: 8px; border: none; font-weight: bold; cursor: pointer; margin-top: 5px; }
.btn-sidebar.primary { background: var(--primary); color: #000; }
.btn-sidebar.danger { background: rgba(255,0,0,0.1); color: #ff4757; border: 1px solid #ff4757; }
.sidebar-details { text-align: center; margin-bottom: 20px; }
.status-badge { font-size: 0.7rem; background: #222; padding: 2px 8px; border-radius: 10px; color: #aaa; }

/* =========================================
   6. CHAT UI (FIXED CARD & LIST)
   ========================================= */
/* HALAMAN DAFTAR CHAT - HITAM DENGAN PATTERN ARTISTIK */
#page-chat { 
    padding-bottom: 0 !important; /* Hapus padding bawah */
    position: fixed; 
    inset: 0; 
    z-index: 500; 
    
    /* WARNA DASAR: Hitam Pekat */
    background-color: #050505; 

    /* PATTERN: Garis Diagonal Halus & Semburat Cahaya */
    background-image: 
        /* Efek cahaya redup di pojok agar dimensi terlihat */
        radial-gradient(at 0% 0%, rgba(57, 255, 20, 0.05) 0, transparent 50%),
        /* Pola Garis Diagonal Tipis */
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.02) 0px, rgba(255, 255, 255, 0.02) 1px, transparent 1px, transparent 15px);
    
    display: flex; 
    flex-direction: column;
    height: 100dvh;
}

/* HEADER: Hitam Solid Sesuai Permintaan */
#chat-header { 
    height: 70px; 
    background: #000000; 
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 20px;
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    z-index: 800;
}

/* KARTU CHAT: Efek Glass yang Kontras di atas Hitam Pattern */
.chat-card {
    display: flex; 
    align-items: center; 
    gap: 15px; 
    padding: 16px; 
    margin: 0 12px 12px 12px;
    cursor: pointer; 
    border-radius: 18px;
    
    /* Efek Kaca Frosted */
    background: rgba(255, 255, 255, 0.04); 
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    
    /* Border Putih Tipis agar Sudut Kaca Terlihat */
    border: 1px solid rgba(255, 255, 255, 0.12); 
    
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

/* Efek Klik pada Kartu */
.chat-card:active {
    transform: scale(0.97);
    background: rgba(57, 255, 20, 0.05); /* Sedikit glow hijau saat ditekan */
}


#chat-header { 
    height: 70px; 
    background: #000000; /* Hitam pekat, tidak transparan */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 800;
}

/* LIST CHAT VIEWPORT */
.chat-viewport { 
    flex: 1; 
    display: flex;
    flex-direction: column;
    overflow-y: scroll;
    padding: 10px;
    padding-bottom: 120px; /* Beri ruang lebih untuk menu bawah */
    background: transparent; /* Pastikan transparan */
    scrollbar-width: none; 
}

.chat-viewport::-webkit-scrollbar {
    display: none;
}


/* Menghilangkan batang scroll di Chrome/Safari */
.chat-viewport::-webkit-scrollbar {
    display: none;
}


/* Card User (TEBALKAN BACKGROUND BIAR KELIHATAN) */
.chat-card {
    display: flex; 
    align-items: center; 
    gap: 15px; 
    padding: 16px; 
    margin: 0 12px 12px 12px;
    cursor: pointer; 
    border-radius: 20px;
    
    /* Efek Kaca */
    background: rgba(255, 255, 255, 0.03); 
    backdrop-filter: blur(25px) saturate(120%);
    -webkit-backdrop-filter: blur(25px) saturate(120%);
    
    /* Border sebagai kilauan kaca */
    border: 1px solid rgba(255, 255, 255, 0.1); 
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.chat-card:active {
    transform: scale(0.96);
    background: rgba(57, 255, 20, 0.05);
    border-color: var(--primary);
}

.chat-avatar-wrapper { position: relative; }
.chat-list-avatar { 
  width: 50px; height: 50px; 
  border-radius: 50%; object-fit: cover; border: 2px solid #333; 
  transition: all 0.3s ease;
  
}
.online-dot { position: absolute; bottom: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%; background: #555; border: 2px solid #000; }
.online-dot.active { background: var(--primary); }
.chat-list-info { flex: 1; overflow: hidden; }
.chat-list-name { font-weight: bold; color: #fff; font-size: 1rem; }
.chat-list-time { font-size: 0.7rem; color: var(--primary); }
.chat-list-preview { color: #aaa; font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ROOM CHAT DENGAN BACKGROUND MESH GRADIENT */
#chat-room-view {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #0a0a0a;
    background-image: 
        radial-gradient(circle at center, rgba(57, 255, 20, 0.03) 0%, transparent 70%),
        radial-gradient(rgba(57, 255, 20, 0.05) 1px, transparent 0);
    background-size: 100% 100%, 30px 30px;
    
    display: flex;
    flex-direction: column;
    z-index: 100;
    padding-top: 75px; 
}

#messages-container { 
    flex: 1; 
    overflow-y: auto;
    padding: 15px; 
    /* Tambahkan padding bawah lebih besar agar pesan terakhir tidak tertutup input melayang */
    padding-bottom: 110px; 
    display: flex; 
    flex-direction: column; 
    gap: 8px;
}

/* Bubbles */
.msg-bubble-row { display: flex; margin-bottom: 5px; width: 100%; }
.msg-bubble-row.me { justify-content: flex-end; }
.msg-bubble-row.other { justify-content: flex-start; }

.msg-content { 
    width: fit-content; 
    max-width: 80%; 
    padding: 1px 1px; 
    border-radius: 1px; 
    font-size: 2rem; 
    line-height:1.7; 
    word-wrap: break-word;
    /* Tambahkan ini */
    
}

/* FIX: Bubble Kita (Hijau Tua) */
.my-msg { background: var(--chat-bubble-me) !important; color: #fff !important; border-top-right-radius: 0; border: 1px solid #0b4f41; }
.their-msg { background: #222; color: #fff; border: 1px solid #333; border-top-left-radius: 0; }

.msg-meta { font-size: 0.65rem; text-align: right; margin-top: 3px; opacity: 0.8; display: flex; align-items: center; justify-content: flex-end; gap: 4px; color: rgba(255,255,255,0.7); }

/* FIX: Centang Biru (Override style inline JS) */
.msg-meta span[style*="color:#39FF14"], .msg-meta span[style*="color: rgb(57, 255, 20)"] { color: var(--tick-read) !important; }

/* Input Chat */
.chat-input-area { 
    position: fixed; 
    bottom: 10px; /* Jarak dari bawah */
    left: 15px;
    right: 15px;
    
    /* Efek Glassmorphism lebih kuat */
    background: rgba(255, 255, 255, 0.05); 
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    
    border: 1px solid rgba(255, 255, 255, 0.15); 
    border-radius: 30px;
    padding: 8px 18px; 
    
    display: flex; 
    align-items: flex-end; 
    gap: 12px; 
    z-index: 700; 
    box-shadow: 0 15px 35px rgba(0,0,0,0.6);
}

/* Hilangkan garis border bawaan pada textarea agar bersih */
#chat-input-text {
    flex: 1;
    background: transparent !important; /* Transparan karena background sudah di area */
    border: none !important;
    padding: 10px 5px;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
}

#chat-input-text { flex: 1; background: rgba(255,255,255,0.1); border: none; border-radius: 20px; padding: 12px 15px; color: #fff; font-size: 1rem; max-height: 100px; outline: none; }
#btn-send-chat { width: 45px; height: 45px; border-radius: 50%; background: var(--primary); border: none; cursor: pointer; flex-shrink: 0; color: #000; display: flex; align-items: center; justify-content: center; }
#btn-back-chat {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;  /* Diperkecil dari 40px */
    height: 30px; /* Diperkecil dari 40px */
    background: transparent;
    border: none;
    color: var(--primary); 
    cursor: pointer;
    margin-left: -5px;  /* Membuatnya mepet ke sisi kiri layar */
    margin-right: 2px;  /* Jarak dengan PP */
    padding: 0;
}

#btn-back-chat svg {
    width: 22px;  /* Ukuran icon disesuaikan */
    height: 22px;
    stroke-width: 2.5px; /* Tetap tebal agar terlihat jelas meski kecil */
}

/* Pastikan container header tidak memiliki padding kiri yang terlalu besar */
#header-mode-room {
    display: flex;
    align-items: center;
    padding: 10px 10px 10px 5px; /* Padding kiri dikurangi jadi 5px */
    gap: 5px; /* Jarak antar elemen di header dipersempit */
}


/* =========================================
   7. MODALS (LIST USER LIMIT 5)
   ========================================= */
.auth-modal, .post-modal, #modal-users-list {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.85); backdrop-filter: blur(5px);
    display: flex; align-items: center; justify-content: center; padding: 20px;
}

/* FIX: LIST USER (TAMBAH CHAT) CUMA 5 ITEM */
#all-users-container { 
    width: 100%; max-width: 500px; 
    background: #111; 
    /* FIX: Tinggi max 55vh (Cukup untuk 5-6 item), lalu scroll */
    max-height: 55vh; 
    overflow-y: auto; 
    border-radius: 20px; 
    padding: 10px; 
}
.user-row-item { display: flex; align-items: center; gap: 15px; padding: 15px; border-bottom: 1px solid rgba(255,255,255,0.1); cursor: pointer; }

/* Post Modal (Preview Bawah) */
.glass-editor-box { width: 100%; max-width: 500px; background: #111; border: 1px solid #333; border-radius: 20px; overflow: hidden; display: flex; flex-direction: column; }
.editor-header { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; border-bottom: 1px solid #222; }
.editor-title { font-family: var(--font-heading); color: #fff; margin: 0; }
.btn-close-icon { background: transparent !important; border: none !important; color: #888; font-size: 2rem; line-height: 1; cursor: pointer; width: auto; padding: 0; }

.editor-body { padding: 20px; background: #0a0a0a; display: flex; flex-direction: column; }
.editor-textarea { width: 100%; min-height: 100px; background: transparent; border: none; color: #fff; font-size: 1.1rem; resize: none; outline: none; margin-bottom: 10px; }

/* --- PERBAIKAN MODAL PREVIEW --- */
.preview-zone { 
    position: relative; 
    border-radius: 8px; 
    overflow: hidden; 
    border: 1px solid #333; 
    background: #000; /* Background hitam biar estetik */
    width: 100%;
    height: 200px; /* Tetapkan tinggi area preview */
    margin-top: 10px; 
    display: flex;             /* Gunakan Flex */
    justify-content: center;   /* Biar gambar di tengah horizontal */
    align-items: center;       /* Biar gambar di tengah vertikal */
    order: 2; 
}

.preview-zone img { 
    width: auto;          /* Lebar otomatis */
    height: auto;         /* Tinggi otomatis */
    max-width: 100%;      /* Mentok lebar container */
    max-height: 100%;     /* Mentok tinggi container */
    object-fit: contain;  /* KUNCI: Gambar menyusut proporsional (tidak crop) */
    display: block; 
}

.btn-remove-preview { position: absolute; top: 5px; right: 5px; background: rgba(0,0,0,0.6); color: #fff; border: none; width: 25px; height: 25px; border-radius: 50%; cursor: pointer; }

.editor-footer { padding: 15px 20px; background: rgba(255,255,255,0.02); border-top: 1px solid #222; display: flex; justify-content: space-between; align-items: center; }
.tool-btn { color: var(--primary); display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 0.9rem; }
.btn-submit-post { background: var(--primary); border: none; padding: 8px 24px; border-radius: 20px; font-weight: bold; cursor: pointer; color: #000; }
/* =========================================
   LOGIN MODAL RE-DESIGN (PREMIUM LOOK)
   ========================================= */

/* Pastikan logo tidak kebesaran */
.auth-logo {
    width: 60px; /* Ukuran logo kecil & proporsional */
    height: auto;
    margin-bottom: 15px;
}

/* Box utama login */
.auth-box {
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(57, 255, 20, 0.2);
    padding: 40px 30px;
    border-radius: 24px;
    width: 90%;
    max-width: 380px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* Judul Welcome */
.auth-title {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.auth-desc {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 30px;
}

/* Form Input */
.auth-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 18px;
    border-radius: 12px;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.auth-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(57, 255, 20, 0.05);
    box-shadow: 0 0 15px rgba(57, 255, 20, 0.1);
}

/* Tombol Masuk */
.btn-auth {
    width: 100%;
    background: var(--primary);
    color: #000;
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s active;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 10px;
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(57, 255, 20, 0.4);
}

.btn-auth:active {
    transform: translateY(0);
}

/* Tombol Nanti Saja */
.auth-link {
    color: #666;
    font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.3s;
    text-decoration: none;
}

.auth-link:hover {
    color: var(--primary);
}


/* =========================================
   8. FITUR BARU (REPLY, GROUP, SCROLL)
   ========================================= */

/* --- A. SCROLL TO BOTTOM BUTTON --- */
#btn-scroll-bottom {
    position: absolute;
    bottom: 80px; /* Di atas input area */
    right: 20px;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid var(--primary);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 800;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    transition: transform 0.2s, opacity 0.2s;
    
    /* FITUR KHUSUS: Gak bisa disalin/blok teksnya */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none; 
}
#btn-scroll-bottom.hidden {
    opacity: 0; pointer-events: none; transform: translateY(10px);
}

/* --- B. REPLY PREVIEW (DI ATAS INPUT) --- */
/* Box Preview Melayang (Floating) */
#reply-preview-box {
    position: absolute;
    /* KUNCI UTAMA: 100% berarti tepat di atas container, 
       tambah 10px biar ada celah udara (gap) */
    bottom: calc(100% + 10px); 
    left: 15px;
    right: 15px;
    
    background: rgba(10, 10, 10, 0.98); /* Lebih solid biar teks chat di belakang gak tembus */
    backdrop-filter: blur(20px);
    border: 1px solid var(--primary);
    border-radius: 15px;
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -10px 25px rgba(0,0,0,0.6); /* Shadow lebih kuat ke atas */
    animation: popUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    
    /* Z-INDEX harus lebih tinggi dari input area agar tidak tertindih */
    z-index: 999; 
}

/* Tambahan sedikit pada container induknya agar posisi absolutnya pas */
.chat-room-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 800;
    /* Pastikan tidak ada overflow hidden di sini agar preview tidak terpotong */
}

@keyframes popUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.reply-border {
    border-left: 3px solid var(--primary);
    padding-left: 10px;
    flex: 1;
    overflow: hidden;
}

.reply-name {
    color: var(--primary);
    font-weight: bold;
    font-size: 0.75rem;
    display: block;
}

.reply-text-preview {
    color: #ccc;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

/* Tombol silang untuk batal */
#btn-cancel-reply {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 5px;
}


/* --- C. MESSAGE CONTEXT MENU (TEKAN LAMA/KLIK) --- */
.msg-options-menu {
    position: absolute;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 5px;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    display: flex; flex-direction: column; min-width: 120px;
}
.msg-opt-btn {
    background: none; border: none; color: white;
    padding: 10px; text-align: left; cursor: pointer;
    font-size: 0.9rem; display: flex; align-items: center; gap: 8px;
}
.msg-opt-btn:hover { background: rgba(255,255,255,0.1); }
.msg-opt-btn.danger { color: #ff4757; }

/* --- D. TAMPILAN PESAN REPLY & EDIT --- */
.reply-content-bubble {
    background: rgba(0,0,0,0.2);
    border-left: 3px solid var(--primary);
    padding: 5px 8px;
    margin-bottom: 5px;
    border-radius: 4px;
    font-size: 0.75rem; color: #ccc;
    cursor: pointer;
}
.edited-label { font-size: 0.6rem; color: #888; margin-left: 5px; font-style: italic; }

/* --- E. MODAL BUAT GROUP --- */
.group-creator-box {
    width: 100%; max-width: 400px; background: #111;
    border: 1px solid var(--primary); border-radius: 16px;
    padding: 20px; display: flex; flex-direction: column; gap: 15px;
}
/* =========================================
   9. UPDATE ICONS & GROUP INFO UI
   ========================================= */

/* A. Styling Icon SVG Pengganti Emoji */
.icon-svg {
    width: 20px; height: 20px;
    stroke: currentColor; stroke-width: 2;
    fill: none; stroke-linecap: round; stroke-linejoin: round;
    transition: 0.2s;
}
.icon-svg.filled { fill: #ff4757; stroke: #ff4757; } /* Untuk Like */

/* B. Modal Info Grup */
.group-info-header { text-align: center; margin-bottom: 20px; }
.group-info-avatar { 
    width: 80px; height: 80px; border-radius: 50%; 
    border: 2px solid var(--primary); 
    object-fit: cover; margin: 0 auto 10px; 
    display: block;
}
.member-list-container {
    max-height: 200px; overflow-y: auto;
    background: rgba(255,255,255,0.03);
    border-radius: 10px; padding: 10px;
    margin-bottom: 15px; border: 1px solid #333;
}
.member-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.badge-admin { 
    font-size: 0.6rem; background: var(--primary); color: #000; 
    padding: 2px 6px; border-radius: 4px; font-weight: bold; 
}

/* C. Override Tombol Aksi */
.btn-feed-action { gap: 8px; } /* Jarak icon ke angka */
/* =========================================
   FIX: ALIGNMENT ICON FEED (UPDATE)
   ========================================= */
.btn-feed-action {
    display: flex !important;
    align-items: center !important;
    justify-content: center;
    gap: 6px;       /* Jarak ideal icon ke angka */
    height: 32px;   /* Tinggi tombol konsisten */
    padding: 0 8px; /* Padding kiri kanan dikit */
    line-height: 1; /* Reset tinggi baris */
}

/* Pastikan Icon SVG ukurannya pas & tidak geser */
.btn-feed-action svg, .icon-svg {
    display: block; /* Supaya tidak ada gap bawah */
    width: 20px !important; 
    height: 20px !important;
    flex-shrink: 0; /* Icon dilarang gepeng */
    margin-bottom: 0;
}

/* Rapikan Angkanya */
.btn-feed-action span {
    font-size: 0.85rem;
    font-weight: 500;
    position: relative;
    top: 1px; /* Trik visual biar sejajar mata dengan icon */
}
/* =========================================
   UPDATE: SVG ICONS REPLACEMENT
   ========================================= */
.icon-svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.2s ease;
}

/* Efek Hover & Active untuk Icon */
.btn-feed-action:hover .icon-svg {
    transform: scale(1.1);
}
.btn-feed-action.liked .icon-svg {
    fill: #ff4757; /* Isi hati dengan warna merah */
    stroke: #ff4757;
}

/* Tombol Hapus Postingan */
.btn-delete-post {
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #ff4757;
    margin-left: auto;
    transition: 0.2s;
}
.btn-delete-post:hover {
    background: #ff4757;
    color: white;
}
/* =========================================
   UPDATE: MENU OPSI PESAN (ICON MODE)
   ========================================= */
.msg-options-menu {
    display: flex;
    flex-direction: row; /* Berjejer ke samping */
    gap: 5px;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid var(--primary);
    padding: 8px;
    border-radius: 50px; /* Bentuk kapsul */
    box-shadow: 0 5px 20px rgba(0,0,0,0.6);
    min-width: auto;
}

.msg-opt-btn {
    background: transparent;
    border: none;
    color: #fff;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    width: 36px;
    height: 36px;
}

.msg-opt-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.msg-opt-btn.danger { color: #ff4757; }
.msg-opt-btn svg { width: 20px; height: 20px; stroke-width: 2; }

/* Tombol Permintaan Pesan */
.btn-request-badge {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    display: flex; justify-content: space-between; align-items: center;
}
.btn-request-badge:hover { background: rgba(57, 255, 20, 0.1); }

/* Bar Terima/Tolak */
.request-action-bar {
    position: absolute; top: 70px; left: 0; right: 0;
    background: rgba(0,0,0,0.9); border-bottom: 1px solid #333;
    padding: 10px 20px; z-index: 50;
    display: flex; justify-content: space-between; align-items: center;
}
.request-text { font-size: 0.8rem; color: #ccc; }
/* --- FITUR SCROLL TO BOTTOM --- */
#btn-scroll-bottom {
    position: absolute;
    bottom: 90px; /* Di atas input bar */
    right: 20px;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: rgba(30, 30, 30, 0.9);
    border: 1px solid var(--primary);
    color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 650;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    transition: opacity 0.3s, transform 0.3s;
}
#btn-scroll-bottom.hidden {
    opacity: 0; pointer-events: none; transform: translateY(20px);
}

/* Container utama untuk setiap baris user */
#quick-add-list > div {
    display: flex;
    align-items: center; /* Membuat semua konten rata tengah secara vertikal */
    padding: 12px;
    gap: 15px; /* Memberi jarak antara PP dan Teks */
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    text-align: left; /* Memastikan teks rata kiri */
}

/* Mengatur agar teks (Nama & Username) bertumpuk vertikal di samping PP */
.user-info-wrapper {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Teks rata kiri */
    flex: 1; /* Mengambil sisa ruang agar tombol aksi tetap di kanan */
}

/* Memastikan Badge Verified tetap sejajar dengan nama */
.name-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Menghilangkan container list secara default */
.hidden {
    display: none !important;
}

/* Scrollbar cantik untuk list tambah member */
#quick-add-list::-webkit-scrollbar {
    width: 4px;
}
#quick-add-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

/* Hover effect pada list */
#quick-add-list div:hover {
    background: rgba(255, 255, 255, 0.05);
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes slideDown {
    from { transform: translateY(0); }
    to { transform: translateY(100%); }
}

/* Biar list user kalau diklik ada efeknya */
.user-row-item:active {
    background: #111 !important;
}


#add-member-panel {
    background-color: #050505 !important;
}

.user-row-item:active {
    background: rgba(255, 255, 255, 0.05);
}
/* Gaya Editor di Modal Post */
/* Gaya Editor di Modal Post */
#cp-editor, 
.rich-editor {
    width: 100%;
    min-height: 150px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    color: white;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.6;

    /* KUNCI OTOMATIS: Mendeteksi arah per baris/paragraf */
    unicode-bidi: plaintext !important; 
    text-align: start !important;
    
    /* Jangan isi direction: ltr atau rtl di sini agar dir="auto" bekerja */
    
    white-space: pre-wrap;
    word-break: break-word;
}

/* Placeholder agar tetap rapi */
.rich-editor:empty:before {
    content: attr(placeholder);
    color: rgba(255, 255, 255, 0.3);
}

/* Pastikan caption di feed juga otomatis */
.post-caption {
    unicode-bidi: plaintext !important;
    text-align: start !important;
    direction: ltr; /* ltr di sini bukan memaksa ke kiri, tapi basis untuk unicode-bidi */
    line-height: 1.6; /* Sangat penting untuk teks Arab agar harakat tidak terpotong */
}

/* Memperbaiki kursor di editor saat mengetik Arab */
.rich-editor div {
    unicode-bidi: plaintext;
    text-align: start;
}


/* Pastikan section komentar tetap aman */
.comment-section {
    clear: both; /* Memastikan tidak terpengaruh elemen di atasnya */
    width: 100%;
}


/* Jika ada link atau tag di dalam caption agar tidak merusak layout */
.post-caption * {
    unicode-bidi: plaintext;
}

/* Update pada Card Postingan, Bubble Chat, dan Komentar */
.post-caption, 
.chat-bubble-text, 
.comment-item {
    /* Gunakan unicode-bidi plaintext agar browser mendeteksi 
       karakter pertama di setiap paragraf */
    unicode-bidi: plaintext;
    
    /* Gunakan 'start' bukan 'left', agar mengikuti arah teks */
    text-align: start; 
    
    /* Jangan paksa direction: ltr di sini jika ingin otomatis */
    direction: initial; 
    
    /* Tambahan agar spasi teks Arab tetap rapi */
    line-height: 1.6; 
}

/* Khusus untuk area input (Rich Editor) */
.rich-editor[contenteditable="true"] {
    /* Properti khusus untuk elemen yang bisa diedit */
    direction: auto;
    text-align: start;
    unicode-bidi: plaintext;
}

/* Menghilangkan jarak berlebih di wrapper gambar */
.feed-image-wrapper {
    margin-top: 2px !important; /* Nyaris menempel dengan teks */
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Preview gambar saat di Modal (saat mau post) */
#image-preview-container {
    margin-top: 0px !important;
    padding: 10px;
}

/* Mencegah nama merusak layout header postingan */
.feed-name {
    max-width: 140px; /* Batas lebar nama */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Akan jadi: NamaPanjang... */
    display: flex;
    align-items: center;
}
/* Mencegah card memanjang tanpa batas */
.feed-item {
    max-height: 800px; /* Batas maksimal tinggi satu postingan */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Memperbaiki konten teks agar tidak merusak layout */
.feed-content {
    word-break: break-word; /* Memotong kata yang sangat panjang tanpa spasi */
    overflow-wrap: break-word;
    max-height: 400px; /* Batas tinggi teks sebelum di-scroll */
    overflow-y: auto; /* Munculkan scroll tipis jika teks sangat panjang */
    padding-right: 5px;
}

/* Custom scrollbar tipis untuk teks yang kepanjangan */
.feed-content::-webkit-scrollbar {
    width: 3px;
}
.feed-content::-webkit-scrollbar-thumb {
    background: rgba(57, 255, 20, 0.3);
    border-radius: 10px;
}

/* Memastikan gambar tetap proporsional */
.post-img-zoom {
    width: 100%;
    height: auto;
    max-height: 350px; /* Batasi tinggi gambar agar tidak makan tempat */
    object-fit: cover;
    display: block;
}
#chat-input-text {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: #fff;
    padding: 10px 15px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none; /* User tidak bisa tarik manual */
    max-height: 120px; /* Batas tinggi maksimal */
    line-height: 1.4;
    overflow-y: auto; /* Muncul scrollbar jika sangat panjang */
    display: block;
}

/* Memastikan area input chat sejajar di bawah saat textarea meninggi */
.chat-input-area {
    display: flex;
    align-items: flex-end; 
    gap: 10px;
    padding: 10px 15px;
}
/* Balon Chat Saya */
.my-msg {
    border-radius: 18px 18px 4px 18px !important;
    margin-right: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Balon Chat Lawan */
.their-msg {
    border-radius: 18px 18px 18px 4px !important;
    margin-left: 5px;
    background: rgba(40, 40, 40, 0.9) !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
/* Style Tombol Muat Lebih Banyak */
.load-more-container {
    padding: 30px 15px;
    text-align: center;
}

.btn-load-more {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px dashed rgba(57, 255, 20, 0.4);
    color: var(--primary);
    padding: 12px 30px;
    border-radius: 50px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 300px;
}

.btn-load-more:hover {
    background: rgba(57, 255, 20, 0.1);
    border-style: solid;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(57, 255, 20, 0.1);
}

.btn-load-more:active {
    transform: translateY(0);
}
.btn-style {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    border-radius: 4px;
    padding: 5px 8px;
    cursor: pointer;
    font-size: 12px;
}
.hl-btn { font-weight: bold; border: none; }
mark.hl-green { background: #39FF14; color: #000; padding: 0 4px; border-radius: 2px; }
mark.hl-yellow { background: #ffff00; color: #000; padding: 0 4px; border-radius: 2px; }
mark.hl-white { background: #ffffff; color: #000; padding: 0 4px; border-radius: 2px; }
.rich-editor {
    min-height: 150px;
    max-height: 300px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    color: white;
    overflow-y: auto;
    outline: none;
    line-height: 1.6;
}

.rich-editor:empty:before {
    content: attr(placeholder);
    color: rgba(255, 255, 255, 0.3);
}

.btn-tool {
    width: 35px;
    height: 35px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.2);
    background: #222;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.btn-tool:active { background: var(--primary); color: black; }

/* Warna tombol stabilo */
.hl-green { background: #39FF14; }
.hl-yellow { background: #ffff00; }
.hl-white { background: #ffffff; }
/* Keadaan Default (Belum Aktif / Izin Belum Diberikan) */
#notif-toggle {
    color: rgba(255, 255, 255, 0.4); /* Warna redup */
    transition: all 0.3s ease;
}

/* Keadaan Aktif (Izin Granted) */
#notif-toggle.notif-active {
    color: #ffce00; /* Warna kuning emas cerah */
    filter: drop-shadow(0 0 5px rgba(255, 206, 0, 0.4));
}

/* Animasi Lonceng Goyang saat ada pesan baru */
.bell-ring {
    animation: ring-animation 0.5s ease-in-out infinite;
}

@keyframes ring-animation {
    0% { transform: rotate(0); }
    25% { transform: rotate(15deg); }
    50% { transform: rotate(-15deg); }
    75% { transform: rotate(10deg); }
    100% { transform: rotate(0); }
}
/* =========================================
   AMOGENZ VIBE ADDONS (MUSIC & GIF)
   ========================================= */

/* Container untuk input tambahan di modal */
.vibe-addons {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 15px;
    padding-top: 15px;
}

/* Styling Input GIF & Music */
#cp-gif-search {
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

#cp-gif-search:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.2);
    background: rgba(255, 255, 255, 0.08) !important;
}

/* Grid Hasil Pencarian GIF */
#gif-results img {
    transition: transform 0.2s ease, filter 0.2s ease;
    border: 1px solid rgba(255,255,255,0.05);
}

#gif-results img:hover {
    transform: scale(1.05);
    filter: brightness(1.2);
    z-index: 2;
}

/* Player Musik di Feed (Vibe Player) */
.vibe-player {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(57, 255, 20, 0.1) 0%, rgba(0, 0, 0, 0.4) 100%) !important;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.vibe-player:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
}

/* Custom Audio Player Styling (Invert Color for Dark Mode) */
.vibe-player audio {
    width: 100%;
    height: 32px;
    filter: invert(1) hue-rotate(90deg) brightness(1.5); /* Membuat player jadi hijau neon */
    opacity: 0.8;
}

/* Preview GIF yang sudah dipilih di modal */
#selected-gif-preview {
    animation: fadeIn 0.4s ease;
}

#selected-gif-preview img {
    box-shadow: 0 0 20px rgba(57, 255, 20, 0.1);
}

/* Tombol Hapus GIF */
#btn-remove-gif {
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    transition: all 0.2s ease;
}

#btn-remove-gif:hover {
    transform: scale(1.1);
    background: #ff3333 !important;
}

/* Status Upload */
#audio-status {
    animation: pulse 1.5s infinite;
    letter-spacing: 0.5px;
}

/* Animasi */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Scrollbar khusus untuk GIF Search agar tidak merusak UI */
#gif-results::-webkit-scrollbar {
    width: 4px;
}
#gif-results::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}
/* =========================================
   FIX MODAL POST (ANTI TEMBUS LAYAR)
   ========================================= */

#post-modal .modal-content {
    max-height: 90vh; /* Maksimal 90% tinggi layar */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Potong bagian yang luber */
    padding: 0; /* Kita atur padding di dalam body */
}

/* Header Modal Tetap di Atas */
#post-modal .modal-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

/* Body Modal Bisa Di-scroll */
#post-modal .modal-body {
    padding: 20px;
    overflow-y: auto; /* Aktifkan scroll hanya di sini */
    flex-grow: 1;
}

/* Footer Modal (Tombol Post) Tetap di Bawah */
#post-modal .modal-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--glass-bg);
    flex-shrink: 0;
}

/* Rapikan area Editor agar tidak terlalu memakan tempat awal */
.rich-editor {
    min-height: 120px;
    max-height: 200px; /* Batasi tinggi editor teks */
    overflow-y: auto;
}

/* Rapikan Grid GIF agar lebih padat */
#gif-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 200px; /* Batasi tinggi hasil pencarian GIF */
    overflow-y: auto;
    padding-right: 5px;
}

/* Scrollbar Cantik untuk Modal */
#post-modal .modal-body::-webkit-scrollbar,
#gif-results::-webkit-scrollbar {
    width: 5px;
}

#post-modal .modal-body::-webkit-scrollbar-thumb,
#gif-results::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}
.vibe-ready {
    visibility: visible !important;
    opacity: 1 !important;
    display: flex !important;
    scale: 1;
    transition: transform 0.2s active;
}

.vibe-ready:active {
    transform: scale(0.95);
}

.feed-actions {
    min-height: 40px; /* Memastikan baris aksi tidak menciut */
}
/* Container Utama agar item ada di tengah */
.post-modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    align-items: center; 
    justify-content: center;
    z-index: 9999;
    padding: 15px; /* Biar gak nempel tembok layar HP */
}

/* Box Editornya */
.glass-editor-box {
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(20px);
    width: 100%;
    max-width: 500px;
    /* BATASAN TINGGI */
    max-height: 90vh; 
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column; /* Header, Body, Footer disusun vertikal */
    overflow: hidden; /* Biar lengkungan pojok tetap rapi */
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

/* Header & Footer: Biar diam (Static) */
.editor-header, .editor-footer {
    flex-shrink: 0; /* Jangan biarkan mereka mengecil */
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.02);
}

/* Body: Bagian yang bisa di-scroll */
.editor-body {
    flex: 1; /* Ambil sisa ruang */
    overflow-y: auto; /* KUNCI: Munculkan scrollbar jika konten kepanjangan */
    padding: 0 20px 20px 20px;
    scrollbar-width: thin; /* Untuk Firefox */
    scrollbar-color: var(--primary) transparent;
    overscroll-behavior: contain; /* Mencegah scroll bocor ke background */
    scrollbar-gutter: stable; /* Mencegah layout geser saat scrollbar muncul */
}
}

/* Bagian Vibe Addons agar menyatu di dalam scroll */
.vibe-addons {
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: 10px;
}

/* Custom Scrollbar untuk Chrome/Edge/Safari */
.editor-body::-webkit-scrollbar {
    width: 5px;
}
.editor-body::-webkit-scrollbar-thumb {
    background: #39FF14;
    border-radius: 10px;
}
/* 1. Kunci Tinggi Maksimal Modal agar tidak tembus layar */
.glass-editor-box {
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(20px);
    width: 100%;
    max-width: 500px;
    
    /* KUNCI: Tinggi modal maksimal 85% dari layar HP */
    max-height: 85vh; 
    
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column; /* Menyusun Header, Body, Footer secara vertikal */
    overflow: hidden; /* Potong konten yang keluar dari radius pojok */
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

/* 2. Header dan Footer tetap diam di tempat (Sticky-like) */
.editor-header, .editor-footer {
    flex-shrink: 0; /* Mencegah header/footer gepeng saat konten penuh */
    padding: 15px 20px;
}

/* 3. Body adalah satu-satunya bagian yang boleh scroll */
.editor-body {
    flex: 1; /* Ambil semua sisa ruang yang tersedia */
    overflow-y: auto; /* Aktifkan scroll di sini */
    padding: 10px 20px 20px 20px;
    
    /* Smoothness */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* 4. Bagian Khusus Hasil Pencarian GIF */
#gif-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
    
    /* Jangan biarkan area pencarian GIF terlalu tinggi 
       agar user masih bisa lihat teks editor di atasnya */
    max-height: 250px; 
    
    overflow-y: auto;
    padding: 5px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.3);
    overscroll-behavior: contain; /* Penting: Scroll GIF gak bikin Modal ikut gerak */
}

/* 5. Preview GIF yang sudah terpilih */
#selected-gif-preview {
    width: 100%;
    margin-top: 15px;
    border-radius: 12px;
    overflow: hidden;
    max-height: 200px; /* Batasi tinggi preview GIF yang sudah dipilih */
    display: flex;
    justify-content: center;
    background: #000;
}

#selected-gif-preview img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}
/* Container Addons (Audio & GIF) */
.vibe-addons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin-top: 10px;
}

/* Grouping Input */
.addon-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.addon-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Search Bar GIF */
#cp-gif-search {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 15px;
    color: #fff;
    outline: none;
    transition: 0.3s;
}

#cp-gif-search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(57, 255, 20, 0.2);
}

/* Grid Hasil GIF */
#gif-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    margin-top: 10px;
}

#gif-results img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.2s;
}

#gif-results img:hover {
    transform: scale(1.05);
}

/* Custom Audio Upload Button */
.custom-audio-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(57, 255, 20, 0.05);
    border: 1px dashed var(--primary);
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
    justify-content: center;
}

.custom-audio-upload:hover {
    background: rgba(57, 255, 20, 0.1);
}

#audio-status {
    font-size: 0.8rem;
    color: var(--primary);
    margin-top: 5px;
    text-align: center;
    font-weight: bold;
}
/* Container Utama */
.post-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center; 
    justify-content: center;
    z-index: 2000;
    padding: 10px; /* Jarak aman di HP */
}

/* Box Modal */
.glass-editor-box {
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(25px);
    width: 100%;
    max-width: 500px;
    /* KUNCI: Batasi tinggi maksimal agar tidak tembus layar */
    max-height: 85vh; 
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column; /* Header, Body, Footer disusun vertikal */
    overflow: hidden; 
    box-shadow: 0 25px 50px rgba(0,0,0,0.9);
}

/* Header & Footer: Tetap Diam (Sticky) */
.editor-header, .editor-footer {
    flex-shrink: 0; 
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.02);
    z-index: 10;
}

/* BODY: Bagian yang bisa di-scroll total */
.editor-body {
    flex: 1; /* Ambil sisa ruang */
    overflow-y: auto; /* Izinkan scroll vertikal */
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    
    /* Scroll halus di iOS */
    -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar Body agar tidak kaku */
.editor-body::-webkit-scrollbar {
    width: 4px;
}
.editor-body::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

/* Perbaikan Area Preview agar pas di dalam scroll */
#image-preview-container, 
#selected-gif-preview {
    width: 100%;
    max-height: 300px; /* Batasi tinggi preview agar tidak makan tempat */
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#image-preview-container img, 
#selected-gif-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Grid GIF di dalam body scroll */
#gif-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    max-height: 220px; /* Tinggi area cari GIF */
    overflow-y: auto;
    padding: 5px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}
/* Tambahkan di CSS kamu */
.post-img-zoom {
    content-visibility: auto; /* Browser hanya render yang tampil di layar */
    aspect-ratio: 16 / 9; /* Beri cadangan ruang agar layout tidak lompat-lompat */
    background: rgba(255,255,255,0.05); /* Placeholder warna */
}
#global-upload-progress {
    position: fixed; top: 60px; left: 0; width: 100%; height: 4px;
    background: rgba(255,255,255,0.1); z-index: 1000; display: none;
}
#progress-fill {
    height: 100%; width: 0%; background: #39FF14;
    box-shadow: 0 0 10px #39FF14; transition: width 0.3s;
}
#progress-status {
    position: fixed; top: 65px; left: 50%; transform: translateX(-50%);
    font-size: 10px; color: #39FF14; font-weight: bold; text-transform: uppercase;
    letter-spacing: 1px; z-index: 1000; display: none;
}
#library-list::-webkit-scrollbar { width: 4px; }
#library-list::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

.library-item {
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.3s;
}

.library-item:hover {
    background: rgba(57, 255, 20, 0.05);
    border-color: var(--primary);
}
/* Animasi Loading Kecil di Tombol */
.spinner-vibe {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top: 2px solid #39FF14;
    border-radius: 50%;
    animation: spinVibe 0.8s linear infinite;
}

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

.vibe-processing {
    opacity: 0.7;
    cursor: wait !important;
}
