/* styles.css */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.container {
    max-width: 1200px;
    width: 90%;
    margin: 20px auto;
    padding: 20px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

h1 {
    text-align: center;
    color: #333;
}

#message-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); /* จัดแบบ grid */
    gap: 20px;
    margin-top: 20px;
    justify-items: center; /* จัดให้อยู่กึ่งกลาง */
}

/* Enhanced message box */
.message {
    background-color: #fff;
    padding: 15px;
    border-radius: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.message:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.message p {
    margin: 5px 0;
}


.message img.paperclip {
    width: 30px;
    height: auto;
    margin-top: 10px;
}

.message img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin-top: 10px;
}

/* Adjusted layout for text-only messages */
.message:not(:has(img)) {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

/* "+" button with animation */
#add-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background-color: #28a745;
    color: white;
    font-size: 30px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001; /* เพิ่ม z-index เพื่อให้อยู่เหนือองค์ประกอบอื่น */
}
#add-button:hover {
    background-color: #218838;
}

/* Bounce animation */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Modal animations */
.modal {
    display: none; /* ซ่อน modal */
    position: fixed;
    z-index: 1000; /* z-index สูงเพื่อให้อยู่เหนือส่วนอื่นๆ */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); /* สีพื้นหลังโปร่งใส */
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white; /* พื้นหลังสีขาว */
    padding: 20px; /* ระยะห่างภายใน */
    border-radius: 10px; /* มุมโค้ง */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* เงา */
    width: auto; /* กว้างตามเนื้อหา */
    max-width: 600px; /* กว้างสุดไม่เกิน 600px */
}

.close {
    float: right; /* วางทางขวาสุดของ modal content */
    font-size: 28px; /* ขนาดของตัว X */
    cursor: pointer; /* ให้เมาส์เป็นรูปมือเมื่อชี้ */
    color: #333; /* สีของตัว X */
}

.message-time {
    font-size: 12px;
    color: #888;
}


/* Styling the textarea and buttons in the modal */
textarea {
    width: 100%;
    height: 100px;
    margin-top: 10px;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 16px;
}

button {
    margin-top: 10px;
    padding: 10px 15px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #218838;
}


/* Adjustments for different types of messages */
.message.text-only {
    width: 100%; /* full width for text only */
    margin: 10px 0; /* give some top and bottom margin */
}

.message.image-only {
    width: 24%; /* one-quarter width for images only */
}

.message.text-and-image {
    width: 48%; /* half width for text with images */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Adjustments for larger screens */
@media (min-width: 600px) {
    .message.text-only {
        width: 48%; /* half width on larger screens */
    }
    .message.image-only {
        width: 22%; /* roughly one-quarter */
    }
    .message.text-and-image {
        width: 48%; /* half width */
    }
}

@media (min-width: 900px) {
    .message.text-only,
    .message.text-and-image,
    .message.image-only {
        width: 22%; /* one-quarter on even larger screens */
    }
}
/* Adjustments for messages without images */
.message:not(:has(img)) {
    width: 100%; /* Adjust this to fit the layout you desire, e.g., 80% to make it narrower */
    max-width: 300px; /* Adjust this to make the box narrower */
    margin: 10px auto; /* Centers the box and provides some spacing */
    padding: 10px; /* Reduce padding to decrease overall size */
    background-color: #f9f9f9; /* Example background color */
    border-radius: 5px; /* Rounded corners */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); /* Subtle shadow for depth */
}
.navbar-right {
    display: flex;
    align-items: center; /* จัดให้องค์ประกอบอยู่ตรงกลางแนวตั้ง */
}

.search-input {
    flex-grow: 1; /* ให้ช่องค้นหาขยายเต็มพื้นที่ที่เหลือ */
    margin-right: 10px; /* ระยะห่างระหว่างช่องค้นหาและรูปภาพ */
    border: 2px solid #ccc; /* เส้นขอบ */
    border-radius: 20px; /* ทำมุมให้เป็นวงกลม */
    padding: 8px; /* พื้นที่ภายในช่องค้นหา */
    outline: none; /* ลบเส้นขอบสีน้ำเงินเมื่อโฟกัส */
}

.profile-icon {
    width: 30px; /* ขนาดของรูปภาพ */
    height: 30px; /* ขนาดของรูปภาพ */
    border-radius: 50%; /* ทำให้รูปภาพเป็นวงกลม */
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    z-index: 1;
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
}

.profile:hover .dropdown-content {
    display: block;
}

.dropdown-content a:hover {
    background-color: #f1f1f1;
}

.navbar {
    background-color: #FFFFFF; /* สีพื้นหลังสีขาว */
    color: #333333; /* สีของข้อความเป็นสีเทาเข้ม */
    display: flex;
    justify-content: space-between;
    padding: 10px 20px; /* ระยะห่างภายใน */
    box-shadow: none; /* ไม่มีเงา */
    border-bottom: 2px solid #EAEAEA; /* เส้นขอบด้านล่างสีเทาอ่อน */
}

.navbar a {
    text-decoration: none;
    color: #555555; /* สีของข้อความเป็นสีเทาปานกลาง */
    padding: 10px 15px; /* ระยะห่างรอบข้อความ */
    font-size: 16px; /* ขนาดข้อความ */
    font-family: 'Roboto', sans-serif; /* ฟอนต์ที่ใช้ */
    transition: color 0.3s; /* แอนิเมชันเปลี่ยนสี */
}

.navbar a:hover {
    color: #1A73E8; /* สีเวลาโฮเวอร์เป็นสีน้ำเงิน */
    background-color: transparent; /* พื้นหลังโปร่งใสเมื่อโฮเวอร์ */
}

/* ใส่เส้นขอบและการปรับพื้นหลังสำหรับแถบนำทาง */

#message-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.message {
    background-color: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out;
}

.message:hover {
    transform: scale(1.05);
}

/* ธีมสว่าง (ค่าเริ่มต้น) */
body {
    background-color: white;
    color: black;
}

/* ธีมมืด */
body.dark-mode {
    background-color: black;
    color: white;
}

/* สไตล์สำหรับปุ่มสลับธีม */
.profile-menu {
    position: relative;
    display: inline-block;
}

.profile-pic {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
}

.profile-settings {
    display: none;
    position: absolute;
    top: 60px;
    right: 0;
    background-color: white;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1;
}

.profile-menu:hover .profile-settings {
    display: block;
}

.profile-settings button {
    background: none;
    border: none;
    padding: 10px;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

.profile-settings button:hover {
    background-color: #f0f0f0;
}
/* ธีมสว่าง (ค่าเริ่มต้น) */
body {
    background-color: white;
    color: black;
}

/* ธีมมืด */
body.dark-mode {
    background-color: black;
    color: white;
}