/* style.css (Revisi) */

body {
    font-family: Arial, sans-serif;
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
}

.chat-container {
    width: 90%;
    max-width: 600px;
    height: 90vh;
    max-height: 800px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

h2 {
    text-align: center;
    color: #333;
    padding: 15px;
    border-bottom: 1px solid #ddd;
    margin: 0;
}

/* === Perubahan Utama Dimulai di Sini === */

#chat-box {
    flex-grow: 1;
    padding: 20px 10px;
    overflow-y: auto;
    border-bottom: 1px solid #ddd;
    background-color: #e5ddd5; /* Latar belakang mirip WhatsApp lama */
    display: flex;
    flex-direction: column;
    gap: 12px; /* Jarak antar gelembung chat */
}

.message-wrapper {
    display: flex;
    width: 100%;
}

/* Penampung untuk pesan kita (rata kanan) */
.message-wrapper.me {
    justify-content: flex-end;
}

/* Penampung untuk pesan orang lain (rata kiri) */
.message-wrapper.other {
    justify-content: flex-start;
}

.message-item {
    padding: 10px 15px;
    border-radius: 12px;
    max-width: 80%;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}

/* Gelembung chat untuk pesan kita (kanan) */
.message-item.me {
    background-color: #dcf8c6; /* Warna hijau muda */
    border-top-right-radius: 0; /* Membuat sudut lebih tajam */
}

/* Gelembung chat untuk pesan orang lain (kiri) */
.message-item.other {
    background-color: #ffffff; /* Warna putih */
    border-top-left-radius: 0; /* Membuat sudut lebih tajam */
}

.message-item .username {
    font-weight: bold;
    color: #007bff;
    margin-bottom: 5px;
    font-size: 0.9em;
}

.message-item .timestamp {
    font-size: 0.75em;
    color: #888;
    float: right;
    margin-left: 10px;
    margin-top: 5px;
}

/* === Akhir Perubahan Utama === */

#chat-form {
    display: flex;
    padding: 15px;
    gap: 10px;
    align-items: center;
    position: relative;
    background-color: #f0f0f0;
}

#username, #message {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 20px;
}

#username {
    width: 120px;
}

#message {
    flex-grow: 1;
}

#emoji-btn {
    padding: 8px 12px;
    border: none;
    background: none;
    font-size: 1.5em;
    cursor: pointer;
}

#chat-form button[type="submit"] {
    padding: 10px 20px;
    border: none;
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    width: 50px;
    height: 50px;
}

#chat-form button[type="submit"]:hover {
    background-color: #0056b3;
}

emoji-picker {
    position: absolute;
    bottom: 75px;
    right: 15px;
    z-index: 1000;
}

/* style.css (Tambahan untuk Fitur Bintang) */

.message-item {
    position: relative; /* Diperlukan agar tombol bintang bisa diposisikan */
    padding-right: 40px; /* Beri ruang untuk tombol bintang */
}

.star-btn {
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 1.2em;
    color: #ccc;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

.star-btn:hover {
    color: #FFC107; /* Warna kuning saat hover */
    transform: scale(1.2);
}

.star-btn.starred {
    color: #FFC107; /* Warna kuning solid jika sudah berbintang */
}

/* Sedikit penyesuaian untuk pesan "me" agar bintang tidak terlalu menempel */
.message-item.me {
    padding-right: 45px;
}