/* Universal Selector & Basic Resets */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
}

body {
    background-color: #f4f4f4;
    color: #333;
    line-height: 1.6;
    padding: 20px;
}

header {
    background-color: #0056b3;
    color: white;
    padding: 15px 20px;
    text-align: center;
    margin-bottom: 30px; /* เพิ่ม margin ด้านล่างเพื่อแยกส่วนหัว */
}

header h1 {
    color: white;
    margin-bottom: 10px;
}

header nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

header nav ul li {
    display: inline;
    margin: 0 10px;
}

header nav ul li a {
    color: white;
    text-decoration: none;
    font-weight: bold;
}

header nav ul li a:hover {
    text-decoration: underline;
}

main {
    max-width: 1000px; /* เพิ่มความกว้างสูงสุดสำหรับเนื้อหาหลัก */
    margin: 20px auto;
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

section {
    margin-bottom: 40px; /* เพิ่มระยะห่างระหว่าง Section */
    border-bottom: 1px dashed #ccc;
    padding-bottom: 30px;
}

section:last-child {
    border-bottom: none;
}

h2 {
    color: #007bff;
    margin-bottom: 20px;
    text-align: center;
}

h3 {
    color: #0056b3;
    margin-bottom: 15px;
    text-align: center;
}

p {
    margin-bottom: 10px;
}

/* --- Flexbox Specific Styles --- */

.flex-container {
    /* นี่คือการเปิดใช้งาน Flexbox บน Parent Element */
    **display: flex;**

    /* คุณสมบัติหลักที่ทำให้ Items อยู่ในแถวและจัดเรียง */
    **justify-content: center;** /* จัดเรียง Item ให้อยู่ตรงกลางตามแนวนอน (แกนหลัก) */
    **align-items: flex-start;** /* จัดเรียง Item ให้อยู่ที่จุดเริ่มต้นตามแนวตั้ง (แกนขวาง) */

    background-color: #e0f7fa;
    border: 2px solid #00bcd4;
    padding: 15px;
    min-height: 150px; /* กำหนดความสูงขั้นต่ำเพื่อให้เห็นผลชัดเจน */
    gap: 10px; /* ระยะห่างระหว่าง Flex Items (CSS Property ใหม่) */
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.flex-item {
    background-color: #80deea;
    color: #333;
    padding: 20px;
    border: 1px solid #0097a7;
    border-radius: 5px;
    font-weight: bold;
    text-align: center;
    min-width: 80px; /* กำหนดความกว้างขั้นต่ำของ Item */
}

/* Flex Direction Examples */
.flex-row {
    flex-direction: row; /* ค่า Default: จัดเรียงเป็นแถว */
    justify-content: space-around; /* กระจาย Item โดยมีช่องว่างรอบๆ */
}

.flex-column {
    flex-direction: column; /* จัดเรียงเป็นคอลัมน์ */
    align-items: center; /* จัดเรียง Item ให้อยู่ตรงกลางตามแนวนอน (สำหรับคอลัมน์) */
    min-height: 250px; /* เพิ่มความสูงสำหรับคอลัมน์ */
}


footer {
    text-align: center;
    padding: 15px;
    margin-top: 40px;
    background-color: #eee;
    color: #555;
    font-size: 0.9em;
    border-top: 1px solid #ddd;
}