/* General Body and HTML Setup */
html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f0f2f5; /* Warna background abu-abu muda ala Facebook */
    color: #1c1e21;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden; /* Mencegah overflow horizontal */
    padding-top: 50px; /* Space for fixed header */
    padding-bottom: 60px; /* Space for fixed footer */
}

/* Base Styles for Buttons (adjust if you have your own) */
.button {
    display: inline-block;
    padding: 8px 15px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s ease;
}

.button.primary-button { /* Example from shop.php, if used elsewhere */
    background-color: #1877f2; /* Facebook Blue */
    color: white;
    border: none;
}
.button.primary-button:hover {
    background-color: #166fe5;
}

/* Card Panel - Reusable style for boxes/cards */
.card-panel {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); /* Shadow like FB cards */
    margin-bottom: 10px; /* Spasi antar card */
    padding: 15px;
}

/* Profile Picture (small version for comments/widgets) */
.profile-pic-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    border: 1px solid #ddd;
}

/* --- Mobile Header --- */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000; /* Pastikan di atas konten lain */
    height: 50px; /* Ketinggian header */
    box-sizing: border-box; /* Pastikan padding tidak menambah tinggi total */
}

.header-logo a {
    font-size: 1.5em;
    font-weight: bold;
    color: #1877f2; /* Facebook Blue */
    text-decoration: none;
}

.header-icons {
    display: flex;
    gap: 15px; /* Jarak antar ikon */
}

.header-icon {
    font-size: 1.2em;
    color: #555;
    background-color: #f0f2f5; /* Background icon */
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.header-icon:hover {
    background-color: #e4e6eb;
}

/* --- Main Content Area --- */
.mobile-main-content {
    padding-top: 10px; /* Jarak dari header fixed */
    padding-bottom: 10px; /* Jarak dari footer fixed */
    max-width: 600px; /* Batasi lebar konten untuk tampilan mobile */
    margin: 0 auto; /* Tengahkan di layar lebih besar */
    box-sizing: border-box;
}

.alert-container {
    padding: 0 15px; /* Padding untuk kontainer alert */
}

.alert-message {
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    opacity: 1; /* Default visibility */
}

.alert-message.green {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-message.red {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-message.info {
    background-color: #cfe2ff; /* Light blue for info */
    color: #052c65;
    border: 1px solid #b6d4fe;
}

.search-result-info {
    text-align: center;
    padding: 10px 15px;
    color: #555;
    font-style: italic;
    margin-top: 10px;
    background-color: #e4e6eb;
    border-radius: 8px;
    margin-bottom: 10px;
}


/* Create Post Widget */
.create-post-widget {
    background-color: #ffffff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    margin: 10px 0; /* Memberi jarak dari tepi */
}

.create-post-widget .widget-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.create-post-widget .whats-on-mind-input {
    flex-grow: 1;
    padding: 10px 15px;
    border: 1px solid #e0e0e0;
    border-radius: 20px; /* Oval shape */
    background-color: #f0f2f5;
    color: #65676b;
    font-size: 0.95em;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap; /* Prevent text wrap */
    overflow: hidden; /* Hide overflow */
    text-overflow: ellipsis; /* Add ellipsis */
}
.create-post-widget .whats-on-mind-input:hover {
    background-color: #e4e6eb;
}

.create-post-widget .widget-actions {
    display: flex;
    justify-content: space-around; /* Menyebar tombol secara merata */
    padding-top: 10px;
    border-top: 1px solid #f0f2f5; /* Garis pemisah tipis */
}

.create-post-widget .widget-action-button {
    flex: 1; /* Setiap tombol mengambil ruang yang sama */
    text-align: center;
    padding: 10px 0;
    font-size: 0.9em;
    font-weight: 500;
    color: #65676b;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}

.widget-action-button .fas {
    font-size: 1.1em;
}

.widget-action-button:hover {
    background-color: #f0f2f5;
}

/* Post Card */
.posts-feed {
    padding: 0 5px; /* Sedikit padding di sisi untuk mobile */
}

.post-card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px; /* Spasi antar postingan */
    padding: 0; /* Padding diatur di dalam elemen */
    overflow: hidden; /* Penting untuk media */
}

.post-card .post-header {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    position: relative; /* Untuk menempatkan tombol edit/delete */
}

.post-card .post-profile-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    flex-grow: 1; /* Memungkinkan link profil mengambil ruang */
}

.profile-pic-post {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    border: 1px solid #ddd;
}

.post-header-info {
    display: flex;
    flex-direction: column;
}

.post-username {
    font-weight: bold;
    font-size: 0.95em;
    color: #1c1e21;
}

.post-time {
    font-size: 0.75em;
    color: #65676b;
}

.post-options {
    display: flex;
    gap: 5px; /* Jarak antar tombol edit/delete */
}

.post-options .action-icon {
    font-size: 0.9em;
    color: #65676b;
    padding: 5px;
    border-radius: 50%;
    background-color: #e4e6eb;
    text-decoration: none;
    width: 28px; /* Pastikan ukuran bulat konsisten */
    height: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s ease;
}
.post-options .action-icon:hover {
    background-color: #d8dadf;
}

.post-options form button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.post-content {
    padding: 0 15px 15px 15px; /* Top padding 0 untuk gambar yang nempel header */
    line-height: 1.4;
    font-size: 0.9em;
}

.post-content p {
    margin-top: 0;
    margin-bottom: 10px;
}

.post-content .mention-link {
    color: #1877f2;
    text-decoration: none;
    font-weight: bold;
}
.post-content .mention-link:hover {
    text-decoration: underline;
}

.post-media-image,
.post-media-video {
    width: calc(100% + 30px); /* Melebar ke pinggir card, mengatasi padding content */
    margin: 10px -15px 0 -15px; /* Negatif margin untuk menempel tepi */
    max-width: unset; /* Override any max-width */
    height: auto;
    display: block;
    object-fit: contain; /* Gambar/video akan menyesuaikan, mungkin ada spasi kosong di samping/atas-bawah */
    border-radius: 0; /* Hilangkan border radius untuk media di dalam kartu */
}
/* If you want images/videos to fill the space and crop, use object-fit: cover; */

.video-thumbnail-container {
    position: relative;
    width: calc(100% + 30px);
    margin: 10px -15px 0 -15px;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    background-color: #000;
}

.video-thumbnail-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain; /* Or 'cover' if you want to crop */
}

.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-size: 3em;
    opacity: 1;
    transition: opacity 0.3s ease;
    cursor: pointer;
    text-decoration: none;
}
.video-play-overlay:hover {
    opacity: 0.8;
}

/* Audio Player */
.post-song-player {
    background-color: #f0f2f5;
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
    text-align: center;
}
.post-song-player h4 {
    margin-top: 0;
    margin-bottom: 5px;
    color: #1c1e21;
    font-size: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.post-song-player .song-artist-name {
    margin-bottom: 10px;
    color: #65676b;
    font-size: 0.85em;
}
.post-song-player .audio-player {
    width: 100%;
    max-width: 300px; /* Batasi lebar player audio */
    margin: 0 auto;
}

.post-footer {
    border-top: 1px solid #f0f2f5;
    padding: 10px 15px;
}

.post-stats {
    margin-bottom: 10px;
    font-size: 0.85em;
    color: #65676b;
    display: flex;
    align-items: center;
    gap: 15px;
}

.post-stats .stat-link {
    text-decoration: none;
    color: inherit;
}
.post-stats .stat-link:hover {
    text-decoration: underline;
}

.post-actions-buttons {
    display: flex;
    justify-content: space-around;
    border-top: 1px solid #f0f2f5;
    padding-top: 10px;
    margin-top: 10px;
}

.action-button-footer {
    background: none;
    border: none;
    padding: 8px 10px;
    color: #65676b;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
}
.action-button-footer:hover {
    background-color: #f0f2f5;
}

/* No Posts Message */
.no-posts {
    text-align: center;
    padding: 30px 15px;
    color: #65676b;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    margin: 10px;
}


/* --- Pagination --- */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 10px 15px;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.pagination-link {
    display: inline-block;
    padding: 8px 15px;
    text-decoration: none;
    color: #1877f2;
    border: 1px solid #1877f2;
    border-radius: 5px;
    transition: background-color 0.2s ease, color 0.2s ease;
    font-size: 0.9em;
}

.pagination-link:hover {
    background-color: #1877f2;
    color: white;
}

.pagination-link.active {
    background-color: #1877f2;
    color: white;
    border-color: #1877f2;
    font-weight: bold;
    cursor: default;
}


/* --- Mobile Footer Navigation --- */
.mobile-footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #ffffff;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 5px 0;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
    height: 60px; /* Ketinggian footer */
    box-sizing: border-box;
}

.footer-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #65676b;
    font-size: 0.7em; /* Ukuran teks lebih kecil */
    font-weight: 500;
    padding: 5px;
    flex: 1; /* Setiap item mengambil ruang yang sama */
    transition: color 0.2s ease;
}

.footer-nav-item i {
    font-size: 1.4em; /* Ukuran ikon */
    margin-bottom: 3px;
    transition: color 0.2s ease;
}

.footer-nav-item.active {
    color: #1877f2; /* Warna aktif ala FB Blue */
}

.footer-nav-item:hover {
    color: #1877f2;
}

/* --- Modal Styles --- */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1001; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    margin: 10% auto; /* 10% from the top and centered */
    padding: 20px;
    border-radius: 10px;
    width: 90%; /* Lebar modal untuk mobile */
    max-width: 500px; /* Maksimal lebar */
    position: relative;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
@media (max-width: 768px) {
    .modal-content {
        width: 95%; /* Lebih lebar di layar kecil */
        margin: 5% auto; /* Lebih dekat ke atas */
    }
}


.modal-content h2 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
    color: #1c1e21;
}

.modal-content textarea {
    width: calc(100% - 20px);
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    resize: vertical; /* Allow vertical resize */
    font-size: 0.9em;
}

.modal-content label.button-label {
    background-color: #e4e6eb;
    color: #65676b;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9em;
    margin-right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.2s ease;
}
.modal-content label.button-label:hover {
    background-color: #d8dadf;
}

.modal-content input[type="text"] {
    width: calc(100% - 20px);
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.modal-buttons {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.post-modal-button {
    width: 100%;
    padding: 12px;
    background-color: #1877f2;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.2s ease;
}
.post-modal-button:hover {
    background-color: #166fe5;
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 15px;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #333;
    text-decoration: none;
    cursor: pointer;
}

/* Image Viewer Modal Specific Styles */
.image-viewer-modal .modal-content {
    background: transparent;
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    margin: 0;
}

.image-viewer-modal .modal-image {
    max-width: 95%;
    max-height: 80vh; /* Viewport height */
    object-fit: contain;
    display: block;
    margin: auto;
    border-radius: 0; /* No border for full image */
}

.image-viewer-modal .image-caption {
    color: white;
    text-align: center;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    width: 100%;
    box-sizing: border-box;
    font-size: 0.9em;
    line-height: 1.3;
}

/* Media queries for larger screens (optional, but good practice) */
@media (min-width: 768px) {
    .mobile-header, .mobile-footer-nav {
        /* You might want to hide these fixed elements on desktop,
           or turn them into a sidebar/topbar like regular websites. */
        /* For this example, they will still be fixed but centered. */
        left: unset;
        right: unset;
        margin-left: auto;
        margin-right: auto;
        max-width: 600px; /* Align with main content */
    }

    body {
        padding-top: 60px; /* Adjust if header is taller on desktop */
        padding-bottom: 60px; /* Adjust if footer is taller on desktop */
    }

    .create-post-widget, .post-card, .pagination-controls {
        margin-left: auto;
        margin-right: auto;
        max-width: 600px; /* Konvergen ke lebar mobile-first */
    }
}

/* --- Tambahan CSS untuk Fitur Perasaan/Aktivitas di create_post.php --- */

.fb-user-info-row {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap; /* Izinkan wrap jika teks terlalu panjang */
}

.fb-feeling-display {
    display: flex;
    align-items: center;
    font-size: 15px;
    color: #65676b; /* Warna teks yang sedikit abu-abu */
    margin-left: 5px; /* Sedikit jarak dari username */
}

.fb-feeling-connector {
    color: #65676b;
    margin: 0 4px;
}

.fb-feeling-icon {
    width: 18px; /* Ukuran ikon perasaan/aktivitas */
    height: 18px;
    margin-right: 4px;
    object-fit: contain;
}

.fb-feeling-text {
    font-weight: 600; /* Teks perasaan sedikit lebih tebal */
    color: #050505; /* Warna teks utama */
}

.fb-modal-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ccd0d5;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 15px;
    color: #050505;
    background-color: #f0f2f5;
    appearance: none; /* Hapus gaya default browser untuk dropdown */
    -webkit-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2365676b%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-6.5%200-12.2%203.2-15.6%208.1-3.4%204.9-3.7%2011.3-.8%2016.5l128%20204.8c3.4%205.4%209.4%208.5%2016.4%208.5s13-3.1%2016.4-8.5l128-204.8c2.9-5.2%202.6-11.6-.8-16.5z%22%2F%3E%3C%2Fsvg%3E'); /* Ikon panah bawah kustom */
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    cursor: pointer;
    margin-bottom: 10px; /* Jarak dari elemen di bawahnya */
}

.fb-or-divider {
    font-size: 13px;
    color: #888;
    text-align: center;
    margin: 10px 0;
    position: relative;
}

.fb-or-divider::before,
.fb-or-divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background-color: #e5e5e5;
}

.fb-or-divider::before {
    left: 0;
}

.fb-or-divider::after {
    right: 0;
}

.fb-activity-textarea {
    min-height: 40px; /* Ketinggian minimum lebih kecil untuk input aktivitas */
    margin-top: 0;
    margin-bottom: 10px;
    background-color: #fff; /* Latar belakang putih untuk textarea ini */
}

.fb-clear-button {
    background-color: #e4e6eb;
    color: #65676b;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 100%;
    margin-top: 5px; /* Jarak dari textarea di atasnya */
}

.fb-clear-button:hover {
    background-color: #d8dadf;
}

/* Penyesuaian untuk tampilan mobile */
@media (max-width: 480px) {
    .fb-user-info-row {
        flex-direction: column; /* Stack vertically for very small screens */
        align-items: flex-start;
    }
    .fb-profile-pic {
        margin-right: 0;
        margin-bottom: 5px;
    }
    .fb-username-display {
        width: 100%; /* Username takes full width */
    }
    .fb-feeling-display {
        margin-left: 0;
        margin-top: 5px; /* Jarak dari username */
        width: 100%;
        justify-content: flex-start; /* Rata kiri */
    }
    .fb-feeling-connector {
        display: none; /* Sembunyikan garis penghubung jika stack */
    }
}

/* Pastikan container widget-header menggunakan flexbox */
.create-post-widget .widget-header {
    display: flex; /* Mengatur elemen anak (foto profil, input) sejajar */
    align-items: center; /* Menyelaraskan elemen secara vertikal di tengah */
    gap: 10px; /* Memberi jarak 10px antara elemen-elemen anak */
    padding-bottom: 10px; /* Sedikit padding di bagian bawah header */
    border-bottom: 1px solid #eee; /* Garis pemisah di bawah header */
    margin-bottom: 10px; /* Jarak antara header dan bagian aksi di bawahnya */
}



/* messages.css atau style.css */

/* Tata letak dasar untuk container pesan */
.messages-container {
    display: flex; /* Menggunakan flexbox untuk layout dua kolom */
    width: 100%;
    max-width: 1200px; /* Batasi lebar maksimal */
    margin: 20px auto; /* Pusatkan di halaman */
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    overflow: hidden; /* Penting untuk menangani sudut membulat */
    min-height: 70vh; /* Minimal tinggi agar terlihat seperti aplikasi chat */
}

/* Daftar Percakapan */
.conversations-list {
    flex: 0 0 300px; /* Lebar tetap untuk daftar percakapan */
    border-right: 1px solid #eee;
    padding: 15px;
    overflow-y: auto; /* Bisa di-scroll jika daftar panjang */
    background-color: #f8f9fa;
    transition: all 0.3s ease-in-out; /* Transisi untuk menyembunyikan/menampilkan */
}

/* Antarmuka Chat (Area Pesan) */
.chat-interface {
    flex: 1; /* Mengisi sisa ruang */
    display: flex;
    flex-direction: column; /* Header, display pesan, form pesan */
    transition: all 0.3s ease-in-out; /* Transisi untuk menyembunyikan/menampilkan */
}

/* Sembunyikan daftar percakapan saat chat dipilih (untuk layar lebar) */
.conversations-list.hidden-on-chat {
    flex: 0 0 0; /* Ubah lebar menjadi 0 */
    min-width: 0;
    padding: 0;
    border-right: none;
    overflow: hidden;
    opacity: 0; /* Buat tidak terlihat */
    pointer-events: none; /* Nonaktifkan interaksi mouse */
}

/* Perluas area chat saat daftar percakapan tersembunyi */
.chat-interface.expanded-on-chat {
    flex: 1; /* Pastikan mengambil semua ruang yang tersedia */
}

/* Styling untuk item percakapan */
.conversation-item {
    display: flex;
    align-items: center;
    padding: 10px 15px;
    text-decoration: none;
    color: #333;
    border-radius: 5px;
    margin-bottom: 5px;
    transition: background-color 0.2s ease;
    position: relative;
    overflow: hidden; /* Untuk memastikan badge tidak keluar */
}

.conversation-item:hover,
.conversation-item.active {
    background-color: #e9ecef;
}

.conversation-item.active {
    font-weight: bold;
}

.conversation-item .profile-pic-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
}

.conversation-item .conv-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.conversation-item .conv-info h4 {
    margin: 0;
    font-size: 1em;
    color: #007bff; /* Warna biru untuk nama pengguna */
}

.conversation-item .last-message-time {
    font-size: 0.75em;
    color: #888;
    margin-top: 2px;
}

.conversation-item .unread-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #dc3545; /* Merah untuk notifikasi */
    color: white;
    font-size: 0.7em;
    padding: 3px 7px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    line-height: 1;
}

/* Header Chat */
.chat-header {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
    background-color: #f1f1f1;
    position: sticky; /* Agar header tetap di atas saat scroll */
    top: 0;
    z-index: 10; /* Pastikan di atas pesan */
}

.chat-header .profile-pic-small {
    margin-right: 10px;
}

.chat-header .chat-partner-info h4 {
    margin: 0;
    font-size: 1.1em;
    color: #333;
}

.chat-header .delete-conversation-button {
    margin-left: auto; /* Dorong tombol ke kanan */
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    display: flex; /* Untuk ikon dan teks */
    align-items: center;
}

.chat-header .delete-conversation-button i {
    margin-right: 5px;
}

/* Area Tampilan Pesan */
.messages-display {
    flex: 1; /* Mengisi ruang yang tersisa */
    padding: 15px;
    overflow-y: auto; /* Pastikan bisa di-scroll */
    display: flex;
    flex-direction: column; /* Pesan akan tersusun vertikal */
}

.message-bubble {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 10px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word; /* Memastikan teks panjang pecah baris */
}

.message-bubble .message-content {
    display: flex;
    flex-direction: column;
}

.message-bubble .sender-name {
    font-size: 0.8em;
    color: #555;
    margin-bottom: 3px;
    font-weight: bold;
}

.message-bubble p {
    margin: 0;
    padding: 0;
}

.message-bubble .message-time {
    font-size: 0.7em;
    color: #777;
    text-align: right; /* Waktu di kanan bawah bubble */
    margin-top: 5px;
}

/* Pesan Dikirim (oleh pengguna saat ini) */
.message-bubble.sent {
    background-color: #007bff; /* Warna biru untuk pesan terkirim */
    color: white;
    align-self: flex-end; /* Dorong ke kanan */
    border-bottom-right-radius: 2px; /* Sudut bawah kanan agak tajam */
}

.message-bubble.sent .sender-name {
    color: rgba(255, 255, 255, 0.8);
}

.message-bubble.sent .message-time {
    color: rgba(255, 255, 255, 0.7);
}

/* Pesan Diterima (dari partner chat) */
.message-bubble.received {
    background-color: #e4e6eb; /* Warna abu-abu terang untuk pesan diterima */
    color: #333;
    align-self: flex-start; /* Dorong ke kiri */
    border-bottom-left-radius: 2px; /* Sudut bawah kiri agak tajam */
}

.message-bubble.received .sender-name {
    color: #555;
}

.message-bubble.received .message-time {
    color: #777;
}

/* Input Form Pesan */
.message-form {
    border-top: 1px solid #eee;
    padding: 10px 15px;
    background-color: #f1f1f1;
    display: flex;
    flex-direction: column; /* Agar preview file di bawah input */
    position: sticky; /* Agar form tetap di bawah */
    bottom: 0;
    z-index: 10;
}

.message-input-area {
    display: flex;
    align-items: flex-end; /* Penting! Agar tombol sejajar dengan dasar textarea */
    gap: 10px; /* Jarak antar elemen */
}

.message-input-area textarea {
    flex: 1; /* Mengisi sebagian besar ruang */
    min-height: 40px; /* Tinggi minimum */
    max-height: 150px; /* Tinggi maksimum untuk textarea */
    resize: none; /* Nonaktifkan resize manual */
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 0.95em;
    line-height: 1.4;
    overflow-y: auto; /* Izinkan scroll saat teks melebihi max-height */
}

.message-input-area .icon-button {
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%; /* Tombol bulat */
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1em;
    transition: background-color 0.2s ease;
    flex-shrink: 0; /* Penting: agar tombol tidak menyusut */
}

.message-input-area .icon-button:hover {
    background-color: #0056b3;
}

.message-input-area .attach-file-button {
    background-color: #6c757d; /* Abu-abu untuk tombol lampirkan */
}

.message-input-area .attach-file-button:hover {
    background-color: #5a6268;
}

/* File Attachment Display */
.file-attachment {
    margin-top: 5px;
    margin-bottom: 5px;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    background-color: #f9f9f9;
    display: inline-block; /* Agar tidak mengambil seluruh lebar */
    max-width: 100%;
}

.file-attachment .attached-image {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin-bottom: 5px;
}

.file-attachment .attached-video,
.file-attachment .attached-audio {
    max-width: 100%;
    width: 100%; /* Pastikan elemen media mengisi kontainer */
    display: block;
    margin-bottom: 5px;
}

.file-attachment .file-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #007bff;
    font-weight: bold;
    word-break: break-all; /* Memastikan nama file panjang pecah baris */
}

.file-attachment .file-link i {
    margin-right: 5px;
}

.file-preview-container {
    display: flex;
    align-items: center;
    margin-top: 5px;
    background-color: #e9ecef;
    padding: 5px 10px;
    border-radius: 15px;
    display: none; /* Sembunyikan secara default, akan diatur via JS */
}

.file-name-display {
    flex-grow: 1;
    font-size: 0.85em;
    color: #555;
    margin-right: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.remove-file-button {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}

/* Pesan jika tidak ada chat dipilih */
.no-chat-selected {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #888;
    font-size: 1.1em;
    text-align: center;
}

/* Media Queries untuk responsivitas */
@media (max-width: 768px) {
    .messages-container {
        flex-direction: column; /* Ubah ke layout tumpuk */
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        min-height: 100vh; /* Ambil seluruh tinggi viewport */
    }

    .conversations-list {
        flex: 0 0 auto; /* Biarkan konten menentukan tinggi */
        border-right: none;
        border-bottom: 1px solid #eee; /* Batas bawah saat tumpuk */
        min-height: unset; /* Hapus min-height sebelumnya */
    }

    /* Di layar kecil, sembunyikan daftar jika chat dipilih */
    .conversations-list.hidden-on-chat {
        height: 0;
        min-height: 0;
        padding: 0;
        border-bottom: none;
        overflow: hidden;
        opacity: 0;
        pointer-events: none;
    }

    .chat-interface {
        flex: 1; /* Ambil sisa ruang */
    }

    /* Tombol hapus percakapan mungkin perlu penyesuaian untuk layar kecil */
    .chat-header .delete-conversation-button {
        font-size: 0.8em;
        padding: 5px 8px;
    }

    .message-bubble {
        max-width: 85%; /* Lebih lebar di layar kecil */
    }
}

/* messages.css atau style.css */

.conversation-item {
    display: flex; /* Menggunakan Flexbox untuk mengatur item */
    align-items: center; /* Pusatkan item secara vertikal */
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s ease;
    gap: 10px; /* Memberi jarak antara foto profil dan info percakapan */
}

.conversation-item .profile-pic-small {
    width: 50px; /* Ukuran foto profil */
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0; /* Mencegah foto profil mengecil */
}

.conversation-item .conv-info {
    display: flex; /* Menggunakan Flexbox untuk info di samping foto */
    flex-direction: column; /* Menjaga nama dan waktu di tumpuk */
    flex-grow: 1; /* Memungkinkan info percakapan mengambil ruang yang tersedia */
}

.conversation-item .conv-info h4 {
    margin: 0;
    font-size: 1em;
    font-weight: 600;
}

.conversation-item .conv-info .last-message-time {
    font-size: 0.8em;
    color: #777;
    white-space: nowrap; /* Mencegah waktu pesan putus baris */
}

.conversation-item .unread-badge {
    margin-left: auto; /* Dorong badge ke paling kanan */
    background-color: #007bff;
    color: white;
    font-size: 0.75em;
    padding: 3px 7px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    box-sizing: border-box;
}

/* Penyesuaian untuk tampilan mobile jika diperlukan (opsional, tergantung CSS Anda saat ini) */
@media (max-width: 768px) {
    .messages-container.fb-messenger-layout .conversations-list.hidden-on-chat {
        display: none;
    }

    .messages-container.fb-messenger-layout .chat-interface.expanded-on-chat {
        display: flex;
        flex-direction: column;
        flex-grow: 1;
    }
}
