/* ============================================== */
/* ===== GAYA TAMBAHAN V3 (Styling Media) ===== */
/* ============================================== */

/* --- Perbaikan Styling Audio Player --- */
.message-content audio.post-audio {
    width: 100%;
    max-width: 350px; /* Sedikit lebih lebar */
    height: 45px;      /* Sedikit lebih tinggi */
    margin-top: 10px;
    border-radius: 25px; /* Bulatkan ujungnya */
    background-color: var(--bg-secondary); /* Samakan BG dengan reaksi */
    border: 1px solid var(--border-color);
}

/* Kustomisasi tampilan player (Chrome/Edge/Safari - Webkit) */
.message-content audio.post-audio::-webkit-media-controls-panel {
    background-color: var(--bg-secondary);
    border-radius: 25px;
    padding: 5px;
}
.message-content audio.post-audio::-webkit-media-controls-play-button,
.message-content audio.post-audio::-webkit-media-controls-mute-button {
    background-color: var(--bg-item-hover); /* Warna tombol */
    border-radius: 50%;
    color: var(--text-primary);
}
.message-content audio.post-audio::-webkit-media-controls-current-time-display,
.message-content audio.post-audio::-webkit-media-controls-time-remaining-display {
    color: var(--text-secondary); /* Warna teks waktu */
    font-size: 0.8rem;
    padding: 0 5px;
}
.message-content audio.post-audio::-webkit-media-controls-timeline {
    background-color: var(--border-color); /* Warna track timeline */
    border-radius: 4px;
    height: 6px;
    margin: 0 5px;
}
.message-content audio.post-audio::-webkit-media-controls-volume-slider {
    background-color: var(--border-color);
    border-radius: 4px;
    height: 6px;
}

/* Kustomisasi tampilan player (Firefox) */
/* Firefox kurang bisa dikustomisasi, hanya warna dasar */
/* Anda mungkin perlu pustaka JS jika ingin tampilan seragam total */


/* --- Perbaikan Styling Gambar --- */
.message-content img.post-image {
    display: block; /* Agar margin berfungsi */
    max-width: 100%;
    /* Batasi tinggi agar tidak terlalu besar, sesuaikan jika perlu */
    max-height: 400px; 
    border-radius: 12px; /* Lebih bulat */
    margin-top: 10px;
    border: 1px solid var(--border-color);
    object-fit: cover; /* Agar gambar tidak gepeng */
    background-color: var(--bg-secondary); /* Background jika gambar transparan */
    cursor: pointer; 
}

/* --- Perbaikan Styling Indikasi Balasan --- */
.reply-indication {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px; /* Jarak ke konten */
    display: block; 
    border-left: 3px solid var(--border-color); /* Pertebal garis */
    padding: 4px 0 4px 10px; /* Padding */
    background-color: var(--bg-secondary); /* BG lembut */
    border-radius: 0 4px 4px 0; /* Sedikit rounded */
}
.reply-indication strong {
    color: var(--text-primary);
    font-weight: 500; /* Sedikit lebih tipis */
}
.reply-indication i {
     white-space: nowrap;
     overflow: hidden;
     text-overflow: ellipsis;
     display: inline-block; /* Agar ellipsis bekerja */
     max-width: 80%;       /* Batasi lebar snippet */
     vertical-align: bottom; /* Sejajarkan */
}

/* --- Perbaikan Styling Tombol Reaksi --- */
.reaction-item {
    transition: background 0.2s, border-color 0.2s; /* Tambah transisi */
    cursor: pointer;
}
/* Style saat user sudah react (sesuaikan warna jika perlu) */
.reaction-item.reacted-by-user {
    background: rgba(0, 175, 255, 0.2); /* Biru transparan */
    border-color: rgba(0, 175, 255, 0.5);
    /* color: #E4E4E5; */ /* Optional: ubah warna teks emoji? */
}
.reaction-item.add-reaction:hover {
     background: var(--bg-item-hover);
}/* ========================================= */
/* ===== BAGIAN 1: CSS DASAR XAS AI ANDA ===== */
/* ========================================= */
:root {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-sidebar: #171717;
    --bg-item-hover: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --border-color: #2a2a2a;
    --btn-bg: #1a1a1a;
    --btn-border: #2a2a2a;
    --chat-user-bg: #2a2a2a;
    --chat-user-border: #3a3a3a;
    --input-btn-bg: #ffffff;
    --input-btn-icon: #000000;
    --input-wrapper-bg: #1f1f1f;
}

body[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f7f7f7;
    --bg-sidebar: #ffffff;
    --bg-item-hover: #e8e8e8;
    --text-primary: #111111;
    --text-secondary: #666666;
    --border-color: #dddddd;
    --btn-bg: #f8f8f8;
    --btn-border: #dddddd;
    --chat-user-bg: #e0f0ff;
    --chat-user-border: #cce0ff;
    --input-btn-bg: #444444;
    --input-btn-icon: #ffffff;
    --input-wrapper-bg: #f0f0f0;
}

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

body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif; 
    background: var(--bg-primary); 
    color: var(--text-primary); 
    height: 100vh; 
    overflow: hidden; 
    transition: background 0.3s, color 0.3s;
}

.container { display: flex; height: 100vh; position: relative; }

.overlay { 
    display: none; 
    position: fixed; 
    top: 0; left: 0; right: 0; bottom: 0; 
    background: rgba(0,0,0,0.7); 
    z-index: 99;
    backdrop-filter: blur(4px);
}
.overlay.active { display: block; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { 
    background: var(--border-color); 
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

.sidebar { 
    width: 280px; 
    background: var(--bg-sidebar); 
    border-right: 1px solid var(--border-color); 
    display: flex; 
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header { 
    padding: 16px; 
    border-bottom: 1px solid var(--border-color); 
}

.sidebar-header img {
    width: 90px;
    border-radius: 8px;
}

.new-chat-btn { 
    margin: 16px; 
    padding: 14px; 
    background: var(--btn-bg); 
    border: 1px solid var(--btn-border); 
    border-radius: 8px; 
    color: var(--text-primary); 
    font-size: 15px; 
    cursor: pointer; 
    transition: all 0.2s; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 8px;
}
.new-chat-btn i { /* [BARU] Style untuk ikon font awesome */
    color: #ccc;
}

.new-chat-btn:hover { 
    background: var(--bg-item-hover);
    transform: translateY(-2px);
}

.chat-list { 
    flex: 1; 
    overflow-y: auto; 
    padding: 8px; 
}

.chat-list-label { 
    padding: 12px; 
    font-size: 12px; 
    color: var(--text-secondary); 
    font-weight: 600; 
    text-transform: uppercase; 
}

.chat-item { 
    padding: 12px; 
    margin: 4px 0; 
    border-radius: 8px; 
    cursor: pointer; 
    transition: all 0.2s;
}

.chat-item:hover { 
    background: var(--bg-item-hover);
    transform: translateX(4px);
}

.judul-percakapan { 
    font-size: 14px; 
    font-weight: 500; 
    color: var(--text-primary); 
    margin-bottom: 4px;
}

.cuplikan-balasan { 
    font-size: 13px; 
    color: var(--text-secondary); 
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.user-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.plan-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 6px;
    border-radius: 4px;
    margin-left: 4px;
    text-transform: uppercase;
    color: #fff;
}
.plan-badge.plan-free { background: #555; }
.plan-badge.plan-basic { background: #33d17a; color: #000; }
.plan-badge.plan-pro { background: #E4E4E5; color: #000; }


.logout-btn {
    width: 100%;
    padding: 12px;
    background: #dc3545;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #c82333;
}

.main-area { 
    flex: 1; 
    display: flex; 
    flex-direction: column; 
    /* [BARU] Perbaikan untuk layout mobile */
    min-width: 0;
}

/* === [PERBAIKAN] MENAMBAHKAN Z-INDEX === */
.navbar { 
    background: var(--bg-secondary); 
    border-bottom: 1px solid var(--border-color); 
    padding: 12px 20px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    height: 60px; 
    /* [BARU] Perbaikan agar bisa diklik */
    position: relative;
    z-index: 900;
}
/* === AKHIR PERBAIKAN === */

.navbar-left { 
    display: flex; 
    align-items: center; 
    gap: 16px; 
}

.menu-toggle { 
    display: none; 
    width: 40px; 
    height: 40px; 
    background: var(--btn-bg); 
    border: 1px solid var(--btn-border); 
    border-radius: 8px; 
    color: var(--text-primary); 
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.menu-toggle:hover { background: var(--bg-item-hover); }

.navbar-brand { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    padding: 6px 12px; 
    background: var(--btn-bg); 
    border-radius: 8px; 
}

.navbar-brand img {
    width: 70px;
    border-radius: 6px;
}

.brand-text {
    font-size: 16px;
    font-weight: 600;
}

.navbar-right { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
}

.nav-btn { 
    width: 40px; 
    height: 40px; 
    background: var(--btn-bg); 
    border: 1px solid var(--btn-border); 
    border-radius: 8px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    text-decoration: none; 
}



.nav-btn svg {
    width: 20px;
    height: 20px;
}

.icon-dark, .icon-light { display: none; }
body[data-theme="dark"] .icon-dark { display: block; }
body[data-theme="light"] .icon-light { display: block; }

.quick-actions {
    padding: 16px 20px 12px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-primary);
    display: flex;
    gap: 8px;
    overflow-x: auto;
}
.quick-btn {
    background: var(--btn-bg);
    color: var(--text-secondary);
    border: 1px solid var(--btn-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
}
.quick-btn:hover { background: var(--bg-item-hover); }


.chat-area { 
    flex: 1; 
    overflow-y: auto; 
    max-width: 900px; 
    width: 100%; 
    margin: 0 auto; 
    padding: 20px;
    scroll-behavior: smooth;
}

.message { 
    margin-bottom: 16px; 
    display: flex; 
    width: 100%;
}

.message.user { justify-content: flex-end; }
.message.assistant { justify-content: flex-start; }

.message-bubble-wrapper { 
    position: relative; 
    display: inline-block; 
    max-width: 80%; 
}

.message-bubble { 
    padding: 12px 18px; 
    border-radius: 20px; 
    font-size: 15px; 
    line-height: 1.6;
    word-wrap: break-word;
}

.message-bubble.new-message { 
    animation: blurIn 0.4s ease-out;
}

@keyframes blurIn {
    from {
        opacity: 0;
        filter: blur(10px);
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        filter: blur(0);
        transform: scale(1);
    }
}

.message.user .message-bubble { 
    background: var(--chat-user-bg); 
    border: 1px solid var(--chat-user-border); 
    border-bottom-right-radius: 6px; 
}

.message.assistant .message-bubble { 
    background: var(--btn-bg); 
    border: 1px solid var(--btn-border); 
    border-bottom-left-radius: 6px; 
}

.message-bubble strong {
    font-weight: 600;
}

.message-bubble p {
    margin: 8px 0;
}

.message-bubble p:first-child { margin-top: 0; }
.message-bubble p:last-child { margin-bottom: 0; }

.message-bubble ul, .message-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-bubble li { margin: 4px 0; }

.message-bubble code {
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

.image-preview-msg {
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    max-width: 250px;
    animation: blurIn 0.4s ease-out;
}

.image-preview-msg img {
    max-width: 100%;
    border-radius: 8px;
    display: block;
    margin-bottom: 8px;
}

.image-preview-msg .image-name {
    font-size: 12px;
    color: var(--text-secondary);
    word-break: break-all;
}

.loading-dots {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    padding: 10px 0;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.copy-btn { 
    position: absolute; 
    top: 8px; 
    right: 8px; 
    width: 28px; 
    height: 28px; 
    background: var(--btn-bg); 
    border: 1px solid var(--btn-border); 
    border-radius: 6px; 
    cursor: pointer; 
    display: none; 
    align-items: center; 
    justify-content: center; 
    opacity: 0.7;
}

.copy-btn:hover { 
    opacity: 1; 
    background: var(--bg-item-hover);
}

.message-bubble-wrapper:hover .copy-btn { display: flex; }
.copy-btn svg { width: 14px; height: 14px; }
.copy-btn.copied { 
    background: #10b981; 
    border-color: #10b981;
}

.chart-container {
    width: 100%;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chart-container.expanded {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 90vw;
    height: 80vh;
    z-index: 100;
}

.chart-expanded-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 99;
    backdrop-filter: blur(4px);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.chart-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chart-symbol {
    font-weight: 600;
    font-size: 14px;
}

.chart-timeframe {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 8px;
    background: var(--btn-bg);
    border-radius: 4px;
}

.chart-actions {
    display: flex;
    gap: 8px;
}

.chart-action-btn {
    width: 32px;
    height: 32px;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.chart-action-btn:hover {
    background: var(--bg-item-hover);
}

.chart-action-btn svg {
    width: 16px;
    height: 16px;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.chart-wrapper {
    width: 100%;
    height: 400px;
}

.chart-container.expanded .chart-wrapper {
    height: calc(80vh - 60px);
}

.input-area { 
    position: sticky; 
    bottom: 0; 
    width: 100%; 
    border-top: 1px solid var(--border-color); 
    background: var(--bg-secondary); 
    padding: 16px; 
}

.input-container { 
    max-width: 900px; 
    margin: 0 auto; 
}

.mode-selector { margin-bottom: 12px; }

.mode-dropdown { position: relative; }

.mode-btn { 
    padding: 8px 16px; 
    background: var(--btn-bg); 
    border: 1px solid var(--btn-border); 
    border-radius: 20px; 
    color: var(--text-primary); 
    font-size: 13px; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    gap: 8px;
}

.mode-btn:hover { background: var(--bg-item-hover); }

.dropdown-arrow {
    transition: transform 0.2s;
    font-size: 10px;
}

.dropdown-arrow.open { transform: rotate(180deg); }

.mode-options { 
    position: absolute; 
    bottom: 100%; 
    left: 0; 
    background: var(--bg-sidebar); 
    border: 1px solid var(--border-color); 
    border-radius: 12px; 
    padding: 8px; 
    margin-bottom: 8px; 
    display: none; 
    min-width: 220px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.mode-options.active { display: block; }

.mode-option { 
    padding: 10px 12px; 
    cursor: pointer; 
    border-radius: 8px; 
    font-size: 14px;
}

.mode-option:hover { background: var(--bg-item-hover); }
.mode-option.selected { background: var(--bg-item-hover); font-weight: 500; }

.file-preview { 
    padding: 8px 0; 
    display: none; 
    gap: 8px;
    flex-wrap: wrap;
}

.file-preview.active { display: flex; }

.file-item { 
    padding: 6px 12px; 
    background: var(--btn-bg); 
    border: 1px solid var(--btn-border); 
    border-radius: 16px; 
    font-size: 12px; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
}

.input-wrapper { 
    background: var(--input-wrapper-bg); 
    border: 1px solid var(--border-color); 
    border-radius: 24px; 
    display: flex; 
    align-items: center; 
    padding: 4px;
}

.input-wrapper:focus-within {
    border-color: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.input-actions { 
    display: flex; 
    gap: 4px; 
    padding: 0 8px; 
}

.input-action-btn {
    width: 36px; 
    height: 36px; 
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border-radius: 50%; 
    color: var(--text-secondary);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease; 
}
.input-action-btn svg {
    width: 20px;
    height: 20px;
}

.input-action-btn.recording {
    color: #dc2626;
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.2);
}

.input-action-btn.recording::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid #ef4444;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    70% {
        transform: scale(1.5);
        opacity: 0;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.chat-input { 
    flex: 1; 
    background: none; 
    border: none; 
    outline: none; 
    color: var(--text-primary); 
    font-size: 15px; 
    padding: 10px 12px; 
    font-family: inherit; 
    min-height: 36px; 
    max-height: 120px; 
    resize: none; 
}

.chat-input::placeholder { color: var(--text-secondary); }

.input-btn { 
    width: 44px; 
    height: 44px; 
    background: var(--input-btn-bg); 
    border: none; 
    border-radius: 50%; 
    cursor: pointer; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-left: 4px;
    position: relative;
}

.input-btn svg { 
    width: 18px; 
    height: 18px; 
    stroke: var(--input-btn-icon); 
    fill: none; 
    stroke-width: 2; 
}

.input-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.input-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 1000;
    font-size: 14px;
}

.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }


/* ============================================== */
/* ===== BAGIAN 2: TAMBAHAN UNTUK COMMUNITY.HTML ===== */
/* ============================================== */


/* Penyesuaian .chat-list-label */
.chat-list-label {
    padding-left: 16px; /* Sesuaikan padding */
}

/* 1. Sidebar - Member List */
.member-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px;
}
.member-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px;
    border-radius: 8px;
    transition: background 0.2s;
    cursor: pointer;
}
.member-item:hover {
    background: var(--bg-item-hover);
}
.member-item img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
}
.member-item strong {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Badge (PRO/BASIC) */
.badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: auto; /* Dorong ke kanan */
    text-transform: uppercase;
}
.badge.pro {
    background-color: #E4E4E5;
    color: #000;
}
.badge.basic {
    background-color: #33d17a;
    color: #000;
}

/* 2. Main Area - AI Filter Bar */
.ai-filter-bar {
    padding: 16px 20px 12px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    background: var(--bg-primary);
}
.chips-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.chips-container::-webkit-scrollbar { display: none; }

.ai-filter-bar .chip {
    background: var(--btn-bg);
    color: var(--text-secondary);
    border: 1px solid var(--btn-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
    white-space: nowrap;
}
.ai-filter-bar .chip:hover {
    background: var(--bg-item-hover);
}
.ai-filter-bar .chip.active {
    background: #E4E4E5;
    color: #000;
    border-color: #E4E4E5;
}
.ai-filter-bar .chip i {
    font-size: 0.8rem;
}

/* 3. Main Area - Community Feed */
.chat-area.community-feed {
    /* Menimpa style .chat-area agar full-width di PC */
    max-width: none; 
    margin: 0;
    padding: 20px 16px;
}

.message-group {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    justify-content: flex-start; 
    /* [BARU] Atur agar feed komunitas tetap di tengah */
    max-width: 900px; 
    margin-left: auto;
    margin-right: auto;
}
.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-top: 4px;
    cursor: pointer;
}
.message-container {
    flex-grow: 1;
    background: var(--btn-bg);
    border: 1px solid var(--btn-border);
    border-radius: 12px;
    padding: 12px 16px;
}
.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.message-header strong {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
}
.message-header .timestamp {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-left: auto;
}
.message-content {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
}
/* Menyesuaikan format dari JS Anda */
.message-content p { margin: 0 0 10px 0; }
.message-content p:first-child { margin-top: 0; }
.message-content p:last-child { margin-bottom: 0; }
.message-content ul, .message-content ol { margin: 8px 0; padding-left: 20px; }
.message-content li { margin: 4px 0; }
.message-content code {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    border: 1px solid var(--border-color);
}
.message-content strong { font-weight: 600; }
.message-content em { font-style: italic; }


.ai-tag {
    font-size: 0.8rem;
    font-weight: 500;
    color: #E4E4E5;
    background-color: rgba(0, 175, 255, 0.1);
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-block;
    margin-top: 8px;
}

/* Reaksi dan Balasan */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}
.reaction-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 4px 8px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.2s;
}
.reaction-item:hover {
    background: var(--bg-item-hover);
}
.message-actions {
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 8px;
}
.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    gap: 6px;
    transition: background 0.2s;
    /* [BARU] Fix untuk ikon */
    display: inline-flex;
    align-items: center;
}
.action-btn:hover {
    background: var(--bg-item-hover);
    color: var(--text-primary);
}

/* 4. Main Area - Input Komunitas */
.community-input-box {
    /* Ini adalah .input-area tapi khusus community */
    position: sticky;
    bottom: 0;
    width: 100%;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 16px;
}
.community-input-box .input-container {
    max-width: 900px;
    margin: 0 auto;
}
.community-input-box .input-wrapper {
    padding: 4px; 
}
.community-input-box .input-action-btn {
    color: var(--text-secondary); 
}
.community-input-box .input-action-btn i {
    font-size: 18px;
}
.community-input-box .input-btn svg {
    stroke: var(--input-btn-icon);
}


/* ========================================= */
/* ===== BAGIAN 3: MEDIA QUERY (GABUNGAN & PERBAIKAN) ===== */
/* ========================================= */
@media (max-width: 768px) {
    /* Dari CSS Asli Anda */
    .sidebar { 
        position: fixed; 
        left: 0; 
        top: 0; 
        height: 100vh; 
        z-index: 102; 
        transform: translateX(-100%); 
    }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: flex; }
    .brand-text { display: none; }
    .message-bubble-wrapper { max-width: 90%; }
    
    /* === [PERBAIKAN] UNTUK FIX RESPONSIVE === */
    .main-area {
        width: 100%; /* Paksa main-area jadi 100% di HP */
    }
    /* === AKHIR PERBAIKAN === */

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    /* ======================================================== */
    /* ===== [PERUBAHAN DIMULAI] Penyesuaian Sticky Header Market ===== */
    /* ======================================================== */

    /* [BARU] Membuat Ticker Tape (Marquee) sticky di HP */
    /* Ini hanya berlaku di market.html, tidak akan memengaruhi halaman lain */
    .tradingview-widget-container#tv-ticker-tape {
        position: sticky;
        top: 0; /* Menempel di paling atas layar */
        z-index: 11; /* Tampil di atas filter bar */
        background: var(--bg-primary); /* Beri BG agar tidak transparan saat scroll */
        min-height: 46px; /* Tinggi default ticker tape */
    }
    
    /* Dari Tambahan Community */
    .ai-filter-bar {
        position: sticky;
        /* [DIUBAH] Menempel tepat di bawah ticker tape (46px) BUKAN navbar (60px) */
        top: 46px; 
        z-index: 10;
    }
    
    /* ======================================================== */
    /* ===== [PERUBAHAN SELESAI] ===== */
    /* ======================================================== */
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    .chat-area.community-feed {
        padding: 16px 8px; /* Padding lebih kecil di HP */
    }

    .message-group {
        /* [BARU] Pastikan feed tidak terlalu sempit di HP */
        gap: 8px;
    }
    
    .chat-avatar {
        width: 32px;
        height: 32px;
    }

    .community-input-box {
        padding: 12px;
    }
}
/* ============================================== */
/* ===== GAYA TAMBAHAN V2 (Reply, Media, React) ===== */
/* ============================================== */

/* --- Tombol Baru di Input Area --- */
.input-action-btn i { /* Styling ikon font awesome */
    font-size: 18px;
    color: var(--text-secondary);
}
.input-action-btn:hover i {
    color: var(--text-primary);
}
/* Style tombol rekam saat aktif */
.input-action-btn#voiceRecordBtnCommunity.recording {
    color: #dc2626; /* Merah */
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.3);
    animation: pulse-red 1.5s infinite;
}
@keyframes pulse-red {
    0% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.3); }
    70% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 4px rgba(220, 38, 38, 0); }
}

/* --- Konteks Balasan --- */
.reply-context {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 8px;
    font-size: 0.85rem;
}
.reply-context-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.reply-context-header strong {
    color: var(--text-primary);
    font-weight: 600;
}
#cancelReplyBtn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
}
.reply-context-snippet {
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

/* --- Preview Upload --- */
.upload-preview {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.upload-preview img {
    max-width: 60px;
    max-height: 60px;
    border-radius: 4px;
    object-fit: cover;
}
.upload-preview audio {
    height: 40px;
    max-width: 200px;
}
.upload-preview .file-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.upload-preview button { /* Tombol Hapus Preview */
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    margin-left: auto;
    padding: 5px;
}

/* --- Reaction Picker --- */
.reaction-picker {
    position: absolute; /* Akan diposisikan oleh JS */
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1050;
}
.reaction-picker span {
    font-size: 1.4rem;
    cursor: pointer;
    transition: transform 0.1s ease-out;
}
.reaction-picker span:hover {
    transform: scale(1.2);
}

/* --- Styling Media dalam Pesan --- */
.message-content img.post-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    margin-top: 8px;
    cursor: pointer; /* Untuk zoom nanti? */
}
.message-content audio.post-audio {
    width: 100%;
    max-width: 300px;
    height: 40px;
    margin-top: 8px;
}
/* Style untuk state reacted-by-user (jika diimplementasikan) */
.reaction-item.reacted-by-user {
    background: var(--accent-primary-faded); /* Butuh variabel warna aksen */
    border-color: var(--accent-primary);
    color: var(--accent-primary-text);
}

/* [BARU] Style untuk Reply Indication di Pesan */
.reply-indication {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block; /* Agar muncul di baris sendiri */
    border-left: 2px solid var(--border-color);
    padding-left: 8px;
}
.reply-indication strong {
    color: var(--text-primary);
}