/* =======================================
   BASE STYLES & VARIABLES
======================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff69b4;
    --primary-light: #ffe6f2;
    --primary-dark: #e754a1;
    --glass-bg: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 105, 180, 0.18);
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --shadow-light: 0 8px 32px rgba(255, 105, 180, 0.08);
    --shadow-medium: 0 12px 40px rgba(255, 105, 180, 0.13);
    --shadow-heavy: 0 20px 60px rgba(255, 105, 180, 0.18);
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    background: linear-gradient(135deg, #fff 0%, #ffe6f2 100%);
    background-attachment: fixed;
    font-family: 'Sarabun', sans-serif;
    line-height: 1.6;
}

/* Background Animation */
.bg-animation {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1; overflow: hidden;
}

.floating-shapes {
    position: absolute; width: 100px; height: 100px; border-radius: 50%;
    background: linear-gradient(45deg, rgba(255, 105, 180, 0.13), rgba(255, 255, 255, 0.08));
    animation: float 15s infinite ease-in-out;
}
.floating-shapes:nth-child(1) { top: 10%; left: 10%; animation-delay: -2s; }
.floating-shapes:nth-child(2) { top: 20%; right: 10%; animation-delay: -4s; width: 150px; height: 150px; }
.floating-shapes:nth-child(3) { bottom: 20%; left: 15%; animation-delay: -6s; width: 80px; height: 80px; }
.floating-shapes:nth-child(4) { bottom: 30%; right: 20%; animation-delay: -8s; }

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(90deg); }
    50% { transform: translateY(0px) rotate(180deg); }
    75% { transform: translateY(-15px) rotate(270deg); }
}

/* =======================================
   HEADER & NAVIGATION
======================================= */
header {
    position: sticky; top: 0; display: flex; justify-content: space-between; align-items: center;
    padding: 15px 5%; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border); box-shadow: var(--shadow-medium);
    z-index: 1000; transition: all 0.3s ease;
}

header.scrolled { padding: 10px 5%; background: rgba(255, 255, 255, 0.95); }

.logo {
    font-family: 'Kanit', sans-serif; font-size: clamp(1.2rem, 4vw, 2.2rem);
    font-weight: 700; color: var(--primary-color); display: flex; align-items: center; gap: 10px;
}
.logo img { height: clamp(30px, 8vw, 60px); width: auto; }

.nav-menu { display: flex; gap: 5px; list-style: none; align-items: center; }
.nav-menu li a {
    display: block; padding: 10px 18px; border-radius: 25px;
    background: rgba(255, 255, 255, 0.7); color: var(--primary-color);
    border: 1px solid var(--glass-border); font-weight: 600; text-decoration: none; transition: all 0.3s ease;
}
.nav-menu li a:hover, .nav-menu li a.active {
    background: var(--primary-color); color: #fff; box-shadow: 0 10px 25px rgba(255, 105, 180, 0.18);
}

.has-submenu { position: relative; }
.submenu {
    position: absolute; top: 120%; left: 0; min-width: 250px; background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--glass-border); box-shadow: var(--shadow-heavy); padding: 15px 0;
    opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all 0.3s ease; z-index: 1001; border-radius: 12px;
}
.has-submenu:hover .submenu { opacity: 1; visibility: visible; transform: translateY(0); }
.submenu li a { padding: 10px 25px; border: none; border-radius: 0; background: transparent; }
.submenu li a:hover { background: var(--primary-light); padding-left: 35px; box-shadow: none; }

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--primary-light));
    color: #fff; padding: 10px 25px; border: none; border-radius: 25px; font-size: 1rem;
    font-weight: 500; cursor: pointer; text-decoration: none; display: inline-block; box-shadow: var(--shadow-light);
}

/* =======================================
   MAIN CONTENT & COMPONENTS
======================================= */
main { min-height: 80vh; padding: 30px 5%; }

/* Glass Card */
.glass-card {
    background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(24px); border-radius: 20px;
    border: 1.5px solid var(--glass-border); box-shadow: var(--shadow-heavy); padding: clamp(20px, 5vw, 50px);
    margin-bottom: 30px; position: relative; overflow: hidden;
}
.glass-card h1 { color: var(--primary-color); font-size: clamp(1.5rem, 5vw, 2.5rem); }

/* Feature Grid Responsive */
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin-top: 30px; }
.feature-item {
    background: rgba(255, 255, 255, 0.7); border-radius: 20px; height: clamp(200px, 30vw, 300px);
    position: relative; overflow: hidden; box-shadow: var(--shadow-medium);
}
.feature-item img { width: 100%; height: 100%; object-fit: cover; }
.content-bottom {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8)); padding: 20px 15px; color: white; text-align: center;
}
.content-bottom h2 { font-size: clamp(1rem, 4vw, 1.5rem); color: #fff; }

.gall-container { text-align: center; margin: 30px 0; }
.view-gall-btn {
    display: inline-flex; align-items: center; gap: 10px; background: #fff; padding: 12px 25px;
    border-radius: 25px; font-weight: 600; text-decoration: none; color: #000; box-shadow: 0 5px 15px rgba(255, 105, 180, 0.3);
}

/* News Cards */
.news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; margin-bottom: 60px; }
.news-card { background: white; border-radius: 20px; box-shadow: var(--shadow-medium); overflow: hidden; }
.news-card-image { width: 100%; height: 200px; position: relative; }
.news-card-image img { width: 100%; height: 100%; object-fit: cover; }
.team-badge { position: absolute; top: 15px; left: 15px; }
.team-label { background: #ff6b35; color: white; padding: 5px 15px; border-radius: 25px; font-size: 12px; }
.news-card-content { padding: 20px; }
.news-title { font-size: clamp(1.1rem, 3vw, 1.4rem); margin-bottom: 10px; line-height: 1.4; }

/* =======================================
   PROFILE SECTION (หน้าประวัติ)
======================================= */
.profile-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    display: flex;
    gap: 60px;
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.85); /* ให้ดูใสๆ เหมือนกระจกหน้าอื่น */
    border-radius: 20px;
    box-shadow: var(--shadow-heavy);
}

.profile-photo {
    flex: 0 0 300px;
    width: 300px;
    overflow: hidden;
    border-radius: 15px; /* ทำมุมให้มนสวยขึ้น */
}

.profile-image {
    width: 100%;
    height: 350px;
    object-fit: cover;
    object-position: center;
    display: block;
}

.profile-content {
    flex: 1;
    padding-top: 0;
}

.profile-subtitle {
    color: #FF8A00;
    font-weight: 500;
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.profile-name {
    color: #001B8A;
    font-size: clamp(2rem, 5vw, 3.5rem); /* ให้ชื่อเล็กลงตามจออัตโนมัติ */
    margin: 0 0 30px 0;
    font-weight: 700;
    line-height: 1.1;
    font-family: 'Sarabun', sans-serif;
}

.profile-roles {
    color: #333;
    font-size: 1.15rem;
    line-height: 1.8;
}

/* =======================================
   MODAL LOGIN
======================================= */
.login-container {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.4); display: none; align-items: center; justify-content: center; z-index: 9999; backdrop-filter: blur(5px);
}
.login-box {
    background: rgba(255, 255, 255, 0.95); padding: 40px 30px; border-radius: 16px;
    width: 90%; max-width: 400px; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2); position: relative; animation: fadeInUp 0.3s ease;
}
.login-box h2 { color: #000; font-size: clamp(24px, 6vw, 36px); margin-bottom: 20px; }
.login-box form { display: flex; flex-direction: column; }
.login-box label { text-align: left; margin: 10px 0 5px 5px; font-size: 14px; font-weight: 600; color: #333; }
.login-box input { width: 100%; padding: 12px 15px; margin-bottom: 20px; border: 1px solid #ccc; border-radius: 25px; background: #f9f9f9; font-size: 1rem; }
.login-box button[type="submit"] { width: 100%; padding: 12px 0; border-radius: 25px; background: #000; color: #fff; font-size: 1.2rem; font-weight: bold; cursor: pointer; transition: 0.3s; }
.login-box button[type="submit"]:hover { background: #ff69b4; }
.close { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; color: #666; cursor: pointer; }

/* =======================================
   FOOTER
======================================= */
.footer { background: linear-gradient(135deg, #861043 0%, #C6185C 100%); color: white; padding: 40px 5% 20px; }
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 30px; }
.footer-section h3 { font-size: 1.2rem; margin-bottom: 15px; position: relative; padding-bottom: 10px; }
.footer-section h3::after { content: ''; position: absolute; bottom: 0; left: 0; width: 40px; height: 3px; background: #00d4ff; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 10px; padding-left: 20px; position: relative; }
.footer-links li::before { content: '▶'; position: absolute; left: 0; color: #00d4ff; font-size: 10px; top: 6px; }
.footer-links a { color: #e8f4fd; text-decoration: none; font-size: 0.95rem; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, 0.2); padding-top: 20px; margin-top: 30px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; }

/* =======================================
   MOBILE & RESPONSIVE QUERIES
======================================= */
.mobile-menu-btn {
    display: none; background: none; border: none; color: var(--primary-color); font-size: 1.8rem; cursor: pointer;
}

@media (max-width: 900px) {
    .mobile-menu-btn { display: block; margin-left: auto; }
    nav { width: 0; }
    
    /* เมนูแฮมเบอร์เกอร์ */
    .nav-menu {
        position: fixed; top: 70px; right: -100%; width: 280px; height: calc(100vh - 70px);
        background: rgba(255, 255, 255, 0.98); flex-direction: column; padding: 20px;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1); transition: 0.4s ease; overflow-y: auto;
    }
    .nav-menu.active { right: 0; }
    .nav-menu li { width: 100%; }
    .nav-menu li a { border: none; border-bottom: 1px solid #eee; border-radius: 0; padding: 15px 10px; background: transparent; }
    .submenu { position: static; box-shadow: none; opacity: 1; visibility: visible; display: none; background: #f9f9f9; }
    .has-submenu.show .submenu { display: block; }
    
    /* ✅ แก้สัดส่วนหน้าจอ Profile บน Tablet/Mobile ให้เรียงลงมาด้านล่าง ไม่เบียดกัน */
    .profile-section {
        flex-direction: column; /* ให้รูปภาพอยู่บน ข้อความอยู่ล่าง */
        align-items: center;
        text-align: center;
        gap: 30px;
        padding: 30px 15px;
    }
    .profile-photo {
        width: 250px; /* ลดขนาดรูปลงมาหน่อย */
        flex: 0 0 250px;
    }
    .profile-image {
        height: 250px;
        border-radius: 50%; /* เปลี่ยนรูปเป็นวงกลมบนมือถือให้ดูสวยขึ้น */
    }
}

@media (max-width: 480px) {
    header { padding: 10px 15px; }
    main { padding: 20px 15px; }
    .news-grid { grid-template-columns: 1fr; }
    .footer-content { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; text-align: center; justify-content: center; }
    .back-to-top { margin-top: 10px; }
    .glass-card { padding: 20px 15px; }
    .slider { height: 250px; }

    /* ✅ แก้สัดส่วนหน้า Profile บนมือถือเล็กสุดๆ */
    .profile-photo {
        width: 200px;
        flex: 0 0 200px;
    }
    .profile-image {
        height: 200px;
    }
    .profile-roles {
        font-size: 1rem; /* ลดขนาดตัวอักษรเนื้อหาลงหน่อย */
    }
}

/* Animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

        .lesson-section {
            max-width: 1000px;
            margin: 32px auto;
        }
        .lesson-categories {
            display: flex;
            gap: 18px;
            flex-wrap: wrap;
            margin-bottom: 28px;
            justify-content: center;
        }
        .lesson-category {
            background: linear-gradient(90deg,#ff69b4 0%,#e754a1 100%);
            color: #fff;
            padding: 12px 32px;
            border-radius: 24px;
            font-size: 1.1em;
            font-weight: 500;
            box-shadow: 0 2px 8px rgba(255,105,180,0.08);
            cursor: pointer;
            transition: background 0.18s;
            border: none;
        }
        .lesson-category.active,
        .lesson-category:hover {
            background: linear-gradient(90deg,#e754a1 0%,#ff69b4 100%);
        }
        .lessons-list {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 28px;
        }
        .lesson-card {
            background: rgba(255,255,255,0.18);
            border-radius: 18px;
            box-shadow: 0 4px 24px rgba(255,105,180,0.10);
            padding: 28px 22px 18px 22px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            transition: box-shadow 0.18s, transform 0.18s;
        }
        .lesson-card:hover {
            box-shadow: 0 8px 32px rgba(255,105,180,0.18);
            transform: translateY(-6px) scale(1.02);
        }
        .lesson-title {
            font-size: 1.3em;
            font-weight: bold;
            color: #e754a1;
        }
        .lesson-meta {
            font-size: 0.98em;
            color: #7f8c8d;
            margin-bottom: 6px;
        }
        .lesson-status {
            display: inline-block;
            padding: 4px 14px;
            border-radius: 12px;
            font-size: 0.95em;
            font-weight: 500;
            background: #ffe6f2;
            color: #e754a1;
            margin-right: 8px;
        }
        .lesson-actions {
            margin-top: 10px;
        }
        .lesson-btn {
            display: inline-block;
            padding: 8px 22px;
            border-radius: 8px;
            background: linear-gradient(90deg,#ff69b4 0%,#e754a1 100%);
            color: #fff;
            font-weight: 500;
            text-decoration: none;
            font-size: 1em;
            margin-right: 8px;
            transition: background 0.18s;
        }
        .lesson-btn:hover {
            background: linear-gradient(90deg,#e754a1 0%,#ff69b4 100%);
        }
        @media (max-width: 800px) {
            .lessons-list {
                grid-template-columns: 1fr;
                gap: 18px;
            }
            .lesson-section {
                padding: 0 4px;
            }
        }