/* ============================================================
   SHARED STYLES — ญี่ปุ่นฝัน
   Loaded by every page. Contains: variables, reset, topbar,
   header/nav, search modal, footer, utilities, responsive.
   ============================================================ */

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

:root {
  --red:       #1a5c3a;
  --red-dark:  #0f3d26;
  --red-light: #e8f5ee;
  --gold:      #4a9e6b;
  --dark:      #1a1a2e;
  --mid:       #4a4a6a;
  --light:     #f5f5f0;
  --white:     #ffffff;
  --shadow:    0 4px 24px rgba(0,0,0,0.08);
  --radius:    12px;
  --font-body: 'Sarabun', sans-serif;
  --font-jp:   'Noto Serif JP', serif;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--light); color: var(--dark); font-size: 16px; line-height: 1.75; }
a { text-decoration: none; color: inherit; }
img { display: block; width: 100%; height: 100%; object-fit: cover; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ── Thai-only mode ── */
.en-text { display: none !important; }

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar { background: var(--dark); color: rgba(255,255,255,0.7); font-size: 13px; padding: 6px 0; position: relative; z-index: 1001; }
.topbar .container { display: flex; justify-content: space-between; align-items: center; }
.topbar-social a { color: rgba(255,255,255,0.7); margin-left: 12px; font-size: 14px; transition: color .2s; }
.topbar-social a:hover { color: var(--gold); }

/* ============================================================
   HEADER & NAV
   ============================================================ */
header { background: var(--white); position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 12px rgba(0,0,0,0.07); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; }

.logo { display: flex; align-items: center; gap: 10px; }
.logo-icon {
  width: 42px; height: 42px; background: var(--red); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: white; font-family: var(--font-jp); font-size: 20px; font-weight: 700; flex-shrink: 0;
}
.logo-th { font-size: 20px; font-weight: 700; color: var(--dark); letter-spacing: -0.5px; }
.logo-jp { font-size: 11px; color: var(--red); font-family: var(--font-jp); letter-spacing: 1px; }
.logo-img { width: auto; height: 44px; object-fit: contain; display: block; }

nav ul { list-style: none; display: flex; gap: 4px; align-items: center; }
nav ul li a { padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 15px; color: var(--mid); transition: all .2s; }
nav ul li a:hover, nav ul li a.active { background: var(--red-light); color: var(--red); }
.nav-search-btn { background: var(--red); color: white !important; border-radius: 8px; padding: 8px 16px !important; }
.nav-search-btn:hover { background: var(--red-dark) !important; color: white !important; }

/* ── Dropdown nav ── */
nav ul li.has-dropdown { position: relative; }
nav ul li.has-dropdown > a .dropdown-arrow {
  font-size: 10px; margin-left: 4px; vertical-align: middle;
  display: inline-block; transition: transform .25s;
}
nav ul li.has-dropdown:hover > a .dropdown-arrow,
nav ul li.has-dropdown.open  > a .dropdown-arrow { transform: rotate(180deg); }

.nav-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0;
  background: white; border-radius: 14px;
  box-shadow: 0 8px 36px rgba(0,0,0,0.13), 0 2px 6px rgba(0,0,0,0.06);
  padding: 10px; min-width: 290px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px;
  border-top: 3px solid var(--red);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity .2s, transform .2s, visibility .2s;
  z-index: 200;
}
nav ul li.has-dropdown:hover .nav-dropdown {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.nav-dropdown a {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--mid);
  transition: background .15s, color .15s; white-space: nowrap;
}
.nav-dropdown a:hover { background: var(--red-light); color: var(--red); }
.nav-dropdown a i { width: 17px; text-align: center; font-size: 13px; flex-shrink: 0; }

/* ── Destinations dropdown (list-based, with section labels) ── */
.has-dropdown { position: relative; }
.dropdown {
  display: none;
  position: absolute; top: 100%; left: 0;
  min-width: 220px; list-style: none;
  background: white; border: 0.5px solid #e5e5e5;
  border-radius: 10px; padding: 10px 0 8px;
  z-index: 999; box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
/* ギャップなしで top:100% に配置 → ホバー中断なし */
.has-dropdown:hover .dropdown { display: block; }
.dropdown li { list-style: none; }
.dropdown li a {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; font-size: 14px; color: #1a1a1a;
  text-decoration: none; transition: background .15s;
}
.dropdown li a:hover { background: #f5f5f5; }
.dropdown li a i { width: 16px; text-align: center; flex-shrink: 0; }
.dropdown-section-label {
  font-size: 11px; font-weight: 600; color: #999;
  letter-spacing: 0.8px; text-transform: uppercase;
  padding: 6px 16px 4px; display: block;
}
.dropdown-divider { height: 0.5px; background: #e5e5e5; margin: 6px 0; }
.dropdown-count {
  margin-left: auto; background: #E1F5EE; color: #085041;
  font-size: 11px; font-weight: 600; padding: 1px 7px;
  border-radius: 999px;
}
.dropdown-soon { color: #aaa !important; font-size: 13px !important; }
.dropdown-soon:hover { background: #fafafa !important; color: #888 !important; }

.hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; padding: 4px; }
.hamburger span { display: block; width: 24px; height: 2px; background: var(--dark); border-radius: 2px; transition: all .3s; }

/* ============================================================
   SEARCH MODAL
   ============================================================ */
.search-modal {
  display: none; position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  align-items: flex-start; justify-content: center; padding-top: 80px;
}
.search-modal.open { display: flex; }
.search-box { background: white; border-radius: 16px; padding: 28px; width: 100%; max-width: 600px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.search-input-wrap { display: flex; align-items: center; gap: 12px; border-bottom: 2px solid var(--red); padding-bottom: 12px; margin-bottom: 20px; }
.search-input-wrap i { color: var(--red); font-size: 20px; }
.search-input-wrap input { flex: 1; border: none; outline: none; font-family: var(--font-body); font-size: 20px; color: var(--dark); }
.search-input-wrap input::placeholder { color: #ccc; }
.search-close { cursor: pointer; color: #aaa; font-size: 22px; transition: color .2s; }
.search-close:hover { color: var(--red); }
.search-suggestions h4 { font-size: 13px; color: #aaa; font-weight: 600; margin-bottom: 12px; }
.suggestion-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestion-tag { padding: 6px 14px; background: var(--light); border-radius: 20px; font-size: 13px; color: var(--mid); cursor: pointer; transition: all .2s; border: 1px solid #e0e0e0; }
.suggestion-tag:hover { background: var(--red-light); color: var(--red); border-color: var(--red); }

/* ── Search results ── */
.search-results-container { margin-top: 8px; }
.search-result-item { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 10px; transition: background .2s; color: var(--dark); }
.search-result-item:hover { background: var(--red-light); }
.search-result-item img { width: 64px; height: 64px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.search-result-info { flex: 1; min-width: 0; }
.search-result-title { font-weight: 600; font-size: 14px; line-height: 1.45; color: var(--dark); }
.search-result-region { font-size: 12px; color: var(--mid); margin-top: 3px; }
.search-no-results { text-align: center; padding: 24px 0 8px; color: #aaa; font-size: 14px; }

/* ============================================================
   FOOTER
   ============================================================ */
footer { background: var(--dark); color: rgba(255,255,255,0.8); padding: 60px 0 30px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 48px; }
.footer-brand .logo-icon { background: var(--red); margin-bottom: 16px; }
.footer-brand p { font-size: 14px; line-height: 1.75; color: rgba(255,255,255,0.6); margin-bottom: 20px; }
.footer-social { display: flex; gap: 10px; }
.footer-social a {
  width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.08);
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.7); font-size: 15px; transition: all .2s;
}
.footer-social a:hover { background: var(--red); color: white; }
.footer-col h4 { color: white; font-weight: 700; font-size: 15px; margin-bottom: 16px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-col ul li a { font-size: 13px; color: rgba(255,255,255,0.6); transition: color .2s; display: flex; align-items: center; gap: 6px; }
.footer-col ul li a:hover { color: var(--gold); }
.footer-col ul li a i { font-size: 11px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 24px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: rgba(255,255,255,0.4); }

/* ============================================================
   UTILITY
   ============================================================ */
.section-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.section-label { font-size: 13px; font-weight: 700; color: var(--red); text-transform: uppercase; letter-spacing: 1.5px; }
.section-line { flex: 1; height: 1px; background: #e0e0e0; }
.section-title { font-size: clamp(22px, 2.5vw, 30px); font-weight: 700; color: var(--dark); margin-bottom: 8px; }
.section-subtitle { font-size: 15px; color: var(--mid); margin-bottom: 28px; }
.btn-outline { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--red); color: var(--red); padding: 10px 24px; border-radius: 30px; font-weight: 700; font-size: 14px; transition: all .2s; }
.btn-outline:hover { background: var(--red); color: white; }
.text-center { text-align: center; }
.mt-24 { margin-top: 24px; }
.hidden { display: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .topbar .container { flex-direction: column; gap: 4px; text-align: center; }
  nav ul { display: none; }
  nav ul.open {
    display: flex; flex-direction: column;
    position: absolute; top: 100%; left: 0; right: 0;
    background: white; padding: 16px 24px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  }
  .hamburger { display: flex; }
  .footer-grid { grid-template-columns: 1fr; }

  /* Mobile: list-style dropdown */
  .dropdown {
    position: static; box-shadow: none; border-radius: 8px;
    border: none; border-left: 3px solid var(--red);
    background: var(--light); margin: 4px 0 8px 12px; padding: 4px 0;
    display: none;
  }
  nav ul li.has-dropdown.open .dropdown { display: block; }
  .dropdown li a { font-size: 13px; padding: 7px 12px; }

  /* Mobile dropdown — show inline on tap */
  .nav-dropdown {
    position: static; transform: none; opacity: 1; visibility: visible;
    box-shadow: none; border-radius: 8px; border-top: none;
    border-left: 3px solid var(--red);
    background: var(--light); margin: 4px 0 8px 12px; padding: 6px;
    grid-template-columns: 1fr 1fr; display: none;
  }
  nav ul li.has-dropdown.open .nav-dropdown { display: grid; }
  .nav-dropdown a { font-size: 13px; padding: 8px 10px; }
}

@media (max-width: 480px) {
  .footer-bottom { flex-direction: column; gap: 8px; text-align: center; }
}

/* ============================================================
   SIDEBAR WIDGETS — จุดหมายปลายทาง (案C) & เกี่ยวกับบล็อกนี้ (案D)
   ============================================================ */

/* ── 案C: จุดหมายปลายทาง (region nav) ── */
.region-nav-list { list-style: none; padding: 0; margin: 0; }
.region-nav-item { border-bottom: 1px solid #f0f0f0; }
.region-nav-item:last-child { border-bottom: none; }
.region-nav-link {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 4px; text-decoration: none;
  color: #555; font-size: 14px; transition: color .15s;
}
.region-nav-link:hover { color: var(--red); }
.region-nav-link > i { font-size: 10px; color: #ccc; flex-shrink: 0; }
.region-nav-item.has-articles .region-nav-link { color: var(--dark); font-weight: 600; }
.region-nav-item.has-articles .region-nav-link > i { color: var(--red); }
.region-nav-item.has-articles .region-nav-link:hover { color: var(--red); }
.region-nav-name { flex: 1; }
.region-nav-tag {
  font-size: 11px; padding: 2px 8px;
  border-radius: 999px; white-space: nowrap; flex-shrink: 0;
}
.region-nav-tag.active { background: #e1f5ee; color: #085041; font-weight: 600; }
.region-nav-tag.soon { background: #f5f5f5; color: #bbb; }

/* ── 案D: เกี่ยวกับบล็อกนี้ (profile) ── */
.profile-widget .profile-body { padding: 4px 0; }
.profile-intro {
  font-size: 14px; font-weight: 700; color: var(--red);
  line-height: 1.6; margin-bottom: 10px;
}
.profile-desc {
  font-size: 13px; color: #666; line-height: 1.8; margin-bottom: 16px;
}
.profile-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--red);
  text-decoration: none; border: 1.5px solid var(--red);
  padding: 7px 16px; border-radius: 999px;
  transition: background .15s, color .15s;
}
.profile-link:hover { background: var(--red); color: white; }

/* ── SNS 準備中アイコン ── */
.sns-coming {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: default; opacity: 0.45; transition: opacity .2s;
}
.sns-coming:hover { opacity: 0.75; }
.sns-coming::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 8px); left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.78); color: white;
  font-size: 11px; white-space: nowrap;
  padding: 4px 10px; border-radius: 6px;
  pointer-events: none; opacity: 0; transition: opacity .15s;
  z-index: 9999;
}
.sns-coming:hover::after { opacity: 1; }
/* トップバー内は上が見切れるため、ツールチップを下向きに */
.topbar .sns-coming::after {
  bottom: auto;
  top: calc(100% + 8px);
}
/* 将来アカウント開設時: <span class="sns-coming"> を
   <a href="URL" target="_blank" rel="noopener" class="sns-ready"> に変更 */

/* ============================================================
   AUTHOR BOX — เขียนโดย (記事ページ共通)
   ============================================================ */
.author-box {
  background: var(--light); border-radius: var(--radius);
  padding: 24px; display: flex; gap: 18px; align-items: flex-start; margin-top: 32px;
}
.author-avatar { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; flex-shrink: 0; }
.author-avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-name { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.author-bio { font-size: 13px; color: var(--mid); line-height: 1.6; }
