@import url('https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #ec4899;
  --primary-dark: #be185d;
  --secondary: #1e3a8a;
  --text-main: #334155;
  --text-light: #64748b;
  --bg-body: #ffffff;
  --bg-light: #f8fafc;
  --border: #e2e8f0;
  --radius: 8px;
}

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

body {
  font-family: 'Prompt', sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
}

/* ===== NAVBAR ===== */
.navbar {
  background: white;
  border-bottom: 1px solid var(--border);
  height: 70px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.03);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: relative; /* สำคัญสำหรับ Mobile Menu */
}

.logo span {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--secondary);
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.95rem;
  transition: 0.2s;
  padding-bottom: 4px;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.hamburger { display: none; cursor: pointer; font-size: 1.5rem; color: var(--text-main); }

/* ===== HERO HEADER ===== */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #ec4899 100%);
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.hero-content {
  z-index: 2;
  padding: 0 1rem;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.hero p {
  font-size: 1.1rem;
  opacity: 0.9;
  font-weight: 300;
}

/* ===== FILTERS BAR ===== */
.container, .main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.filters-bar, .filters {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-end;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
  margin-bottom: 3rem;
  margin-top: -4rem; /* ดึงขึ้นไปทับ Hero นิดหน่อย */
  position: relative;
  z-index: 10;
}

.filter-group {
  flex: 1;
  min-width: 200px;
}

.filter-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.select-wrapper select {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'Prompt', sans-serif;
  color: var(--text-main);
  background: #fff;
  cursor: pointer;
  outline: none;
  transition: 0.2s;
}

.select-wrapper select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.1);
}

#resetFilter {
  padding: 10px 20px;
  background: var(--bg-light);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: 0.2s;
  height: 42px;
}

#resetFilter:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

/* ===== CONTENT & GRID ===== */
.section-header {
  margin-bottom: 2rem;
  position: relative;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-main);
  display: inline-block;
  background: white;
  padding-right: 1rem;
  position: relative;
  z-index: 1;
}

.section-header .divider {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--border);
  z-index: 0;
}

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

/* ===== CARD STYLES ===== */
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(0,0,0,0.08);
  border-color: var(--primary);
}

.card-cover {
  height: 470px;
  width: 100%;
  background: #f1f5f9;
  overflow: hidden;
  position: relative;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cover-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: 0.5s;
}

.card:hover .cover-img { 
  transform: scale(1.05); 
}

/* 🔥 สำหรับ iframe preview */
.pdf-preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
  pointer-events: none; /* ป้องกันการคลิกใน iframe */
}

.card:hover .pdf-preview-iframe {
  transform: scale(1.05);
  transition: 0.5s;
}

/* 🔥 Placeholder สำหรับกรณีที่ไม่มีรูป */
.placeholder-cover {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  font-size: 3rem;
  color: #94a3b8;
  flex-direction: column;
  gap: 1rem;
}

.placeholder-cover::after {
  content: 'ไม่มีตัวอย่าง';
  font-size: 0.9rem;
  font-family: 'Prompt', sans-serif;
  color: #64748b;
}

.card-body {
  padding: 1.25rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.card-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.card-body p {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 0.25rem;
}

.university-tag {
  margin-top: auto;
  padding-top: 1rem;
  color: var(--secondary);
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
/* ===== PAGINATION (BIG & PREMIUM) ===== */
#pagination {
  display: flex;
  justify-content: center;
  margin: 4rem 0 2rem;
}

.pagination-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 26px;
  background: linear-gradient(135deg, #ffffff, #f8fafc);
  border-radius: 999px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 40px rgba(0,0,0,0.08);
}

.page-btn {
  min-width: 42px;        /* เดิม 64px */
  height: 42px;           /* เดิม 64px */
  padding: 0 18px;        /* เดิม 0 24px */
  font-size: 17px;        /* เดิม 20px */
  font-weight: 500;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: linear-gradient(145deg, #f8fafc, #ffffff);
  color: var(--text-main);
  transition: 0.25s;
}
.page-btn:hover:not(:disabled) {
  background: linear-gradient(145deg, var(--primary), #f472b6);
  color: #fff;
  transform: translateY(-3px) scale(1.08);
}

.page-btn.active {
  background: linear-gradient(145deg, var(--primary), var(--primary-dark));
  color: #fff;
  transform: scale(1.12);
}

.page-btn.nav {
  font-size: 24px;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-dots {
  font-size: 26px;
  color: var(--text-light);
}
/* ===== NEW PAGES STYLES (Rules & Team) ===== */
.page-container {
  max-width: 900px;
  margin: 40px auto;
  padding: 40px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
  border: 1px solid var(--border);
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid #f1f5f9;
}

.content-block {
  margin-bottom: 35px;
}

.content-block h2 {
  font-size: 1.3rem;
  color: var(--primary);
  margin-bottom: 15px;
  font-weight: 600;
}

.content-block p, .content-block ul {
  color: var(--text-main);
  margin-bottom: 10px;
  font-size: 1rem;
}

.content-block ul {
  padding-left: 20px;
}

.content-block li {
  margin-bottom: 8px;
}

/* Team Grid Style */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.team-card {
  background: #f8fafc;
  padding: 25px;
  border-radius: 10px;
  text-align: center;
  border: 1px solid var(--border);
  transition: transform 0.2s;
}

.team-card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.team-avatar {
  width: 80px;
  height: 80px;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 50%;
  margin: 0 auto 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
}

.team-name {
  font-weight: 600;
  color: var(--secondary);
  margin-bottom: 5px;
}

.team-role {
  font-size: 0.85rem;
  color: var(--text-light);
}

/* ===== FOOTER & PAGINATION ===== */
.pagination-info {
  text-align: center;
  margin-top: 3rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

.site-footer {
  background: #1e293b;
  color: #94a3b8;
  text-align: center;
  padding: 3rem 1rem;
  margin-top: 4rem;
  font-size: 0.9rem;
}

/* ===== RESPONSIVE ===== */
/* ===== RESPONSIVE (มือถือ) - แก้ไขใหม่ให้ชัวร์ขึ้น ===== */
@media (max-width: 768px) {
  /* โชว์ปุ่มแฮมเบอร์เกอร์ */
  .hamburger {
    display: block;
    z-index: 101; 
  }

  /* ตัวเมนู */
  .nav-links {
    position: absolute;
    top: 70px; /* ความสูง Navbar */
    left: 0;
    width: 100%;
    background: white;
    
    /* การจัดเรียง */
    flex-direction: column;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    
    /* 🛠️ แก้ไข: ใช้ display: none เพื่อซ่อนไปเลย (ชัวร์กว่า) */
    display: none; 
  }

  /* เมื่อ JS เติม class active ให้แสดงผล */
  .nav-links.active {
    display: flex; /* เปลี่ยนเป็น Flex เพื่อให้เรียงแนวตั้ง */
    animation: fadeIn 0.3s ease; /* ใส่ Effect ค่อยๆ ชัดขึ้น */
  }

  /* ปรับแต่งลิงก์ข้างใน */
  .nav-links li {
    width: 100%;
    text-align: center;
  }

  .nav-links a {
    display: block;
    padding: 15px;
    border-top: 1px solid #f1f5f9;
  }
  
  .nav-links a:hover {
    background-color: #f8fafc;
  }
}

/* เพิ่ม Animation เล็กน้อย */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
  
}
