/* static/css/style.css */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* จัดให้อยู่ด้านบนของหน้า */
    min-height: 100vh;
    box-sizing: border-box; /* ให้ padding นับรวมในขนาด */
}

.container {
    background-color: #ffffff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px; /* จำกัดความกว้างสูงสุด */
    box-sizing: border-box;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
}

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: bold;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px;
}

input[type="file"] {
    width: 100%;
    padding: 10px 0;
    font-size: 16px;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background-color: #28a745; /* สีเขียว */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    margin-top: 20px;
    transition: background-color 0.3s ease;
}

.btn-submit:hover {
    background-color: #218838;
}

.message {
    margin-top: 20px;
    padding: 10px;
    border-radius: 4px;
    text-align: center;
    font-weight: bold;
}

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

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

/* Image Previews Styles */
.image-preview-item {
    border: 1px solid #ccc;
    padding: 5px;
    margin: 5px;
    border-radius: 4px;
    text-align: center;
    width: 120px; /* กำหนดความกว้างของแต่ละ Preview Item */
    height: 160px; /* กำหนดความสูงของแต่ละ Preview Item */
    overflow: hidden; /* ซ่อนส่วนที่เกินขอบเขต */
    position: relative; /* สำหรับตำแหน่งของปุ่มลบ */
    box-sizing: border-box;
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
    align-items: center; 
    background-color: #f9f9f9;
}


/* ทำให้รูปภาพและวิดีโอถูกจำกัดขนาดภายในกรอบ Preview */
.image-preview-item > img,  /* <--- เพิ่ม > เพื่อให้เฉพาะเจาะจงขึ้น */
.image-preview-item > video { /* <--- เพิ่ม > เพื่อให้เฉพาะเจาะจงขึ้น */
    max-width: 100px; /* ลดขนาด max-width ให้ชัดเจนขึ้น */
    max-height: 100px; /* กำหนดความสูงสูงสุดสำหรับ media */
    width: auto; /* รักษาความกว้างอัตโนมัติ */
    height: auto; /* รักษาความสูงอัตโนมัติ */
    object-fit: contain; /* ปรับขนาดให้พอดีกรอบโดยรักษาสัดส่วน */
    display: block;
    margin-bottom: 5px; 
    /* ลองเพิ่ม !important ชั่วคราว ถ้ายังไม่ได้ผล (ค่อยลบออกทีหลัง) */
    /* width: auto !important; */
    /* height: auto !important; */
    /* max-width: 100px !important; */
    /* max-height: 100px !important; */
    /* object-fit: contain !important; */
}

.image-preview-item input[type="text"] {
    font-size: 12px; /* ลดขนาด font */
    padding: 3px; /* ลด padding */
    margin-top: 5px;
    width: calc(100% - 6px); /* ปรับความกว้าง */
    box-sizing: border-box;
}
.image-preview-item .remove-image-btn {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 2px 5px; /* ลด padding */
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px; /* ลดขนาด font */
    margin-top: 5px;
}
.image-preview-item .remove-image-btn:hover {
    background-color: #c82333;
}


/* Confirmation Modal Styles */
.modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1; /* 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.4); /* Black w/ opacity */
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto; /* 15% from the top and centered */
    padding: 20px;
    border: 1px solid #888;
    border-radius: 8px;
    width: 80%; /* Could be more or less, depending on screen size */
    max-width: 600px;
    position: relative;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

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

.btn-confirm {
    background-color: #007bff; /* Blue */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin-right: 10px;
}
.btn-confirm:hover {
    background-color: #0056b3;
}

.btn-cancel {
    background-color: #6c757d; /* Gray */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}
.btn-cancel:hover {
    background-color: #5a6268;
}

#confirmationDetails {
    margin-bottom: 20px;
    line-height: 1.6;
    max-height: 300px; /* จำกัดความสูง */
    overflow-y: auto; /* ทำให้ scroll ได้ */
}
#confirmationDetails strong {
    color: #333;
}

/* ปรับแต่งสำหรับหน้าจอมือถือ (Responsive) */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 20px;
    }
    h1 {
        font-size: 24px;
    }
    .btn-submit {
        padding: 10px;
        font-size: 16px;
    }
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
}

/* --- [เพิ่ม] สไตล์สำหรับส่วนแสดงผลผู้ใช้ (User Profile Bar) --- */
.user-profile-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* จัดชิดขวา */
    width: 100%;
    padding: 5px 0;
    margin-bottom: 20px;
    gap: 15px; /* ระยะห่างระหว่าง elements */
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}
.user-profile-bar .profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #eee;
}
.user-profile-bar span {
    font-weight: bold;
    color: #333;
}
.user-profile-bar .logout-link {
    color: #dc3545;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
}
.user-profile-bar .logout-link:hover {
    text-decoration: underline;
}

/* --- [เพิ่ม] สไตล์สำหรับปุ่มกลับไปหน้าหลัก --- */
.back-to-menu-container {
    width: 100%;
    margin-bottom: 20px;
    text-align: left;
}
.back-link {
    display: inline-block;
    padding: 8px 15px;
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    font-size: 14px;
}
.back-link:hover {
    background-color: #5a6268;
}

/* */
#google-login-container {
    margin-top: 30px;
    width: 100%;
    display: flex;
    justify-content: center;
}
.main-menu {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 400px;
}
.menu-button {
    display: block;
    padding: 20px;
    background-color: #007bff;
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}
.menu-button:hover {
    background-color: #0056b3;
}
.admin-link {
    background-color: #6c757d;
}
.admin-link:hover {
    background-color: #5a6268;
}