/*
Theme Name: Fun73 Theme
Theme URI: https://example.com
Author: Custom
Description: Fun73 越南旅遊娛樂目錄主題，全寬版面，RWD
Version: 1.1
Tags: responsive, travel, directory
Text Domain: fun73theme
*/

/* ─────────────────────────────────────────
   RESET & BASE
───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #111118;
  --bg-card:   #1c1c28;
  --bg-header: #0d0d18;
  --accent:    #e8433f;
  --accent2:   #f5a623;
  --gold:      #f0c040;
  --text:      #f0f0f0;
  --muted:     #8a90a2;
  --border:    rgba(255,255,255,0.07);
  --radius:    14px;
  --tab-h:     64px;
  --hdr-h:     64px;
}

html, body {
  font-family: 'Noto Sans TC','PingFang TC','Microsoft JhengHei',sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  /* 關鍵：確保 body 本身就是全寬，不被 WP 預設樣式壓縮 */
  width: 100%;
  overflow-x: hidden;
}
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ─────────────────────────────────────────
   全站 wrapper
───────────────────────────────────────── */
.site-wrapper {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 內容收窄容器（電腦版置中，不要撐太寬）*/
.inner {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 48px;
}
@media (max-width: 768px) { .inner { padding: 0 14px; } }

/* 內容區塊的左右 padding（電腦版較大，手機版較小）*/
.pad { padding-left: 40px; padding-right: 40px; }
@media (max-width: 768px) { .pad { padding-left: 16px; padding-right: 16px; } }

/* ─────────────────────────────────────────
   HEADER
───────────────────────────────────────── */
.site-header {
  width: 100%;
  height: var(--hdr-h);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center;
}
.header-inner {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 0 48px;
}
.site-logo {
  font-size: 28px; font-weight: 900;
  color: var(--accent); letter-spacing: -1px;
  flex-shrink: 0;
}
.site-logo span { color: var(--gold); }

/* City Selector */
.city-wrap { position: relative; flex-shrink: 0; }
.city-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: 24px; cursor: pointer;
  font-size: 15px; color: var(--text);
  transition: background .2s;
}
.city-btn:hover { background: rgba(255,255,255,0.11); }
.city-arrow {
  width: 0; height: 0;
  border: 5px solid transparent;
  border-top-color: var(--muted);
  margin-top: 4px;
  transition: transform .2s;
}
.city-wrap.open .city-arrow { transform: rotate(180deg); margin-top: -2px; }
.city-drop {
  display: none;
  position: absolute; top: calc(100% + 10px); left: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 150px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
  z-index: 300;
}
.city-wrap.open .city-drop { display: block; }
.city-drop a {
  display: block; padding: 12px 20px;
  font-size: 15px; color: var(--muted);
  transition: all .15s;
}
.city-drop a:hover, .city-drop a.on {
  background: rgba(232,67,63,.1); color: var(--accent);
}

/* Nav */
.header-nav { flex: 1; display: flex; gap: 4px; }
.header-nav a {
  padding: 8px 16px; border-radius: 24px;
  font-size: 15px; color: var(--muted);
  transition: all .2s;
}
.header-nav a:hover, .header-nav a.current {
  background: rgba(232,67,63,.12); color: var(--accent);
}

/* Header right */
.header-right { flex-shrink: 0; display: flex; align-items: center; gap: 10px; }
.btn-search-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.06); border-radius: 50%;
  cursor: pointer; border: 1px solid var(--border);
  transition: background .2s;
}
.btn-search-icon:hover { background: rgba(255,255,255,0.12); }
.btn-search-icon svg { width: 18px; height: 18px; stroke: var(--muted); }
.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 24px; height: 2px; background: var(--muted); border-radius: 2px; }

/* Mobile nav drawer */
.mobile-nav {
  display: none; position: fixed;
  top: var(--hdr-h); left: 0; right: 0;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  z-index: 150; padding: 8px 0;
}
.mobile-nav.open { display: block; }
.mobile-nav a {
  display: block; padding: 14px 24px;
  font-size: 16px; color: var(--muted);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 768px) {
  .header-inner { padding: 0 16px; }
  .header-nav { display: none; }
  .hamburger { display: flex; }
  .site-logo { font-size: 24px; }
}

/* ─────────────────────────────────────────
   BANNER SWIPER
───────────────────────────────────────── */
.banner-section { width: 100%; padding: 20px 0 0; }
.banner-section .inner { /* 讓 banner 跟其他區塊對齊 */ }
.swiper { border-radius: 18px; overflow: hidden; position: relative; }
.swiper-wrapper { display: flex; }
.swiper-slide { flex-shrink: 0; width: 100%; }
.swiper-slide a { display: block; }
.swiper-slide img {
  width: 100%; aspect-ratio: 16/5;   /* 電腦版比例：不要太高 */
  object-fit: cover; display: block;
}
@media (max-width: 768px) {
  .banner-section { padding: 12px 0 0; }
  .swiper-slide img { aspect-ratio: 16/7; }  /* 手機版稍高一些 */
}
.swiper-pagination {
  position: absolute; bottom: 14px; left: 50%;
  transform: translateX(-50%);
  display: flex; gap: 7px; z-index: 10;
}
.swiper-pagination-bullet {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,.35); cursor: pointer;
  transition: all .25s;
}
.swiper-pagination-bullet-active {
  background: var(--accent); width: 28px; border-radius: 4px;
}

/* ─────────────────────────────────────────
   CATEGORIES
───────────────────────────────────────── */
.cats-section { padding: 28px 0; }

/* 電腦版：9欄固定，圖示大 */
.cats-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 14px;
}
.cat-item {
  display: flex; flex-direction: column;
  align-items: center; gap: 12px;
  padding: 28px 12px 22px;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer; transition: all .22s;
  color: var(--text); text-decoration: none;
  min-width: 0; /* 防止 grid 子項目溢出 */
}
.cat-item:hover {
  border-color: var(--accent);
  background: rgba(232,67,63,.09);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(232,67,63,.18);
}
.cat-icon {
  width: 72px; height: 72px;
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; line-height: 1; flex-shrink: 0;
}
.ic0 { background: linear-gradient(135deg,#667eea,#764ba2); }
.ic1 { background: linear-gradient(135deg,#f093fb,#f5576c); }
.ic2 { background: linear-gradient(135deg,#4facfe,#00f2fe); }
.ic3 { background: linear-gradient(135deg,#43e97b,#38f9d7); }
.ic4 { background: linear-gradient(135deg,#fa709a,#fee140); }
.ic5 { background: linear-gradient(135deg,#a18cd1,#fbc2eb); }
.ic6 { background: linear-gradient(135deg,#fd7043,#ffb74d); }
.ic7 { background: linear-gradient(135deg,#ff9a9e,#fad0c4); }
.ic8 { background: linear-gradient(135deg,#56ccf2,#2f80ed); }
.cat-name { text-align: center; }
.cat-name b { display: block; font-size: 16px; color: var(--text); font-weight: 700; }
.cat-name em { font-style: normal; font-size: 13px; color: var(--muted); }

/* 平板：5欄 */
@media (max-width: 1100px) {
  .cats-grid { grid-template-columns: repeat(5, 1fr); gap: 12px; }
  .cat-icon { width: 64px; height: 64px; font-size: 28px; }
}

/* 手機：橫向捲動 Row */
@media (max-width: 768px) {
  .cats-section { padding: 16px 0; }

  /* 手機版 .inner 不加 padding，讓 cats-grid 自己控制 */
  .cats-section .inner { padding: 0; overflow: visible; }

  .cats-grid {
    display: flex;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    overflow-y: visible;
    /* 左右 14px padding 讓第一個/最後一個 item 不貼邊 */
    padding: 4px 14px 14px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cats-grid::-webkit-scrollbar { display: none; }

  .cat-item {
    flex-shrink: 0;
    width: 88px;
    padding: 14px 8px 12px;
    gap: 10px;
  }
  .cat-icon { width: 52px; height: 52px; font-size: 24px; border-radius: 14px; }
  .cat-name b { font-size: 13px; }
  .cat-name em { font-size: 11px; }
}

/* ─────────────────────────────────────────
   MAIN CONTENT
───────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 0 0 40px;
}
@media (max-width: 768px) {
  .main-content { padding: 0 0 calc(var(--tab-h) + 16px); }
}

.section-title {
  font-size: 22px; font-weight: 800;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 10px;
}
.section-title::before {
  content: ''; width: 5px; height: 22px;
  background: var(--accent); border-radius: 3px; display: block;
}

/* Post Cards Grid */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.post-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: all .25s;
}
.post-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
  border-color: rgba(232,67,63,.3);
}
.post-card-thumb {
  aspect-ratio: 16/9; overflow: hidden;
  background: var(--bg-header);
}
.post-card-thumb img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .35s;
}
.post-card:hover .post-card-thumb img { transform: scale(1.07); }
.post-card-body { padding: 18px; }
.post-card-tag {
  display: inline-block; padding: 3px 12px;
  background: rgba(232,67,63,.15); color: var(--accent);
  border-radius: 20px; font-size: 12px; margin-bottom: 10px;
}
.post-card-title {
  font-size: 17px; font-weight: 700; margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-meta { font-size: 13px; color: var(--muted); }

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

/* ─────────────────────────────────────────
   FOOTER
───────────────────────────────────────── */
.site-footer {
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  padding: 24px 48px;
  color: var(--muted); font-size: 14px; text-align: center;
}
@media (max-width: 768px) {
  .site-footer { display: none; } /* 手機底部 tab 取代 */
}

/* ─────────────────────────────────────────
   BOTTOM TAB BAR — 手機限定
───────────────────────────────────────── */
.tab-bar {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--tab-h);
  background: var(--bg-header);
  border-top: 1px solid var(--border);
  z-index: 200;
}
@media (max-width: 768px) { .tab-bar { display: flex; } }
.tab-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  font-size: 12px; color: var(--muted);
  cursor: pointer; transition: color .2s;
}
.tab-item svg { width: 24px; height: 24px; }
.tab-item.active, .tab-item:hover { color: var(--accent); }

/* ─────────────────────────────────────────
   SEARCH OVERLAY
───────────────────────────────────────── */
.search-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.75); z-index: 500;
  align-items: center; justify-content: center;
}
.search-overlay.active { display: flex; }
.search-box {
  background: var(--bg-card); border-radius: 18px;
  padding: 32px; width: 90%; max-width: 500px;
  border: 1px solid var(--border);
}
.search-box p { font-size: 16px; margin-bottom: 16px; }
.search-box input {
  width: 100%; padding: 13px 18px;
  background: rgba(255,255,255,.07); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font-size: 16px;
  outline: none; margin-bottom: 18px;
}
.search-box input:focus { border-color: var(--accent); }
.search-btns { display: flex; gap: 12px; justify-content: flex-end; }
.sbtn-cancel {
  padding: 10px 22px; border-radius: 10px; border: none;
  background: rgba(255,255,255,.08); color: var(--muted);
  font-size: 15px; cursor: pointer;
}
.sbtn-ok {
  padding: 10px 28px; border-radius: 10px; border: none;
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 700; cursor: pointer;
}

/* ─────────────────────────────────────────
   BACK TO TOP
───────────────────────────────────────── */
#btt {
  position: fixed; right: 24px; bottom: 28px;
  width: 44px; height: 44px;
  background: var(--accent); color: #fff; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; opacity: 0; pointer-events: none;
  transition: opacity .3s, transform .3s;
  z-index: 100; text-decoration: none;
}
#btt.show { opacity: 1; pointer-events: auto; }
#btt:hover { transform: translateY(-3px); }
@media (max-width: 768px) { #btt { bottom: calc(var(--tab-h) + 12px); right: 14px; } }
