/* assets/css/style.css */

/* ... (Kode CSS lainnya di bagian atas, pertahankan) ... */

/* --- Styling untuk Detail Postingan (post_detail.php) --- */
.post-detail-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin: 20px auto;
    padding: 25px;
    max-width: 700px; /* Lebar maksimum postingan detail */
}

.post-detail-card .post-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.post-detail-card .post-header .profile-pic-small { 
    /* **KRUSIAL: Ukuran foto profil di header postingan detail** */
    width: 48px; /* Ukuran pasti */
    height: 48px; /* Ukuran pasti */
    min-width: 48px; /* Pastikan tidak menyusut di bawah ukuran ini */
    min-height: 48px; /* Pastikan tidak menyusut di bawah ukuran ini */
    border-radius: 50%; /* Bulat sempurna */
    object-fit: cover; /* Memastikan foto mengisi area tanpa distorsi */
    border: 1px solid #ddd;
    flex-shrink: 0; /* Penting: gambar tidak akan menyusut */
}

.post-detail-card .post-header h4 {
    margin: 0;
    font-size: 1.1em;
    color: #050505;
}

.post-detail-card .post-header .post-time {
    font-size: 0.8em;
    color: #65676b;
    margin-left: auto;
}

.post-detail-card .post-content {
    margin-bottom: 20px;
    line-height: 1.6;
    color: #050505;
    word-break: break-word;
}

.post-detail-card .post-content img.post-media-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin-top: 10px;
    display: block;
}

.post-detail-card .post-content .video-thumbnail-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background-color: #f0f2f5;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 10px;
}

.post-detail-card .post-content .video-thumbnail-container video.post-media-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-detail-card .post-content .video-thumbnail-container .video-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5em;
    color: white;
    opacity: 0.8;
    transition: opacity 0.2s ease;
}
.post-detail-card .post-content .video-thumbnail-container:hover .video-play-overlay {
    opacity: 1;
}


.post-detail-card .post-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    border-top: 1px solid #f0f2f5;
    padding-top: 15px;
}

.post-detail-card .post-actions .view-count {
    font-size: 0.9em;
    color: #65676b;
}

.post-detail-card .post-actions .action-button {
    background-color: #e4e6eb;
    color: #050505;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.9em;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease;
}
.post-detail-card .post-actions .action-button:hover {
    background-color: #d8dadf;
}
.post-detail-card .post-actions .edit-post-button,
.post-detail-card .post-actions .delete-post-button {
    margin-left: auto; /* Dorong ke kanan */
}

/* --- Styling untuk Chat di Detail Postingan --- */
.chat-section {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    margin: 20px auto;
    padding: 25px;
    max-width: 700px;
}

.chat-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.3em;
    color: #050505;
    border-bottom: 1px solid #f0f2f5;
    padding-bottom: 10px;
}

.chat-list {
    margin-bottom: 15px;
}

.chat-item {
    display: flex;
    align-items: flex-start; /* Pusatkan vertikal di bagian atas */
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid #f0f2f5;
    position: relative; /* Untuk tombol aksi overlay */
}
.chat-item:last-child {
    border-bottom: none;
}

.chat-item .chat-profile-pic {
    /* **KRUSIAL: Ukuran foto profil di chat** */
    width: 36px; /* Ukuran pasti */
    height: 36px; /* Ukuran pasti */
    min-width: 36px; /* Pastikan tidak menyusut */
    min-height: 36px; /* Pastikan tidak menyusut */
    border-radius: 50%; /* Bulat sempurna */
    object-fit: cover; /* Memastikan foto mengisi area tanpa distorsi */
    border: 1px solid #ddd;
    flex-shrink: 0; /* Penting: gambar tidak akan menyusut */
}

.chat-item .chat-content-bubble {
    background-color: #f0f2f5;
    border-radius: 18px;
    padding: 10px 15px;
    color: #050505;
    flex-grow: 1;
    min-width: 0; /* Penting untuk flex-grow agar tidak overflow */
    box-sizing: border-box; /* Pastikan padding dihitung dalam lebar */
}

.chat-item.my-chat {
    flex-direction: row-reverse; /* Balik arah untuk chat saya */
}
.chat-item.my-chat .chat-content-bubble {
    background-color: #e1f3ff; /* Warna bubble saya */
}

.chat-item .chat-username {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
    color: #1877f2; /* Warna link username */
    text-decoration: none;
    line-height: 1.2;
}
.chat-item .chat-username:hover {
    text-decoration: underline;
}

.chat-item .chat-content-bubble p {
    margin: 0;
    line-height: 1.4;
    word-break: break-word;
}

.chat-item .chat-time {
    font-size: 0.75em;
    color: #65676b;
    display: block;
    margin-top: 3px;
    text-align: right; /* Waktu rata kanan */
}

/* --- Gaya untuk Tombol Edit/Hapus Chat/Komentar --- */
.chat-actions-overlay {
    position: absolute;
    top: 5px; /* Posisikan di dalam bubble */
    right: 5px; /* Sesuaikan posisi horizontal */
    display: flex;
    gap: 5px; /* Jarak antar tombol */
    opacity: 0; /* Sembunyikan secara default */
    transition: opacity 0.2s ease;
    z-index: 5;
}

.chat-item:hover .chat-actions-overlay {
    opacity: 1; /* Tampilkan saat hover pada chat-item */
}

.chat-actions-overlay button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 3px 5px;
    border-radius: 3px;
    transition: background-color 0.2s ease;
    color: #65676b; /* Warna ikon default */
}

.chat-item.my-chat .chat-actions-overlay button {
    color: rgba(255, 255, 255, 0.8); /* Warna ikon di bubble saya */
}


.chat-actions-overlay .edit-chat-button:hover {
    background-color: rgba(0,0,0,0.1);
}
.chat-item.my-chat .chat-actions-overlay .edit-chat-button:hover {
    background-color: rgba(255,255,255,0.2);
}


.chat-actions-overlay .delete-chat-button:hover {
    background-color: rgba(0,0,0,0.1);
}
.chat-item.my-chat .chat-actions-overlay .delete-chat-button:hover {
    background-color: rgba(255,255,255,0.2);
}


/* Styling untuk Form Edit Chat (jika diimplementasikan secara inline) */
.edit-chat-form {
    display: flex; /* Default disembunyikan oleh JS */
    align-items: center;
    gap: 5px;
    margin-top: 5px;
    width: 100%;
}

.edit-chat-form textarea {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 5px;
    resize: vertical;
    font-size: 14px;
    min-height: 30px;
    line-height: 1.4;
}

.edit-chat-form button {
    background-color: #1877f2;
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.edit-chat-form button.cancel-edit-chat {
    background-color: #6c757d;
}
.edit-chat-form button.cancel-edit-chat:hover {
    background-color: #5a6268;
}

.edit-chat-form .fa-check,
.edit-chat-form .fa-times {
    margin: 0;
}


.chat-form {
    display: flex;
    gap: 10px;
}

.chat-form textarea {
    flex-grow: 1;
    border: 1px solid #dddfe2;
    border-radius: 20px;
    padding: 10px 15px;
    font-size: 1em;
    outline: none;
    background-color: #f0f2f5;
    color: #050505;
    resize: none;
    min-height: 40px;
    box-sizing: border-box;
}
.chat-form textarea:focus {
    border-color: #1877f2;
}
.chat-form textarea::placeholder {
    color: #8a8d91;
}

.chat-form button {
    background-color: #1877f2;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0 15px;
    cursor: pointer;
    font-size: 1em;
    font-weight: bold;
    transition: background-color 0.2s ease;
    height: 40px;
}
.chat-form button:hover {
    background-color: #165bba;
}

.no-chats {
    text-align: center;
    padding: 15px;
    color: #777;
    font-style: italic;
}

/* Media Query untuk Detail Postingan */
@media (max-width: 600px) {
    .post-detail-card {
        padding: 15px;
        margin: 15px;
    }
    .post-detail-card .post-header {
        gap: 8px;
    }
    .post-detail-card .post-header .profile-pic-small {
        width: 36px;
        height: 36px;
        min-width: 36px; /* **KRUSIAL: Agar tidak menyusut** */
        min-height: 36px; /* **KRUSIAL: Agar tidak menyusut** */
    }
    .post-detail-card .post-header h4 {
        font-size: 1em;
    }
    .post-detail-card .post-header .post-time {
        font-size: 0.75em;
    }
    .chat-section {
        padding: 15px;
        margin: 15px;
    }
    .chat-item {
        gap: 8px;
        padding: 8px;
    }
    .chat-item .chat-profile-pic {
        width: 30px; /* **KRUSIAL: Ukuran lebih kecil di mobile** */
        height: 30px;
        min-width: 30px; /* **KRUSIAL: Agar tidak menyusut** */
        min-height: 30px; /* **KRUSIAL: Agar tidak menyusut** */
    }
    .chat-item .chat-content-bubble {
        padding: 8px 12px;
        font-size: 0.9em;
    }
    .chat-form textarea {
        padding: 8px 12px;
        font-size: 0.9em;
        min-height: 36px;
    }
    .chat-form button {
        font-size: 0.9em;
        padding: 0 12px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .post-detail-card {
        padding: 10px;
        margin: 10px;
    }
    .post-detail-card .post-header {
        gap: 5px;
    }
    .post-detail-card .post-header .profile-pic-small {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
    }
    .post-detail-card .post-header h4 {
        font-size: 0.9em;
    }
    .chat-section {
        padding: 10px;
        margin: 10px;
    }
    .chat-item {
        gap: 5px;
        padding: 6px;
    }
    .chat-item .chat-profile-pic {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
    }
    .chat-item .chat-content-bubble {
        padding: 6px 10px;
        font-size: 0.85em;
    }
    .chat-form textarea {
        padding: 6px 10px;
        font-size: 0.85em;
        min-height: 32px;
    }
    .chat-form button {
        font-size: 0.85em;
        padding: 0 10px;
        height: 32px;
    }
}


/* --- Komentar Section --- */
.comments-section {
    margin-top: 20px;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    background-color: #fff;
    font-family: 'Segoe UI', 'Roboto', sans-serif; /* Font mirip Facebook */
}

.comments-section h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 1.2em; /* Sedikit lebih kecil */
    font-weight: 600;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* --- Form Komentar --- */
.comment-form {
    display: flex;
    align-items: center; /* Sejajarkan vertikal */
    gap: 10px;
    margin-bottom: 20px;
}

.comment-form textarea {
    flex-grow: 1;
    padding: 10px 12px;
    border: 1px solid #ccd0d5; /* Border abu-abu muda */
    border-radius: 20px; /* Sudut lebih melengkung */
    min-height: 40px; /* Tinggi minimum yang nyaman */
    max-height: 120px; /* Tinggi maksimum agar tidak terlalu panjang */
    resize: vertical;
    font-size: 0.9em;
    line-height: 1.4;
    transition: border-color 0.2s ease;
}

.comment-form textarea:focus {
    border-color: #1877f2; /* Warna biru saat fokus */
    outline: none;
}

.comment-form .btn {
    background-color: #1877f2; /* Warna biru Facebook */
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.comment-form .btn:hover {
    background-color: #166fe5; /* Sedikit lebih gelap saat hover */
}

/* --- Daftar Komentar --- */
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Jarak antar komentar */
}

.comment-item {
    display: flex; /* Untuk menempatkan bubble di samping gambar profil */
    align-items: flex-start; /* Sejajarkan ke atas */
    position: relative;
    /* overflow: hidden; */ /* Untuk handle opsi di samping */
}

.comment-item .profile-pic-comment {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 8px;
    flex-shrink: 0; /* Mencegah gambar menyusut */
    margin-top: 4px; /* Sedikit geser ke bawah agar sejajar */
}

.comment-item .comment-wrapper {
    display: flex;
    width: 100%;
    position: relative; /* Untuk positioning opsi */
}

.comment-item .comment-content-bubble {
    background-color: #f0f2ff; /* Warna latar belakang mirip bubble komentar FB */
    padding: 8px 12px;
    border-radius: 18px; /* Sudut melengkung */
    max-width: calc(100% - 60px); /* Ruang untuk profil pic dan opsi */
    flex-grow: 1; /* Agar mengambil ruang yang tersedia */
    position: relative;
}

.comment-item .comment-meta {
    display: flex;
    align-items: baseline; /* Sejajarkan nama dan waktu */
    margin-bottom: 2px;
    flex-wrap: wrap; /* Untuk menangani nama panjang */
}

.comment-item .commenter-username-link {
    text-decoration: none;
    color: #050505;
    font-weight: 600; /* Tebal seperti nama FB */
    font-size: 0.88em;
    margin-right: 5px; /* Jarak antara nama dan waktu */
}

.comment-item .commenter-username-link:hover {
    text-decoration: underline;
}

.comment-item .comment-time {
    font-size: 0.75em;
    color: #65676b; /* Warna teks waktu */
}

.comment-item .comment-text {
    font-size: 0.9em;
    line-height: 1.35;
    color: #1c1e21; /* Warna teks konten */
    margin: 0; /* Hapus margin default paragraf */
}

.comment-item .comment-options {
    position: absolute;
    top: 5px; /* Sesuaikan posisi vertikal */
    right: 5px; /* Jarak dari kanan bubble */
    display: flex;
    gap: 2px; /* Jarak antar tombol */
    opacity: 0; /* Sembunyikan secara default */
    transition: opacity 0.2s ease;
    background-color: #f0f2f5; /* Background saat hover agar lebih jelas */
    border-radius: 5px;
    padding: 2px;
    z-index: 10; /* Pastikan di atas konten lain */
}

/* Tampilkan opsi saat hover pada bubble komentar */
.comment-item:hover .comment-options {
    opacity: 1;
}

.comment-item .comment-options .action-icon {
    background: none;
    border: none;
    color: #65676b;
    font-size: 0.8em; /* Ukuran ikon lebih kecil */
    cursor: pointer;
    padding: 4px; /* Padding lebih kecil */
    border-radius: 50%; /* Bulat */
    transition: background-color 0.2s ease;
}

.comment-item .comment-options .action-icon:hover {
    background-color: #e4e6eb; /* Warna hover mirip FB */
}

.no-comments {
    text-align: center;
    color: #65676b;
    margin-top: 20px;
    font-style: italic;
    font-size: 0.9em;
}

/* --- Styles for Edit Comment Form --- */
.edit-comment-form {
    margin-top: 5px; /* Jarak dari meta info */
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.edit-comment-textarea {
    width: 100%; /* Lebar penuh dalam bubble */
    padding: 8px;
    border: 1px solid #ccd0d5;
    border-radius: 8px; /* Sudut tidak terlalu bulat */
    min-height: 60px;
    resize: vertical;
    font-size: 0.9em;
    line-height: 1.4;
    box-sizing: border-box; /* Pastikan padding tidak menambah lebar */
}

.edit-comment-actions {
    display: flex;
    gap: 5px;
    justify-content: flex-end; /* Rata kanan tombol */
    font-size: 0.8em; /* Ukuran font untuk teks "Simpan", "Batal" */
}

.edit-comment-actions .btn-sm {
    background-color: #e4e6eb; /* Warna abu-abu tombol aksi */
    color: #4b4f56;
    padding: 6px 10px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.edit-comment-actions .btn-sm:hover {
    background-color: #d1d4da;
}

.edit-comment-actions .btn-sm.btn-secondary { /* Untuk tombol batal jika ada warna khusus */
    /* background-color: #ccc; */
}

/* Utility classes (alert-message) */
.alert-container {
    margin-top: 20px;
    padding: 10px 15px;
    border-radius: 5px;
    text-align: center;
}

.alert-message {
    padding: 8px 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    font-weight: bold;
    color: white;
}

.alert-message.green {
    background-color: #4CAF50;
}

.alert-message.red {
    background-color: #f44336;
}

.alert-message.info {
    background-color: #2196F3;
}