/* 22/04/2025 15:50 - ไฟล์ธีมหลัก BabeGaze */
.media-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.media-wrapper.vertical {
  aspect-ratio: 9 / 16;
}
.media-wrapper img,
.media-wrapper iframe,
.media-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item.short img {
  aspect-ratio: 9 / 16;
  object-fit: cover;
  object-position: center;
  max-height: 270px;
  border-radius: 6px;
}

.gallery-item.short video {
  aspect-ratio: 9 / 16;
  object-fit: cover;
  max-height: 270px;
  width: 100%;
  border-radius: 6px;
}


/* 26/05/2025 ปรับให้กล่องรูป/วิดีโอเหมือนกันทั้ง add/edit */
#preview-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 1rem;
}

.gallery-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 420px; /* หรือ 440px หากมี 2 บรรทัด caption */
}

.gallery-card video,
.gallery-card img {
  border-radius: 4px;
  margin-bottom: 8px;
  width: 100%;
  object-fit: cover;
}

.gallery-card textarea {
  font-size: 0.875rem;
  resize: vertical;
}

.gallery-card select,
.gallery-card input[type="text"] {
  font-size: 0.85rem;
}

.gallery-card .form-check-label {
  font-size: 0.8rem;
}

.gallery-card .btn-danger {
  width: 100%;
  padding: 2px;
  font-size: 0.85rem;
}

.play-icon-topright {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 24px;
  color: red;
  opacity: 0.85;
  z-index: 5;
}

progress {
  height: 8px;
}

.navbar-custom {
  position: relative;
  overflow: hidden;
}

#star-zone {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.star-container {
  position: absolute;
  opacity: 0;
}

.star {
  width: 24px;
  height: 24px;
  opacity: 0.9;
  transform-origin: center;
}

/* ดาวตกจากซ้ายไปขวา */
@keyframes starFallRightInNavbar {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 1; }
  100% {
    transform: translate(100vw, 100%) rotate(90deg);
    opacity: 0;
  }
}

/* ดาวตกจากขวาไปซ้าย */
@keyframes starFallLeftInNavbar {
  0% {
    transform: translate(0, 0) scaleX(-1) rotate(0deg);
    opacity: 0;
  }
  10% { opacity: 1; }
  100% {
    transform: translate(-100vw, 100%) scaleX(-1) rotate(-90deg);
    opacity: 0;
  }
}





.bird-container {
  position: fixed;
  top: 20px;
  z-index: 3;
  pointer-events: none;
}

.bird {
  width: 36px;
  height: 36px;
  opacity: 0.9;
}

/* ------------------------------
   ทิศทางซ้าย → ขวา (บินเฉียงขึ้น)
------------------------------ */
.bird-left-to-right {
  left: -60px;
  animation: flyRight 12s linear infinite;
}

@keyframes flyRight {
  0% {
    transform: translateX(0) translateY(0) rotate(5deg);
    opacity: 0;
  }
  10% { opacity: 1; }
  50% {
    transform: translateX(100vw) translateY(-30px) rotate(10deg);
    opacity: 1;
  }
  90% { opacity: 1; }
  100% {
    transform: translateX(200vw) translateY(0px) rotate(0deg);
    opacity: 0;
  }
}

/* ------------------------------
   ทิศทางขวา → ซ้าย (บินเฉียงลง)
------------------------------ */
.bird-right-to-left {
  right: -60px;
  animation: flyLeft 12s linear infinite;
}

@keyframes flyLeft {
  0% {
    transform: translateX(0) translateY(0) scaleX(-1) rotate(-5deg);
    opacity: 0;
  }
  10% { opacity: 1; }
  50% {
    transform: translateX(-100vw) translateY(30px) scaleX(-1) rotate(-10deg);
    opacity: 1;
  }
  90% { opacity: 1; }
  100% {
    transform: translateX(-200vw) translateY(0px) scaleX(-1) rotate(0deg);
    opacity: 0;
  }
}


/* สไตล์สำหรับใส่ background ซ้อนด้านหลัง navbar */
.navbar-custom::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('/assets/bg/navbar-bg.png') center/cover no-repeat;
  opacity: 0.15; /* ความโปร่งใสของกราฟิก */
  z-index: 0;
  pointer-events: none;
}

.navbar-custom {
  position: relative;
  z-index: 1; /* ให้อยู่ด้านหน้า background */
  background-color: #15152a; /* สีหลักของ navbar */
}


body {
  background-color: #f8f9fa;
  font-family: 'Noto Sans Thai','Segoe UI', sans-serif;
  color: #212529;
}

.navbar-custom {
  background-color: #1a1a2e;
  padding: 1rem;
}

.navbar-custom .nav-link {
  color: #ffffff !important;
  margin-right: 1.2rem;
  font-weight: 500;
}

.navbar-custom .nav-link:hover {
  color: #ff6f61 !important;
}

.dropdown-menu {
  background-color: #1a1a2e;
  border: none;
}

.dropdown-item {
  color: #ffffff;
}

.dropdown-item:hover {
  background-color: #ff6f61;
  color: #fff;
}

.btn-theme {
  background-color: #ff6f61;
  color: white;
  font-weight: bold;
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
}

.btn-theme:hover {
  background-color: #ff3e3e;
}

/* เพิ่มเมื่อ 2025-04-23: ปรับระยะห่างของ <p> ให้แน่นขึ้น */
p {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

/* ================================
   แก้เมื่อ 2025-04-24 โดยคุณต่าย
   จัด layout news.php แบบ 15 / 40 / 20 / 15
   รองรับทุกหน้าจอ Desktop / Tablet / Mobile
================================ */

/* กริดหลักของหน้า news */
.news-grid {
  display: grid;
  grid-template-columns: 1.5fr 5fr 2fr 1.5fr;
  gap: 20px;
  align-items: start;
}

/* content ตรงกลาง */
.content-main {
  background-color: #ffffff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* ส่วน related post ด้านขวา */
.related {
  padding: 10px;
  background-color: #fafafa;
  border-radius: 6px;
  font-size: 0.95rem;
}

/* link ภายใน related */
.related a {
  color: #333;
  text-decoration: none;
}
.related a:hover {
  text-decoration: underline;
  color: #ff6f61;
}

/* sidebar ซ้าย / ขวา */
.left-sidebar,
.right-sidebar {
  background-color: #f1f1f1;
  padding: 10px;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* ปรับหน้าจอสำหรับมือถือ */
@media (max-width: 768px) {
  .news-grid {
    grid-template-columns: 1fr; /* Stack ทั้งหมดในแนวตั้ง */
  }

  .left-sidebar,
  .right-sidebar {
    display: none !important; /* ซ่อน banner ซ้ายขวา */
  }

  .related {
    margin-top: 30px;
  }
}

footer {
  background-color: #1a1a2e;
  color: #ffffff;
}

footer a {
  color: #ffffff;
  text-decoration: none;
}

footer a:hover {
  color: #ff6f61;
}

.fade-in {
  animation: fadeIn 0.8s ease forwards;
  opacity: 0;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* 16/05/2025 09:15 - เพิ่ม layout การ์ดแนวตั้ง + headline ซ้อนในภาพ */
.news-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.headline-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  padding: 12px;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 600;
  background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0) 90%);
  box-sizing: border-box;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  line-height: 1.5;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

.headline-overlay span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ป้องกันบนมือถือหลุด layout */
@media (max-width: 576px) {
  .headline-overlay {
    font-size: 0.85rem;
    padding: 8px;
  }
}


/* 16/05/2025 - Masonry layout แบบ Pinterest */
.masonry-grid {
  column-count: 1;
  column-gap: 16px;
}

@media (min-width: 576px) {
  .masonry-grid {
    column-count: 2;
  }
}
@media (min-width: 768px) {
  .masonry-grid {
    column-count: 3;
  }
}
@media (min-width: 992px) {
  .masonry-grid {
    column-count: 4;
  }
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 16px;
}

.masonry-card {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s ease;
}

.masonry-card img {
  width: 100%;
  height: auto;
  display: block;
}

.masonry-caption {
  padding: 10px 14px;
  font-size: 0.95rem;
  color: #333;
  font-weight: 500;
}


.masonry-container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 1rem;
}