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

body {
  font-family: "Prompt", sans-serif;
  background: #f4f6f9; /* เปลี่ยนพื้นหลังให้ออกเทานวลๆ สบายตา */
  color: #333333;
  line-height: 1.6;
}

header {
  display: flex;
  box-sizing: border-box;
  align-items: center;
  justify-content: space-between;
  padding: 15px 30px;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1e293b;
}

.logo a {
  display: inline-flex;
  align-items: center;
  gap: 8px; /* ปรับระยะห่างระหว่างรูปกับข้อความ */
  font-size: 1.8rem;
  font-weight: 700;
  color: #1e293b; 
  text-decoration: none;
}

.logo .logo-icon {
  width: 1.2em; 
  height: 1.2em;
  object-fit: contain; 
}

.logo .highlight {
  color: #2563eb; /* เปลี่ยนสีไฮไลต์เป็นสีน้ำเงินสดใส */
}

nav ul {
  list-style: none;
  display: flex;
  gap: 20px;
}

nav a {
  color: #475569;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

nav a:hover {
  color: #2563eb;
}

.menu-toggle {
  position: absolute;
  top: 15px;
  right: 20px;
  background: #2563eb;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  z-index: 100;
  display: none;
}

.menu-toggle:hover {
  background: #1d4ed8;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-bar input {
  padding: 6px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px 0 0 6px;
  outline: none;
  font-family: "Prompt", sans-serif;
  font-size: 0.95rem;
}

.search-bar input:focus {
  border-color: #2563eb;
}

.search-bar button {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 0 6px 6px 0;
  padding: 6px 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.search-bar button:hover {
  background: #1d4ed8;
}

.search-bar input,
.search-bar button {
  height: 38px;
  vertical-align: middle;
}

.breadcrumbs {
  max-width: 1100px;
  margin: 20px auto;
  padding: 0 20px;
  font-size: 0.9rem;
  color: #64748b;
}

.breadcrumbs a {
  color: #2563eb;
  text-decoration: none;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

.breadcrumbs span {
  color: #cbd5e1;
  margin: 0 6px;
}

.hero {
  text-align: center;
  background: linear-gradient(135deg, #1e293b, #0f172a); /* เปลี่ยน Hero Section เป็นโทนเข้ม หรูหรา สบายตา */
  color: #fff;
  padding: 70px 20px;
  margin-bottom: 30px;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 2.2rem;
  margin-bottom: 15px;
  font-weight: 600;
}

.hero p {
  font-size: 1.1rem;
  margin-bottom: 25px;
  color: #94a3b8;
}

.hero .button {
  display: inline-block;
  background: #2563eb;
  color: #fff;
  border: none;
  margin: 5px;
  padding: 10px 25px;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s;
}

.hero .button:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
}

main section {
  display: block;
  box-sizing: border-box;
  padding: 20px;
  max-width: 1100px;
  margin: auto;
}

main section h1, main section h2 {
  color: #1e293b;
  margin-bottom: 20px;
  font-size: 1.5rem;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.video-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1px solid #e2e8f0;
}

.video-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.1);
  border-color: #93c5fd;
}

.video-card a {
  display: block;
  color: #1e293b;
  text-decoration: none;
}

.video-card:hover a {
  color: #2563eb;
}

.thumbnail-wrapper {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9; /* จองพื้นที่อัตราส่วน 16:9 ป้องกันหน้าจอขยับ */
  background: #e2e8f0; /* สีพื้นหลังสำรองขณะรูปยังไม่โหลด */
  overflow: hidden;
}

.video-card img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* ทำให้รูปเต็มพื้นที่โดยไม่เสียสัดส่วน */
  display: block;
}

.view-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.video-card h2, .video-card h3 {
  margin: 12px 15px 6px;
  font-size: 1rem;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-card p {
  margin: 0 15px 15px;
  color: #64748b;
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 40px 0;
  flex-wrap: wrap;
}

.pagination a, .pagination span.dots {
  display: inline-block;
  color: #475569;
  border: 1px solid #cbd5e1;
  padding: 6px 14px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  background: #fff;
}

.pagination a:hover {
  background: #f1f5f9;
  color: #2563eb;
  border-color: #2563eb;
}

.pagination a.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  pointer-events: none;
}

.pagination span.dots {
  border: none;
  color: #94a3b8;
  background: transparent;
}

.pagination a.disabled {
  color: #cbd5e1;
  border-color: #e2e8f0;
  cursor: not-allowed;
  background: #f8fafc;
  pointer-events: none;
}

footer {
  display: block;
  box-sizing: border-box;
  background: #0f172a; /* ปรับ Footer ให้เข้ากับ Hero ด้วยโทนเข้มสะอาดตา */
  color: #94a3b8;
  text-align: center;
  padding: 40px 20px;
  margin-top: 60px;
}

footer .about {
  margin: 0 auto 15px;
}

footer .about a {
  color: #38bdf8;
  font-weight: 600;
  text-decoration: none;
}

footer .about a:hover {
  color: #fff;
  text-decoration: underline;
}

footer .links {
  display: flex;
  list-style-type: none;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin: 15px 0;
}

footer .main-links a {
  color: #e2e8f0;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

footer .main-links a:hover {
  color: #38bdf8;
}

footer .secondary-links a {
  color: #94a3b8;
  text-decoration: none;
  font-weight: 400;
  transition: color 0.2s;
}

footer .secondary-links a:hover {
  color: #e2e8f0;
}

.scrollToTopBtn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: #2563eb;
  color: #fff;
  border: none;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: none;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  transition: background-color 0.2s;
}

.scrollToTopBtn:hover {
  background-color: #1d4ed8;
}

@keyframes fadeDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  header {
    flex-wrap: wrap;
  }
  .menu-toggle {
    display: block;
  }
  nav {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    background: #fff;
    padding: 20px 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    z-index: 99;
  }
  nav.active {
    display: block;
    animation: fadeDown 0.3s ease;
  }
  nav ul {
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 0;
    margin: 0;
  }
  .search-bar {
    width: 80%;
    margin: 10px auto;
    justify-content: center;
  }
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .hero button {
    width: 100%;
  }
  .video-grid {
    grid-template-columns: repeat(1, 1fr);
  }
}