/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Itim&family=Mali:wght@400;600;700&display=swap');

:root {
    --primary-color: #2c3e50;
    --secondary-color: #ffc107; 
    --accent-color: #1a73e8; 
    --bg-light: #f8f9fa;
    --text-dark: #2d3436;
    --white: #ffffff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    font-family: 'Itim', cursive; 
    line-height: 1.6; 
    color: var(--text-dark); 
    background-color: var(--bg-light); 
    font-size: 18px; 
}

h1, h2, h3, h4, h5, h6, .nav-text, .nav-links a, .btn-lesson, .btn-back {
    font-family: 'Mali', cursive;
}

/* =========================================
   สไตล์สำหรับ Navigation
   ========================================= */
.full-nav { background-color: var(--secondary-color); width: 100%; position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.nav-container-wrapper { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; transition: all 0.3s ease; }

.nav-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.nav-text { font-weight: bold; color: var(--primary-color); font-size: 1.2em; }

/* ซ่อนปุ่ม 3 ขีดบนหน้าจอคอมพิวเตอร์ */
.hamburger { display: none; cursor: pointer; flex-direction: column; gap: 5px; background: transparent; border: none; padding: 5px; outline: none; }
.hamburger span { display: block; width: 25px; height: 3px; background-color: var(--primary-color); border-radius: 3px; transition: all 0.3s ease; }

.nav-links { display: flex; gap: 20px; align-items: center; }
.nav-links a { color: var(--primary-color); text-decoration: none; font-weight: bold; padding: 5px 0; transition: color 0.3s; }
.nav-links a:hover, .nav-links a.active { color: #ffffff; }

/* Main Content Container */
.main-container { max-width: 1200px; margin: 40px auto; padding: 0 20px; min-height: 60vh; }

/* การ์ดประวัติครูผู้สอน */
.teacher-profile-card {
    background-color: var(--white); border-radius: 15px; box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: grid; grid-template-columns: 35% 45% 20%; overflow: hidden; margin-bottom: 30px; transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.teacher-profile-card:hover { transform: translateY(-5px); box-shadow: 0 8px 25px rgba(0,0,0,0.15); }
.profile-sidebar { background-color: var(--secondary-color); padding: 40px; display: flex; flex-direction: column; align-items: center; text-align: center; color: var(--primary-color); }
.profile-photo { width: 180px; height: 180px; border-radius: 50%; object-fit: cover; border: 5px solid #ffffff; box-shadow: 0 4px 6px rgba(0,0,0,0.2); margin-bottom: 20px; }
.profile-sidebar h1 { font-size: 2.2em; font-weight: bold; margin-bottom: 10px; }
.profile-sidebar p { font-size: 1.1em; margin-bottom: 5px; }
.profile-content { padding: 40px 30px; color: var(--primary-color); }
.profile-content h2 { font-size: 1.8em; font-weight: bold; color: var(--accent-color); margin-bottom: 25px; display: flex; align-items: center; gap: 10px; }
.content-section { margin-bottom: 25px; }
.content-section h3 { font-size: 1.3em; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.profile-content ul { list-style: none; padding-left: 0; }
.profile-content ul li { font-size: 1.1em; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.profile-content ul li img { width: 18px; height: 18px; }
.tags { display: flex; flex-wrap: wrap; gap: 10px; }
.tag { padding: 5px 12px; border-radius: 15px; color: #ffffff; font-size: 0.9em; font-weight: bold; transition: transform 0.2s ease, opacity 0.3s ease; cursor: default; }
.tag:hover { transform: scale(1.05); opacity: 0.9; }
.tag-web { background-color: var(--accent-color); }
.tag-iot { background-color: #2ecc71; }
.tag-graphic { background-color: #34dbdf; }
.profile-qr { padding: 40px 30px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; border-left: 1px solid #eeeeee; }
.profile-qr img { width: 120px; height: 120px; margin-bottom: 15px; }
.profile-qr p { font-size: 0.95em; color: #7f8c8d; }

footer { background-color: var(--primary-color); color: #ffffff; text-align: center; padding: 25px; margin-top: auto;}

/* =========================================
   สไตล์สำหรับหน้า Lessons (หน้าเลือกบทเรียน)
   ========================================= */
.page-title { text-align: center; color: var(--primary-color); margin-bottom: 40px; font-size: 2.5em; text-shadow: 2px 2px 0px #ffe599; }
.lessons-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 30px; }
.lesson-card { background-color: var(--white); border-radius: 35px; padding: 45px 25px 35px 25px; text-align: center; box-shadow: 0 10px 20px rgba(0,0,0,0.04); transition: transform 0.3s ease, box-shadow 0.3s ease; display: flex; flex-direction: column; justify-content: space-between; border: 4px dashed #e0e0e0; }

.lesson-card:nth-child(1) { border-color: #ffb3ba; }
.lesson-card:nth-child(1) h3 { color: #ff8b94; }
.lesson-card:nth-child(2) { border-color: #ffdfba; }
.lesson-card:nth-child(2) h3 { color: #ffaa33; }
.lesson-card:nth-child(3) { border-color: #bae1ff; }
.lesson-card:nth-child(3) h3 { color: #5dade2; }
.lesson-card:nth-child(4) { border-color: #baffc9; }
.lesson-card:nth-child(4) h3 { color: #48c9b0; }
.lesson-card:nth-child(5) { border-color: #e6b3ff; }
.lesson-card:nth-child(5) h3 { color: #c36bfa; }

.lesson-card:hover { transform: translateY(-8px); box-shadow: 0 15px 30px rgba(0,0,0,0.08); }
.lesson-icon { font-size: 5em; margin-bottom: 20px; transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55); }
.lesson-card:hover .lesson-icon { transform: scale(1.25) rotate(10deg); }
.lesson-card h3 { margin-bottom: 15px; font-size: 1.5em; }
.lesson-card p { color: #7f8c8d; margin-bottom: 30px; font-size: 1.15em; flex-grow: 1; }

.btn-lesson { display: inline-block; background-color: var(--white); text-decoration: none; padding: 12px 25px; border-radius: 30px; font-weight: bold; transition: all 0.3s ease; font-size: 1.2em; border: 3px solid transparent; }
.lesson-card:nth-child(1) .btn-lesson { border-color: #ffb3ba; color: #ff8b94; }
.lesson-card:nth-child(1) .btn-lesson:hover { background-color: #ffb3ba; color: var(--white); }
.lesson-card:nth-child(2) .btn-lesson { border-color: #ffdfba; color: #ffaa33; }
.lesson-card:nth-child(2) .btn-lesson:hover { background-color: #ffdfba; color: var(--white); }
.lesson-card:nth-child(3) .btn-lesson { border-color: #bae1ff; color: #5dade2; }
.lesson-card:nth-child(3) .btn-lesson:hover { background-color: #bae1ff; color: var(--white); }
.lesson-card:nth-child(4) .btn-lesson { border-color: #baffc9; color: #48c9b0; }
.lesson-card:nth-child(4) .btn-lesson:hover { background-color: #baffc9; color: var(--white); }
.lesson-card:nth-child(5) .btn-lesson { border-color: #e6b3ff; color: #c36bfa; }
.lesson-card:nth-child(5) .btn-lesson:hover { background-color: #e6b3ff; color: var(--white); }

/* =========================================
   สไตล์สำหรับหน้า Lesson 1-5 (เนื้อหาบทเรียน)
   ========================================= */
.lesson-content-card { background-color: var(--white); border-radius: 25px; padding: 40px 50px; box-shadow: 0 5px 15px rgba(0,0,0,0.05); }
.btn-back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 25px; color: var(--accent-color); text-decoration: none; font-weight: bold; font-size: 1.2em; transition: color 0.3s ease; }
.btn-back:hover { color: var(--primary-color); text-decoration: underline; }
.lesson-header { color: var(--primary-color); margin-bottom: 25px; font-size: 2.2em; border-bottom: 2px dashed #eeeeee; padding-bottom: 20px; }
.lesson-image-container { margin-bottom: 30px; text-align: center; }
.lesson-image-container img { max-width: 100%; height: auto; border-radius: 15px; }
.lesson-text { color: var(--text-dark); }
.lesson-text h3 { color: var(--primary-color); font-size: 1.6em; margin-bottom: 15px; }
.lesson-text p { margin-bottom: 20px; font-size: 1.15em; }
.lesson-text ul { list-style-type: none; padding-left: 0; }
.lesson-text ul li { background-color: #fdfdfd; border: 2px dashed #e0e0e0; border-left: 6px solid var(--secondary-color); margin-bottom: 15px; padding: 18px 25px; border-radius: 15px; font-size: 1.1em; color: var(--text-dark); }

/* Flowchart Layout for Lesson 2 */
.flowchart-list { display: flex; flex-direction: column; align-items: center; gap: 40px; margin-top: 40px; }
.flowchart-item { display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 600px; }
.flow-icon { width: auto; height: auto; max-width: 250px; max-height: 120px; object-fit: contain; margin-bottom: 20px; }
.flowchart-desc { background-color: #fff9e6; border: 2px dashed #ffc107; color: var(--text-dark); padding: 15px 30px; border-radius: 50px; text-align: center; width: 100%; font-size: 1.1em; }

/* =========================================
   Responsive สำหรับแท็บเล็ตและมือถือ
   ========================================= */
@media (max-width: 992px) {
    .teacher-profile-card { grid-template-columns: 1fr; }
    .profile-sidebar, .profile-content, .profile-qr { padding: 30px 20px; }
    .profile-qr { border-left: none; border-top: 1px dashed #eeeeee; flex-direction: row; justify-content: center; gap: 15px; }
    .profile-qr img { width: 80px; height: 80px; margin-bottom: 0; }
}

@media (max-width: 768px) {
    /* ปรับแต่ง Navbar สำหรับมือถือ */
    .nav-container-wrapper { flex-direction: column; padding: 0; align-items: stretch; }
    .nav-header { padding: 15px 20px; display: flex; width: 100%; justify-content: space-between; align-items: center; }
    
    .hamburger { display: flex; } /* แสดงปุ่ม 3 ขีด */
    
    /* อนิเมชั่นปุ่ม 3 ขีด เปลี่ยนเป็นกากบาท */
    .hamburger.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
    .hamburger.active span:nth-child(2) { opacity: 0; }
    .hamburger.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    /* ซ่อนเมนูเริ่มต้น และแสดงเมื่อกดปุ่ม (active) */
    .nav-links { 
        display: none; 
        flex-direction: column; 
        width: 100%; 
        padding: 0 20px 20px 20px; 
        gap: 10px; 
        text-align: center;
        background-color: var(--secondary-color);
        box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    }
    .nav-links.active { display: flex; }
    
    /* ตกแต่งเส้นคั่นเมนูให้ดูสวยบนมือถือ */
    .nav-links a { 
        font-size: 1.2em; 
        border-bottom: 1px dashed rgba(255,255,255,0.4); 
        padding: 10px 0; 
        width: 100%; 
    }
    .nav-links a:last-child { border-bottom: none; }

    /* ปรับแต่งส่วนเนื้อหาบนมือถือ */
    .page-title { font-size: 1.8em; }
    .lesson-content-card { padding: 25px 20px; }
    .lesson-header { font-size: 1.8em; }
    .flowchart-desc { border-radius: 20px; padding: 15px; }
}