#chat-history {
    padding: 10px;
    max-height: 400px;
    overflow-y: auto;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.chat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #ddd;
    cursor: pointer;
}

.chat-item:hover {
    background-color: #f1f1f1;
}

.chat-info {
    flex: 1;
}

.chat-info strong {
    font-size: 16px;
    color: #333;
}

.chat-info p {
    margin: 5px 0;
    color: #666;
    font-size: 14px;
}

.chat-info small {
    color: #999;
    font-size: 12px;
}

#chat-container {
    display: flex;
    flex-wrap: nowrap; /* Pastikan elemen tidak terbungkus */
    gap: 20px; /* Jarak antara chat dan form */
}

#chat-header {
    background-color: #4caf50;
    color: white;
    padding: 10px;
    text-align: center;
    font-size: 18px;
    font-weight: bold;
}

#chat-box {
    flex: 1; 
    padding: 10px;
    overflow-y: auto; 
    background-color: #fafafa;
    border: 1px solid #ddd;
    box-sizing: border-box;
}

.chat-message {
    margin: 10px 0; 
    display: flex; 
}

.chat-message.received {
    justify-content: flex-start; /* Posisi kiri */
}

.chat-message.received p {
    background-color: #e0e0e0; /* Warna abu-abu */
    color: #000; /* Warna teks hitam */
    padding: 10px;
    border-radius: 8px;
    max-width: 60%; /* Maksimal 60% lebar chat-box */
    word-wrap: break-word; /* Agar teks tidak melewati batas */
}

/* Pesan dikirim (oleh pengguna) */
.chat-message.sent {
    justify-content: flex-end; /* Posisi kanan */
}

.chat-message.sent p {
    background-color: #4caf50; /* Warna hijau */
    color: white; /* Warna teks putih */
    padding: 10px;
    border-radius: 8px;
    max-width: 60%; /* Maksimal 60% lebar chat-box */
    word-wrap: break-word; /* Agar teks tidak melewati batas */
    text-align: right; /* Teks rata kanan */
}

#chat-input {
    display: flex;
    padding: 10px;
    border-top: 1px solid #ddd;
    background-color: #fff;
}

#message {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-right: 10px;
    outline: none;
    font-size: 14px;
}

#send {
    padding: 10px 20px;
    border: none;
    background-color: #4caf50;
    color: white;
    border-radius: 5px;
    font-size: 14px;
    cursor: pointer;
}

#send:hover {
    background-color: #45a049;
}

@media (max-width: 768px) {
    #chat-container {
        flex-direction: column; /* Susun secara vertikal */
        gap: 10px; /* Kurangi jarak antar elemen */
    }

    #chat-room, #table-section {
        flex: none;
        width: 100%; /* Pastikan elemen penuh di layar kecil */
    }
   

    #chat-room, #product-form {
        width: 100%;
    }

    #chat-header {
        font-size: 16px; /* Ukuran font lebih kecil */
        padding: 8px; /* Padding lebih kecil */
    }

    #chat-box {
        padding: 8px;
    }

    #message {
        font-size: 12px; /* Ukuran font textarea lebih kecil */
    }

    #send {
        font-size: 12px; /* Ukuran font tombol lebih kecil */
        padding: 8px 15px; /* Padding tombol lebih kecil */
    }
    thead {
        display: none;
    }
    #table-section {
        overflow-x: auto; /* Tabel bisa di-scroll horizontal */
    }
    
    table {
        display: block; /* Ubah tabel menjadi elemen blok */
        overflow-x: auto; /* Tambahkan scroll horizontal */
        white-space: nowrap; /* Hindari teks terpotong */
    }

     tbody, tr, th, td {
        display: block; /* Tampilkan sebagai blok untuk fleksibilitas */
    }

    tr {
        margin-bottom: 10px; /* Beri jarak antar baris pada mobile */
    }

    th, td {
        text-align: left;
        padding: 8px;
        word-wrap: break-word;
    }

    th {
        background-color: #007bff;
        color: white;
    }

    td::before {
        content: attr(data-label); /* Tambahkan label untuk setiap kolom */
        font-weight: bold;
        display: block;
        margin-bottom: 5px;
        color: #666;
    }
}

@media (max-width: 480px) {
    #chat-container {
        height: 85vh; /* Tinggi lebih pendek untuk layar kecil */
    }

    #chat-header {
        font-size: 14px;
        padding: 6px;
    }

    #message {
        font-size: 11px;
    }

    #send {
        font-size: 11px;
        padding: 6px 10px;
    }
}

#chat-box {
    -webkit-overflow-scrolling: touch; /* Smooth scrolling untuk iOS */
}


#chat-room, #product-form {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#product-form form label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

#product-form form input,
#product-form form textarea {
    width: 100%;
    box-sizing: border-box;
}


#table-section {
    overflow-x: auto; /* Memungkinkan scroll horizontal */
}

table {
    width: 100%; /* Pastikan tabel mengambil lebar penuh */
    border-collapse: collapse; /* Gabungkan border tabel */
}

thead th {
    background-color: #007bff; 
    color: white;
    text-align: left;
    padding: 10px;
}

tbody td {
    padding: 10px;
    border: 1px solid #ddd;
}
