/* Custom Styles & Color Theme for Pimpar Tour */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');

:root {
  --primary-emerald-dark: #064e3b;
  --primary-emerald: #047857;
  --primary-emerald-light: #10b981;
  --accent-gold: #facc15;
  --accent-amber: #f59e0b;
  --accent-lime: #a3e635;
  --bg-soft-emerald: #f0fdf4;
}

/* ทั้งเว็บใช้ฟอนต์ Kanit ตัวเดียว ทั้งภาษาไทยและอังกฤษ
   รวม code/pre ที่ปกติเบราว์เซอร์จะใช้ฟอนต์ monospace ของระบบ */
body, button, input, select, textarea, h1, h2, h3, h4, h5, h6,
code, pre, kbd, samp, .font-sans, .font-mono {
  font-family: 'Kanit', sans-serif !important;
}

html {
  /* กันหน้าเลื่อนแนวนอน โดยไม่ทำให้ position: sticky พัง */
  overflow-x: clip;
  /* เผื่อที่ให้ sticky header ตอนกระโดดตาม #anchor */
  scroll-padding-top: 6rem;
  scroll-behavior: smooth;
}

body {
  font-family: 'Kanit', sans-serif !important;
  color: #1e293b;
  background-color: #f8fafc;
  overflow-x: clip;
}

body.modal-open, body.menu-open {
  overflow: hidden !important;
  touch-action: none;
}

/* Custom Emerald Gradient Header & Elements */
.bg-emerald-gradient {
  background: linear-gradient(135deg, #064e3b 0%, #047857 50%, #0f766e 100%);
}

.bg-hero-pattern {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.88) 0%, rgba(4, 120, 87, 0.8) 100%), 
              url('/images/hero-bg-beach.webp');
  background-size: cover;
  background-position: center;
}

.text-gold-accent {
  color: #facc15;
}

/* Gold Button Glow & Hover Animation */
.btn-gold {
  background: linear-gradient(135deg, #facc15 0%, #f59e0b 100%);
  color: #064e3b;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.35);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-gold:hover {
  background: linear-gradient(135deg, #fef08a 0%, #facc15 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(245, 158, 11, 0.5);
}

.btn-emerald {
  background: linear-gradient(135deg, #047857 0%, #064e3b 100%);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(4, 120, 87, 0.3);
  transition: all 0.3s ease;
}

.btn-emerald:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(4, 120, 87, 0.45);
}

/* Card Hover Lift Effect */
.tour-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tour-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 30px -10px rgba(4, 120, 87, 0.15);
}

/* Badge Styles */
.badge-gold {
  background-color: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
}

.badge-emerald {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

/* Glassmorphic Navbar */
.glass-nav {
  background: rgba(6, 78, 59, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Sticky Header — ค้างบนสุดตลอดเวลาเลื่อนหน้า (ต่ำกว่า modal ที่ z-50) */
header.glass-nav {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 40;
}

/* Rating Stars */
.star-rating {
  color: #f59e0b;
}

/* Modal Overlay Animation */
.modal-active {
  display: flex !important;
  animation: fadeIn 0.25s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

/* ==============================================================
 * ระบบสองภาษา (Bilingual TH / EN)
 * ใช้คู่กับ js/i18n.js — เนื้อหาทั้งสองภาษาอยู่ใน HTML ทั้งคู่
 * เพื่อให้ Google เก็บ index ได้ครบและไม่มีอาการกระพริบตอนโหลด
 * ============================================================ */
html[lang="th"] [data-lang="en"],
html[lang="en"] [data-lang="th"] {
  display: none !important;
}

/* ปุ่มสลับภาษา */
.lang-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(16, 185, 129, 0.55);
  border-radius: 12px;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.lang-switch button {
  min-width: 52px;
  padding: 10px 14px;
  color: #a7f3d0;
  background: transparent;
  transition: background 0.2s ease, color 0.2s ease;
  cursor: pointer;
}

/* จอเล็กย่อลงนิดเพื่อไม่ให้เบียดปุ่มเมนู */
@media (max-width: 480px) {
  .lang-switch { font-size: 13px; }
  .lang-switch button { min-width: 44px; padding: 8px 10px; }
}

.lang-switch button:hover {
  color: #fcd34d;
}

html[lang="th"] .lang-switch button[data-set-lang="th"],
html[lang="en"] .lang-switch button[data-set-lang="en"] {
  background: #facc15;
  color: #064e3b;
}


/* จุดบอกตำแหน่งรูปในแกลเลอรีหน้าทัวร์ */
.gallery-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(6, 78, 59, 0.25);
  cursor: pointer;
  transition: width 0.25s ease, background 0.25s ease;
}

.gallery-dot:hover {
  background: rgba(255, 255, 255, 0.85);
}

.gallery-dot.is-active {
  width: 22px;
  background: #facc15;
  border-color: #facc15;
}

/* หัวข้อ hero — ใช้ขนาดเดียวกันทั้งภาษาไทยและอังกฤษ
   จะได้สูงเท่ากันตอนสลับภาษา และย่อตามความกว้างจอเองไม่ล้นกรอบ */
.hero-title {
  font-size: clamp(1.75rem, 4.6vw, 2.875rem);
  line-height: 1.18;
}

/* จอ sm ขึ้นไปบังคับหัวข้ออังกฤษให้อยู่บรรทัดเดียว
   จอเล็กกว่านั้นปล่อยให้ตัดบรรทัดเอง จะได้ไม่ต้องย่อตัวอักษรจนอ่านยาก */
@media (min-width: 640px) {
  html[lang="en"] .hero-en-title { white-space: nowrap; }
}

/* ==============================================================
 * RESPONSIVE — ปรับการแสดงผลให้ครบทุกขนาดหน้าจอ
 *
 * Breakpoint ที่ใช้ (อิงตามที่ Tailwind ใช้อยู่แล้ว จะได้ไม่ตีกัน)
 *   >= 1200px  เดสก์ท็อป            ใช้ดีไซน์เดิมทั้งหมด
 *   992-1199   โน้ตบุ๊ก / แท็บเล็ตแนวนอน
 *   768-991    แท็บเล็ตแนวตั้ง
 *   576-767    มือถือจอใหญ่
 *   320-575    มือถือจอเล็ก
 * ============================================================ */

/* ---------- รูปภาพและสื่อ ไม่ล้นกรอบ รักษาสัดส่วน ---------- */
img,
svg,
video,
iframe {
  max-width: 100%;
}

/* หมายเหตุ: height: auto ของรูป Tailwind preflight จัดการให้อยู่แล้ว
   ไม่เขียนซ้ำ เพราะจะไปทับคลาส h-* ที่ตั้งไว้เอง */

/* ---------- ข้อความยาวไม่ดันกรอบ ----------
   ใช้เฉพาะจุดที่อาจมีสตริงยาวไม่มีช่องว่าง เช่น URL อีเมล เบอร์โทร
   ไม่ใส่ที่ body ทั้งก้อน เพราะจะไปรบกวนการตัดคำภาษาไทย */
a,
code,
input,
textarea,
td,
th {
  overflow-wrap: break-word;
}

/* ---------- ตารางที่กว้างเกินจอ ให้เลื่อนในกล่องตัวเอง ---------- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll > table {
  min-width: 720px;
}

/* ==============================================================
 * แท็บเล็ตแนวนอนลงมา (<= 1199px)
 * ============================================================ */
@media (max-width: 1199px) {
  /* กันหัวข้อ hero ไม่ให้ชนขอบเมื่อคอลัมน์แคบลง */
  .hero-title {
    font-size: clamp(1.75rem, 4.4vw, 2.625rem);
  }
}

/* ==============================================================
 * แท็บเล็ตแนวตั้งลงมา (<= 991px)
 * ============================================================ */
@media (max-width: 991px) {
  .glass-nav {
    /* เมนูมือถือกางออกมาแล้วต้องอ่านง่าย ไม่โปร่งจนกลืนพื้นหลัง */
    background: rgba(6, 78, 59, 0.97);
  }
}

/* ==============================================================
 * มือถือ (<= 767px)
 * ============================================================ */
@media (max-width: 767px) {
  /* ปุ่มหลักต้องสูงพอสำหรับนิ้ว */
  .btn-gold,
  .btn-emerald,
  .cat-filter-btn {
    min-height: 44px;
  }

  /* ช่องกรอกข้อมูล ตั้ง 16px กัน iOS ซูมหน้าจอเองตอนโฟกัส */
  input,
  select,
  textarea {
    font-size: 16px !important;
    min-height: 44px;
  }

  textarea {
    min-height: 96px;
  }

  /* ปุ่มสลับภาษา กดง่ายขึ้น */
  .lang-switch button {
    min-height: 40px;
  }

  /* หมายเหตุ: เมนูมือถือเป็นแบบเต็มจอแล้ว ดูกฎด้านล่างสุดของไฟล์ */
}

/* ==============================================================
 * มือถือจอเล็ก (<= 575px)
 * ============================================================ */
@media (max-width: 575px) {
  /* หัวข้อไม่ใหญ่จนตกบรรทัดแปลก ๆ */
  .hero-title {
    font-size: clamp(1.5rem, 7.4vw, 2rem);
    line-height: 1.25;
  }

  /* ย่อหน้าอ่านง่ายขึ้น */
  p {
    line-height: 1.7;
  }
}

/* ==============================================================
 * มือถือจอเล็กมาก (<= 375px)
 * ============================================================ */
@media (max-width: 375px) {
  /* ระยะขอบซ้ายขวาของคอนเทนเนอร์หลัก 12px */
  section.px-4,
  .max-w-7xl.px-4,
  .max-w-5xl.px-4,
  .max-w-4xl.px-4 {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .lang-switch {
    font-size: 12px;
  }

  .lang-switch button {
    min-width: 38px;
    padding: 8px;
  }
}

/* ---------- Breadcrumb: บนมือถือให้ลิงก์มีพื้นที่กดพอ ---------- */
@media (max-width: 767px) {
  .breadcrumb {
    margin-bottom: 0.25rem;
  }

  .breadcrumb a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
}

/* ==============================================================
 * เมนูมือถือแบบเต็มจอ
 * ใช้เฉพาะต่ำกว่า 768px — จอใหญ่กว่านั้นปล่อยให้ md:hidden ของ Tailwind ทำงานเหมือนเดิม
 * ============================================================ */
@media (max-width: 767px) {
  #mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    flex-direction: column;
    background: #022c22;
    padding: 1rem 1.25rem 2rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: menuIn 0.18s ease-out;
  }

  /* ต้องเขียนทับเอง เพราะ #id มีน้ำหนักมากกว่าคลาส .hidden ของ Tailwind */
  #mobile-menu.hidden {
    display: none;
  }

  body.menu-open {
    overflow: hidden;
  }

  /* backdrop-filter ของ header สร้าง containing block ให้ position: fixed
     ทำให้เมนูยึดกับแถบ header แทนที่จะเต็มจอ — ตอนเปิดเมนูจึงปิดไว้ชั่วคราว
     (ตอนนั้นเมนูบังทั้งจออยู่แล้ว มองไม่เห็นความต่าง) */
  body.menu-open .glass-nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

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

.mobile-menu-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(6, 95, 70, 0.6);
}

.mobile-menu-close {
  margin-left: auto;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  color: #d1fae5;
  transition: background 0.2s ease, color 0.2s ease;
}

.mobile-menu-close:hover {
  background: rgba(6, 78, 59, 0.8);
  color: #fcd34d;
}

.mobile-menu-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 0.5rem;
}

.mobile-menu-nav > a {
  font-size: 1.125rem;
  padding: 1rem 0.25rem;
  border-bottom: 1px solid rgba(6, 95, 70, 0.35);
}

/* ปุ่มโทรท้ายเมนู ดันไปอยู่ล่างสุดของจอ */
.mobile-menu-nav > div:last-child {
  margin-top: auto;
  padding-top: 1.5rem;
}
