/* style.css */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;700&family=Sarabun:wght@300;400;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: 'Sarabun', sans-serif; 
    line-height: 1.6; 
    color: var(--text-dark); 
    background-color: var(--bg-light); 
}

h1, h2, h3, h4, h5, h6, .nav-text, .nav-left a, .btn-lesson, .btn-back {
    font-family: 'Kanit', sans-serif;
}

/* Full-width nav ที่อยู่บนสุด */
.full-nav { background-color: var(--secondary-color); padding: 10px 0; 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: 0 20px; }
.nav-left { display: flex; gap: 20px; }
.nav-left a { color: var(--primary-color); text-decoration: none; font-weight: bold; padding: 5px 0; transition: color 0.3s; }
.nav-left a:hover, .nav-left a.active { color: #ffffff; }
.nav-right { display: flex; align-items: center; gap: 15px; }
.nav-text { font-weight: bold; color: var(--primary-color); font-size: 1.1em; }

/* 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 Grid */
.page-title { text-align: center; color: var(--primary-color); margin-bottom: 30px; font-size: 2em; }
.lessons-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 25px; }
.lesson-card { background-color: var(--white); border-radius: 12px; padding: 30px 20px; text-align: center; box-shadow: 0 4px 10px rgba(0,0,0,0.05); transition: transform 0.3s ease, box-shadow 0.3s ease; display: flex; flex-direction: column; justify-content: space-between; }
.lesson-card:hover { transform: translateY(-5px); box-shadow: 0 8px 20px rgba(0,0,0,0.1); }
.lesson-icon { font-size: 3.5em; margin-bottom: 15px; }
.lesson-card h3 { color: var(--primary-color); margin-bottom: 10px; font-size: 1.3em; }
.lesson-card p { color: #7f8c8d; margin-bottom: 25px; font-size: 0.95em; flex-grow: 1; }
.btn-lesson { display: inline-block; background-color: var(--accent-color); color: var(--white); text-decoration: none; padding: 10px 20px; border-radius: 25px; font-weight: bold; transition: background-color 0.3s ease; }
.btn-lesson:hover { background-color: #1557b0; color: var(--white); }

/* Lesson Content Pages */
.lesson-content-card {
    background-color: var(--white);
    border-radius: 15px;
    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.1em;
    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: 1px solid #eeeeee;
    padding-bottom: 20px;
}

.lesson-image-container { margin-bottom: 30px; }
.lesson-image-container img { max-width: 100%; height: auto; border-radius: 8px; }

.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.1em; }

.lesson-text ul { list-style-type: none; padding-left: 0; }
.lesson-text ul li {
    background-color: #f4f6f8; 
    border-left: 4px solid var(--accent-color); 
    margin-bottom: 15px;
    padding: 18px 25px;
    border-radius: 8px; 
    font-size: 1.05em;
    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;     /* จำกัดความกว้างไม่ให้เกิน 250px */
    max-height: 120px;    /* จำกัดความสูงไม่ให้เกิน 120px เพื่อไม่ให้ภาพล้นจอ */
    object-fit: contain;  /* รักษาสัดส่วนภาพเดิมไว้เสมอ */
    margin-bottom: 20px;
}

.flowchart-desc {
    background-color: #e9ecef; /* สีเทาอ่อนตามภาพ */
    color: var(--text-dark);
    padding: 15px 30px;
    border-radius: 50px; /* ขอบมนแบบแคปซูล */
    text-align: center;
    width: 100%;
    font-size: 1.05em;
}

/* 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 solid #eeeeee; flex-direction: row; justify-content: center; gap: 15px; }
    .profile-qr img { width: 80px; height: 80px; margin-bottom: 0; }
}
@media (max-width: 768px) {
    .nav-container-wrapper { flex-direction: column; gap: 10px; padding: 15px 20px; }
    .nav-left { flex-direction: column; gap: 10px; align-items: center; }
    .nav-right { flex-direction: column; align-items: center; gap: 8px; }
    .page-title { font-size: 1.6em; }
    .lesson-content-card { padding: 25px 20px; }
    .lesson-header { font-size: 1.5em; }
    .flowchart-desc { border-radius: 20px; padding: 15px; }
}