/* ===== Base Styles ===== */
:root {
  /* --- NEW YELLOW-BLACK THEME --- */
  --primary-color: #ffc107; /* Yellow */
  --primary-dark: #e0a800; /* Darker Yellow */
  --secondary-color: #212529; /* Black/Dark Gray */
  --accent-color: #f59e0b; /* Orange-Yellow for accents */
  --text-color: #1f2937;
  --text-light: #6b7280;
  --bg-color: #f9fafb;
  --bg-card: rgba(255, 255, 255, 0.7);
  --border-color: rgba(0, 0, 0, 0.1);
  --shadow-color: rgba(0, 0, 0, 0.1);
  --gradient-start: #ffc107; /* Yellow */
  --gradient-end: #343a40; /* Dark Gray */

  /* --- Glassmorphism from original --- */
  --glass-bg: rgba(255, 255, 255, 0.25);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);

  /* --- Gradients updated to new theme --- */
  --yellow-gradient: linear-gradient(135deg, #ffc107, #ffda6a);
  --black-gradient: linear-gradient(135deg, #495057, #212529);

  --blue-gradient: linear-gradient(135deg, #3b82f6, #60a5fa);
  --purple-gradient: linear-gradient(135deg, #8b5cf6, #a78bfa);
  --green-gradient: linear-gradient(135deg, #10b981, #34d399);
  --orange-gradient: linear-gradient(135deg, #f59e0b, #fbbf24);

  --glow-yellow: 0 0 15px rgba(255, 193, 7, 0.5);
}

/* ===== General Body & Typography ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  font-family: "Sarabun", sans-serif;
  color: var(--text-color);
  background: linear-gradient(135deg, #fdfcfb, #f5f5f5, #fffbeb);
  background-size: 400% 400%;
  animation: gradientBG 15s ease infinite;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
@keyframes gradientBG {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}
img {
  max-width: 100%;
  height: auto;
}
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
}
a:hover {
  color: var(--primary-dark);
}
ul {
  list-style: none;
}
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
  color: var(--primary-color);
}
h2 {
  font-size: 1.75rem;
  color: black;
}
h3 {
  font-size: 1.35rem;
}
p {
  margin-bottom: 1rem;
}

/* ===== Header, Nav, Buttons ===== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 1rem;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  transition: all 0.3s ease;
  overflow: hidden;
}
.glass-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
  border-color: var(--primary-color);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 2rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  position: relative;
  overflow: hidden;
  z-index: 1;
}
.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0%;
  height: 100%;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  z-index: -1;
}
.btn:hover::before {
  width: 100%;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  color: var(--secondary-color);
  box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
}
.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(255, 193, 7, 0.6);
  color: #000;
}
.btn-outline {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-outline:hover {
  background: var(--primary-color);
  color: var(--secondary-color);
}

/* Header */
.header {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--glass-shadow);
}
.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 3.5rem;
}
.logo a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-color);
  font-weight: 700;
  font-size: 1.35rem;
}
.logo img {
  width: 2.75rem;
  height: 2.75rem;
  transition: transform 0.3s ease;
}
.logo:hover img {
  transform: rotate(10deg);
}

/* Nav */
.main-nav ul {
  display: flex;
  gap: 2rem;
}
.main-nav a {
  color: var(--text-color);
  font-weight: 500;
  position: relative;
  padding: 0.5rem 0;
}
.main-nav a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(to right, var(--primary-color), var(--accent-color));
  transition: width 0.3s ease;
}
.main-nav a:hover::after,
.main-nav a.active::after {
  width: 100%;
}
.main-nav a:hover,
.main-nav a.active {
  color: var(--primary-color);
}

.mobile-menu-toggle {
  display: none;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  width: 2.5rem;
  height: 2.5rem;
  cursor: pointer;
  position: relative;
  z-index: 101;
  box-shadow: var(--glass-shadow);
}

.mobile-menu-toggle span {
  display: block;
  width: 60%;
  height: 2px;
  background-color: var(--text-color);
  position: absolute;
  left: 20%;
  transition: all 0.3s ease;
}

.mobile-menu-toggle span:nth-child(1) {
  top: 35%;
}

.mobile-menu-toggle span:nth-child(2) {
  top: 50%;
  transform: translateY(-50%);
}

.mobile-menu-toggle span:nth-child(3) {
  bottom: 35%;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg);
  top: 50%;
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg);
  bottom: 45%;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  right: -100%;
  width: 80%;
  max-width: 300px;
  height: 100vh;
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  z-index: 100;
  padding: 5rem 1.5rem 1.5rem;
  transition: right 0.5s cubic-bezier(0.77, 0, 0.175, 1);
  box-shadow: var(--glass-shadow);
  border-left: 1px solid var(--glass-border);
}

.mobile-menu.active {
  right: 0;
}

.mobile-menu ul {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mobile-menu a {
  color: var(--text-color);
  font-weight: 500;
  font-size: 1.25rem;
  display: block;
  padding: 0.5rem 0;
  position: relative;
  transition: all 0.3s ease;
}

.mobile-menu a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  transition: width 0.3s ease;
}

.mobile-menu a:hover::after,
.mobile-menu a.active::after {
  width: 100%;
}

.mobile-menu a:hover,
.mobile-menu a.active {
  color: var(--primary-color);
  transform: translateX(10px);
}

/* ===== Hero Section (IMPROVED FOR MOBILE) ===== */
.hero {
  position: relative;
  min-height: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
  color: white;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("../images/IMG_0317.jpg");
  background-size: cover;
  background-position: center;
  filter: brightness(0.4);
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(33, 37, 41, 0.85), rgba(255, 193, 7, 0.7));
  animation: pulseGradient 8s infinite alternate;
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  width: 100%;
}

@keyframes pulseGradient {
  0% {
    opacity: 0.8;
  }
  100% {
    opacity: 1;
  }
}
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  animation: fadeInUp 1s ease;
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.directors-container {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2rem;
  flex-wrap: nowrap;
  max-width: 1000px;
  margin: 0 auto;
}

.director-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 250px;
  flex-shrink: 0;
  margin: 20px 0;
}

.director-profile img {
  max-height: 300px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 5px 20px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s ease;
}

.director-profile:hover img {
  transform: scale(1.05);
}

.director-profile h4 {
  margin: 1rem 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.director-profile p {
  margin: 0;
  font-size: 1.1rem;
  opacity: 0.9;
  text-align: center;
}

.vice-director-profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 250px;
  flex-shrink: 0;
  margin-bottom: 40px;
}

.vice-director-profile img {
  max-height: 200px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 5px 20px rgba(0, 0, 0, 0.4));
  transition: transform 0.3s ease;
}

.vice-director-profile:hover img {
  transform: scale(1.05);
}

.vice-director-profile h4 {
  margin: 1rem 0 0.25rem;
  font-size: 1.5rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  text-align: center;
}

.vice-director-profile p {
  margin: 0;
  font-size: 1.1rem;
  opacity: 0.9;
  text-align: center;
}

.school-main-info {
  max-width: 500px;
  margin: 0 2rem;
  flex-shrink: 0;
}

.hero-school-logo {
  width: 120px;
  height: 120px;
  margin: 0 auto 1rem auto;
  animation: float 3s ease-in-out infinite;
  display: block;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

.school-main-info h1.school-name {
  font-size: 3.5rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
  color: #fde68a;
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.school-main-info .school-affiliation {
  font-size: 1.2rem;
  margin-top: 0.5rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  line-height: 1.3;
}

/* ===== Quick Links ===== */
.quick-links {
  margin-top: -2rem;
  position: relative;
  z-index: 2;
  padding: 0 1rem;
}
.quick-links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}
.quick-link-card {
  display: flex;
  align-items: center;
  padding: 1.75rem;
  border-radius: 1rem;
  color: white;
  transition: all 0.3s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  z-index: 1;
}
.quick-link-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
  z-index: -1;
}
.quick-link-card:hover::before {
  transform: translateX(0);
}
.quick-link-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}
.quick-link-card.blue {
  background: var(--blue-gradient);
}
.quick-link-card.purple {
  background: var(--purple-gradient);
}
.quick-link-card.green {
  background: var(--green-gradient);
}
.quick-link-card.orange {
  background: var(--orange-gradient);
}
.quick-link-icon {
  font-size: 2.5rem;
  margin-right: 1.25rem;
  transition: transform 0.3s ease;
}
.quick-link-card:hover .quick-link-icon {
  transform: scale(1.2);
}
.quick-link-content h3 {
  margin-bottom: 0.35rem;
  color: white;
  font-size: 1.35rem;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}
.quick-link-more {
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  opacity: 0.9;
}
.arrow {
  margin-left: 0.5rem;
  transition: transform 0.3s ease;
}
.quick-link-card:hover .arrow {
  transform: translateX(8px);
}

/* ===== News Section ===== */
.news {
  padding: 2rem 0;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  position: relative;
}
.section-header::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 80px;
  height: 3px;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  border-radius: 3px;
}
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2.5rem;
}
.news-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}
.news-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
  border-color: var(--primary-color);
}
.news-image {
  height: 220px;
  overflow: hidden;
  position: relative;
  background-color: #000; /* เพิ่มพื้นหลังสีดำสำหรับวิดีโอ */
}

/* ลบ Overlay ที่บังการคลิกออกไป แต่เก็บไว้สำหรับ card ที่เป็นรูปภาพ */
.news-card:not(.video-news-card) .news-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.7));
  z-index: 1;
}

/* ทำให้รูปภาพยังคงแสดงผลได้ดี */
.news-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.news-card:hover .news-image img {
  transform: scale(1.1);
}


.video-news-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

.video-news-card .news-image {
  /* ใช้เทคนิค aspect-ratio เพื่อรักษาสัดส่วนวิดีโอ */
  position: relative;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
}

.video-news-card .news-image iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.news-content {
  padding: 1.75rem;
}
.news-date {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 1rem;
}
.news-content h3 {
  margin-bottom: 0.85rem;
  transition: color 0.3s ease;
}
.news-card:hover h3 {
  color: var(--primary-color);
}
.news-content p {
  color: var(--text-light);
  margin-bottom: 1.25rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-link {
  font-weight: 600;
  display: inline-block;
  position: relative;
  padding-bottom: 2px;
}
.news-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  transition: width 0.3s ease;
}
.news-link:hover::after {
  width: 100%;
}

/* ===== Stats Section ===== */
.stats {
  padding: 2rem 0;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.stats::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("../images/pattern.png");
  opacity: 0.1;
  animation: moveBackground 20s linear infinite;
}
@keyframes moveBackground {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 100% 100%;
  }
}
.stats h2 {
  margin-bottom: 2.5rem;
  position: relative;
  display: inline-block;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  -webkit-text-fill-color: white;
}
.stats h2::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: white;
  border-radius: 3px;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  position: relative;
  z-index: 1;
}
.stat-card {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 1rem;
  padding: 10px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.5s ease;
}
.stat-card:hover::before {
  opacity: 1;
}
.stat-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.stat-label {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* ===== PPN News (Newsletter) Section ===== */
.newsletter-section {
  padding: 2rem 0;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  position: relative;
}
.section-header::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 80px;
  height: 3px;
  background: linear-gradient(to right, var(--primary-color), var(--accent-color));
  border-radius: 3px;
}
.newsletter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}
.newsletter-card {
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}
.newsletter-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
  border-color: var(--primary-color);
}
.newsletter-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  cursor: pointer;
  display: block;
  transition: transform 0.5s ease;
}
.newsletter-card:hover img {
  transform: scale(1.05);
}

/* ===== Image Viewer Modal ===== */
.image-viewer-modal {
  display: none;
  position: fixed;
  z-index: 1001;
  padding: 50px 20px;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}
.modal-content {
  margin: auto;
  display: block;
  max-width: 90%;
  max-height: 80vh;
  animation: zoomIn 0.3s ease;
}
@keyframes zoomIn {
  from {
    transform: scale(0.9);
  }
  to {
    transform: scale(1);
  }
}
.close-viewer {
  position: absolute;
  top: 15px;
  right: 35px;
  color: #f1f1f1;
  font-size: 40px;
  font-weight: bold;
  transition: 0.3s;
  cursor: pointer;
}
.close-viewer:hover,
.close-viewer:focus {
  color: var(--primary-color);
  text-decoration: none;
}
.download-btn {
  margin-top: 20px;
  padding: 12px 25px;
  background-color: var(--primary-color);
  color: var(--secondary-color);
  text-decoration: none;
  border-radius: 50px;
  font-weight: 600;
  transition: all 0.3s;
}
.download-btn:hover {
  background-color: var(--primary-dark);
  transform: scale(1.05);
}

/* ===== Map & Facebook Section ===== */
.map-fb-section {
  padding: 4rem 0;
  background-color: rgba(0, 0, 0, 0.02);
}

.map-fb-grid {
  display: grid;
  grid-template-columns: 70% 1fr;
  gap: 2.5rem;
  align-items: stretch; /* สำคัญ: ทำให้กล่องทั้งสองสูงเท่ากัน */
}

.map-container,
.fb-feed-container {
  display: flex; /* สำคัญ: ทำให้เนื้อหาภายในยืดหยุ่น */
  flex-direction: column; /* จัดเรียงจากบนลงล่าง */
}

.map-container h3,
.fb-feed-container h3 {
  margin-bottom: 1rem; /* เพิ่มระยะห่างใต้หัวข้อ */
  font-size: 1.75rem;
  color: var(--text-color);
  flex-shrink: 0; /* ไม่ให้หัวข้อย่อขนาด */
}

.map-responsive {
  position: relative;
  overflow: hidden;
  width: 100%;
  border-radius: 1rem;
  box-shadow: var(--glass-shadow);
  flex-grow: 1; /* สำคัญ: ทำให้กล่องแผนที่ขยายเต็มพื้นที่ที่เหลือ */
}

.map-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- ส่วนที่แก้ไขสำหรับ Facebook --- */
.fb-page {
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  line-height: 0; /* ป้องกันการเกิดช่องว่างแปลกๆ */
  flex-grow: 1; /* สำคัญ: ทำให้กล่อง .fb-page ขยายเต็มพื้นที่ */
  width: 100% !important; /* บังคับให้กว้าง 100% */
  height: 100%; /* ทำให้สูง 100% ของพื้นที่ที่ flex-grow จัดให้ */
  display: flex; /* ทำให้ iframe ภายในยืดหยุ่น */
}

/* เราจะใช้ JavaScript จัดการ iframe โดยตรง แต่ใส่ไว้เผื่อ */
.fb-page iframe {
  width: 100% !important;
  height: 100% !important;
  border: none;
}

.fb_iframe_widget {
    display: flex;
    align-content: center;
    width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* ===== Footer ===== */
.footer {
  background: linear-gradient(to right, #2c3e50, #000000);
  color: white;
  color: white;
  padding: 2rem 0;
  position: relative;
  overflow: hidden;
}

.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("../images/pattern.png");
  opacity: 0.05;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 3rem;
  position: relative;
  z-index: 1;
}

.footer-logo {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.footer-logo img {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background-color: white;
  padding: 0.25rem;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.footer-logo h3 {
  margin-bottom: 0.25rem;
  color: white;
}

.footer-logo p {
  font-size: 0.9rem;
  opacity: 0.8;
  margin-bottom: 0;
}

.footer-about p {
  opacity: 0.8;
  margin-bottom: 1.5rem;
}

.social-links {
  display: flex;
  gap: 1rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  color: white;
  font-size: 1.25rem;
  transition: all 0.3s ease;
}

.social-link:hover {
  background: white;
  color: var(--primary-color);
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.footer h3 {
  color: white;
  position: relative;
  display: inline-block;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.contact-icon {
  font-size: 1.25rem;
  color: var(--primary-color);
}

.contact-item p {
  margin-bottom: 0;
  opacity: 0.8;
}

.footer-links ul {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.8);
  transition: all 0.3s ease;
  position: relative;
  padding-left: 1.25rem;
}

.footer-links a::before {
  content: "→";
  position: absolute;
  left: 0;
  transition: transform 0.3s ease;
}

.footer-links a:hover {
  color: white;
  padding-left: 1.5rem;
}

.footer-links a:hover::before {
  transform: translateX(5px);
}

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  margin-top: 3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0.7;
  font-size: 0.9rem;
}

/* ===== Page Header ===== */
.page-header {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  padding: 3rem 0;
  position: relative;
  overflow: hidden;
}

.page-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url("../images/pattern.png");
  opacity: 0.1;
}

.page-header h1 {
  color: white;
  margin-bottom: 0.5rem;
  position: relative;
  -webkit-text-fill-color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.page-header p {
  opacity: 0.9;
  max-width: 800px;
}

/* ===== IMPROVED RESPONSIVE STYLES FOR MOBILE ===== */
@media (max-width: 992px) {
  .map-fb-grid {
    grid-template-columns: 1fr;
  }
  .map-responsive {
    padding-top: 75%;
  }

  .directors-container {
    gap: 2rem;
  }

  .school-main-info h1.school-name {
    font-size: 3rem;
  }
}

@media (max-width: 768px) {
  .main-nav,
  .theme-toggle {
    display: none;
  }
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-menu {
    display: block;
  }

  /* HERO SECTION - MOBILE OPTIMIZED */
  .hero {
    min-height: 700px;
    padding: 2rem 0;
  }

  .directors-container {
    flex-direction: column;
    gap: 0;
    align-items: center;
    padding: 0 1rem;
  }

  .school-main-info {
    order: -1;
    text-align: center;
    width: 100%;
    max-width: none;
  }

  .hero-school-logo {
    width: 100px;
    height: 100px;
    margin-bottom: 1rem;
  }

  .school-main-info h1.school-name {
    font-size: 2.2rem;
    line-height: 1.1;
    margin-bottom: 0.75rem;
    padding: 0 0.5rem;
  }

  .school-main-info .school-affiliation {
    font-size: 1rem;
    line-height: 1.4;
    padding: 0 0.5rem;
  }

  .director-profile,
  .vice-director-profile {
    width: 100%;
    max-width: 280px;
  }

  .director-profile img {
    max-height: 250px;
    width: auto;
  }

  .vice-director-profile img {
    max-height: 200px;
    width: auto;
  }

  .director-profile h4,
  .vice-director-profile h4 {
    font-size: 1.3rem;
    margin-top: 0.75rem;
  }

  .director-profile p,
  .vice-director-profile p {
    font-size: 1rem;
  }

  /* OTHER SECTIONS */
  .newsletter-grid {
    grid-template-columns: 1fr;
  }

  .map-fb-grid {
    gap: 3rem;
    grid-template-columns: 1fr;
  }

  .fb-page iframe {
    min-height: 450px;
  }

  .quick-links {
    margin-top: -1rem;
  }

  .quick-links-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .quick-link-card {
    padding: 1.5rem;
  }

  .quick-link-icon {
    font-size: 2rem;
    margin-right: 1rem;
  }

  .quick-link-content h3 {
    font-size: 1.2rem;
  }
}

@media (max-width: 576px) {
  /* HERO SECTION - SMALL MOBILE */
  .hero {
    min-height: 650px;
    padding: 1.5rem 0;
  }

  .directors-container {
    gap: 0;
    padding: 0 0.5rem;
  }

  .hero-school-logo {
    width: 80px;
    height: 80px;
  }

  .school-main-info h1.school-name {
    font-size: 1.8rem;
    line-height: 1.1;
  }

  .school-main-info .school-affiliation {
    font-size: 0.9rem;
  }

  .director-profile img {
    max-height: 220px;
  }

  .vice-director-profile img {
    max-height: 180px;
  }

  .director-profile h4,
  .vice-director-profile h4 {
    font-size: 1.2rem;
  }

  .director-profile p,
  .vice-director-profile p {
    font-size: 0.95rem;
  }

  /* GENERAL MOBILE IMPROVEMENTS */
  h1 {
    font-size: 2rem;
  }
  h2 {
    font-size: 1.5rem;
  }

  .container {
    padding: 0 0.75rem;
  }

  .stats-grid {
    gap: 1rem;
    grid-template-columns: repeat(2, 1fr);
  }

  .stat-value {
    font-size: 2rem;
  }

  .stat-label {
    font-size: 0.9rem;
  }

  .news-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .newsletter-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .hero {
    min-height: 600px;
  }

  .school-main-info h1.school-name {
    font-size: 1.6rem;
  }

  .school-main-info .school-affiliation {
    font-size: 0.85rem;
  }

  .director-profile img {
    max-height: 200px;
  }

  .vice-director-profile img {
    max-height: 160px;
  }
}

/* ===== Animation Effects ===== */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}
.shimmer-effect {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

/* ===== Custom Scrollbar ===== */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to bottom, var(--primary-dark), var(--secondary-color));
}

/* ===== Loading Spinner ===== */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 1rem;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Error Message ===== */
.error-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: #ef4444;
}
.error-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
}
.retry-btn {
  margin-top: 1rem;
}

/* ===== No Results Message ===== */
.no-results {
  padding: 2rem;
  text-align: center;
  color: var(--text-light);
  font-style: italic;
}

/* ===== Animate Class ===== */
.animate {
  animation: fadeInUp 0.5s ease forwards;
}


/* ===== Staff Section ===== */
.staff-section {
  padding: 3rem 0;
}

.tabs {
  margin-bottom: 2rem;
}

.tab-header {
  display: flex;
  border-radius: 0.75rem;
  overflow: hidden;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  margin-bottom: 2rem;
}

.tab-btn {
  font-family: "Sarabun", sans-serif;
  font-size: 16px;
  flex: 1;
  padding: 1rem;
  background: #ffda6a;
  border: none;
  cursor: pointer;
  font-weight: 600;
  color: var(--text-color);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.tab-btn::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.tab-btn.active {
  color: var(--primary-color);
  background: var(--black-gradient);
}

.tab-btn.active::before {
  transform: scaleX(1);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeInUp 0.5s ease forwards;
}

.filter-container {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.filter-container label {
  font-weight: 600;
}

.filter-select {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-color);
  font-family: "Sarabun", sans-serif;
  min-width: 200px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.staff-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 2rem;
}

.staff-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
  animation: fadeInUp 0.5s ease forwards;
  opacity: 0;
}

.staff-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
  border-color: var(--primary-color);
}

.staff-image {
  height: 280px;
  position: relative;
  overflow: hidden;
}

.staff-image::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, transparent 50%, rgba(0, 0, 0, 0.7));
  z-index: 1;
}

.staff-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.staff-card:hover .staff-image img {
  transform: scale(1.1);
}

.staff-info {
  padding: 1.5rem;
}

.staff-name {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.staff-position {
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

.staff-rank {
  color: var(--text-light);
  margin-bottom: 1rem;
  font-style: italic;
}

.staff-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.staff-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.8rem;
  font-weight: 500;
}

.subject-tag {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary-color);
}

.department-tag {
  background: rgba(139, 92, 246, 0.1);
  color: var(--secondary-color);
}

/* Styling for the new contact section */
.staff-contact-container {
  border-top: 1px solid #eee; /* เส้นคั่นบางๆ */
  padding-top: 10px;
  margin-top: 10px;
  font-size: 0.9em; /* ขนาดตัวอักษรเล็กลงเล็กน้อย */
}

.staff-contact {
  margin: 5px 0;
  color: #555; /* สีตัวอักษร */
  word-break: break-all; /* ป้องกันอีเมลยาวๆ ทำให้การ์ดล้น */
}

.staff-contact strong {
  color: #333;
  margin-right: 5px;
}

.staff-role-label {
  display: inline-block;
  font-weight: 500;
  color: #856404; /* สีน้ำตาลเข้ม */
}

/* ===== ITA Section Styles ===== */
.ita-section {
  padding: 3rem 0;
}

.ita-layout-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 2.5rem;
  align-items: start;
}

.ita-sidebar {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  position: sticky;
  top: 5.5rem; /* header height + some margin */
}

.ita-sidebar h3 {
  color: var(--primary-color);
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--border-color);
  font-size: 1.5rem;
}

.ita-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.ita-menu li a {
  display: block;
  padding: 0.75rem 1rem;
  color: var(--text-color);
  font-weight: 500;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.ita-menu li a:hover {
  background: rgba(255, 193, 7, 0.1);
  color: var(--primary-dark);
  transform: translateX(5px);
}

.ita-menu li a.active {
  background: var(--yellow-gradient);
  color: var(--secondary-color);
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.ita-main-content .glass-card {
  padding: 2rem;
}

.ita-main-content h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

/* Responsive PDF/Image Embed */
.embed-responsive {
  position: relative;
  overflow: hidden;
  width: 100%;
  padding-top: 141.42%; /* Aspect Ratio for A4 Paper (sqrt(2)) */
  border-radius: 0.5rem;
  border: 1px solid var(--border-color);
  margin-top: 1.5rem;
}

.embed-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Responsive adjustments for ITA layout */
@media (max-width: 992px) {
  .ita-layout-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .ita-sidebar {
    position: static;
    margin-bottom: 2rem;
  }
}

/* ===== Students Section ===== */
.students-section {
  padding: 3rem 0;
}

.stats-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

@media (max-width: 600px) {
  .stats-summary {
    grid-template-columns: repeat(4, 1fr); /* บังคับให้มี 2 คอลัมน์บนมือถือ */
  }
  .stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}
.stat-label {
  font-size: 1.1rem;
  opacity: 0.9;
}
}

.card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: var(--glass-shadow);
  border: 1px solid var(--glass-border);
  margin-bottom: 2.5rem;
  transition: all 0.3s ease;
}

.card:hover {
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  border-color: var(--primary-color);
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-header h2 {
  margin-bottom: 0;
}

.card-content {
  padding: 1.5rem;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  font-weight: 600;
  background: rgba(0, 0, 0, 0.03);
}

.data-table tbody tr {
  transition: background-color 0.3s ease;
}

.data-table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.data-table tfoot tr {
  font-weight: 700;
  background: rgba(0, 0, 0, 0.03);
}

/* ===== Accordion Menu for ITA Sidebar ===== */
.ita-submenu-header {
  cursor: pointer;
  position: relative;
  transition: background-color 0.3s ease;
  padding: 0.8rem 1rem;
  font-weight: 600;
  border-radius: 6px;
}

.ita-submenu-header:hover {
  background: rgba(255, 193, 7, 0.1);
}

/* Add an arrow indicator */
.ita-submenu-header::after {
  content: '▼';
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  font-size: 0.8rem;
  color: var(--text-light);
  transition: transform 0.3s ease;
}

/* Rotate arrow when active */
.ita-submenu-header.active::after {
  transform: translateY(-50%) rotate(180deg);
}

/* Style for the active header */
.ita-submenu-header.active {
    background: var(--yellow-gradient);
    color: var(--secondary-color);
}
.ita-submenu-header.active::after {
    color: var(--secondary-color);
}


/* Submenu items container */
.ita-submenu-items {
  list-style: none;
  padding-left: 0;
  margin: 0;
  max-height: 0; /* Hidden by default */
  overflow: hidden;
  transition: max-height 0.4s ease-in-out;
}

/* When the submenu is active/open */
.ita-submenu-items.active {
  max-height: 500px; /* Adjust if you have many items */
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.ita-submenu-items li a {
  padding-left: 2rem; /* Indent sub-items */
}

/* Remove margin from the main ul */
.accordion-menu > li {
    margin-bottom: 0.5rem;
}

.page-title-section {
    background-color: #f8f8f8; /* หรือสีที่คุณต้องการ */
    padding: 60px 0;
    text-align: center;
    border-bottom: 1px solid #eee;
    margin-bottom: 40px;
}

.page-title-section h1 {
    font-size: 2.8em;
    color: #333;
    margin: 0;
}

/* ปรับให้ส่วนแสดงจดหมายข่าวทั้งหมดดูเหมาะสม */
.newsletter-all-section {
    padding: 40px 0;
}

.load-more-container {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 60px;
}

.load-more-container .btn {
    padding: 12px 30px;
    font-size: 1.1em;
    border-radius: 5px;
}