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

:root {
  --washi:      #F6F1E9;
  --washi-dark: #EDE6D8;
  --washi-mid:  #E2D9C8;
  --sumi:       #111111;
  --sumi-mid:   #3D3830;
  --muted:      #7A7268;
  --border:     #D4CCB8;

  --beni:       #C0202E;
  --beni-light: #E0303F;
  --ai:         #1B3F6E;
  --ai-light:   #2A5FA0;
  --kin:        #B8830A;
  --kin-light:  #D4A520;
  --matcha:     #4A7C59;

  --lifestyle:  #6B3FA0;
  --dining:     #B8830A;
  --nightlife:  #C0202E;
  --access:     #1B6B4A;

  --font-sans:  'Inter', 'Noto Sans JP', system-ui, sans-serif;
  --font-serif: 'Noto Serif JP', 'Times New Roman', serif;
  --radius:     10px;
  --sidebar-w:  360px;
  --header-h:   64px;
}

html, body { height: 100%; font-family: var(--font-sans); font-size: 16px; background: var(--washi); color: var(--sumi); overflow: hidden; }

/* ===== Layout ===== */
#app { display: flex; flex-direction: column; height: 100vh; }
/* #main fills remaining space after header + hero */
#main { display: flex; flex: 1; overflow: hidden; position: relative; min-height: 0; }

/* ===== Header ===== */
#header {
  height: var(--header-h);
  background: #ffffff;
  border-bottom: 3px solid var(--beni);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; flex-shrink: 0; z-index: 100;
  position: relative; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}

#header::before { display: none; }

#header .logo { display: flex; flex-direction: column; position: relative; }
#header .logo-main {
  font-size: 19px; font-weight: 800; color: var(--sumi);
  font-family: var(--font-sans); letter-spacing: -0.01em;
}
#header .logo-sub {
  font-size: 12px; color: var(--muted); letter-spacing: 0.10em;
  text-transform: uppercase; margin-top: 2px; font-weight: 500;
}

#header .logo-main::before {
  content: '';
  display: inline-block; width: 10px; height: 10px;
  background: var(--beni); border-radius: 2px;
  margin-right: 8px; vertical-align: middle;
  transform: rotate(45deg);
}

#lang-switcher { display: flex; gap: 4px; position: relative; }
#lang-switcher button {
  padding: 6px 12px; border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent; color: var(--muted);
  font-size: 12px; cursor: pointer; transition: all .15s; font-weight: 600;
  letter-spacing: 0.02em;
}
#lang-switcher button.active,
#lang-switcher button:hover {
  background: var(--beni); color: #fff;
  border-color: var(--beni); font-weight: 700;
}

/* ===== Main ===== (defined above with #app) ===== */

/* ===== Sidebar ===== */
#sidebar {
  width: var(--sidebar-w);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0;
  position: relative;
}

/* 麻の葉パターン — sidebar background */
#sidebar::after {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(60deg,  rgba(0,0,0,.028) 0, rgba(0,0,0,.028) 1px, transparent 0, transparent 50%),
    repeating-linear-gradient(120deg, rgba(0,0,0,.028) 0, rgba(0,0,0,.028) 1px, transparent 0, transparent 50%),
    repeating-linear-gradient(0deg,   rgba(0,0,0,.028) 0, rgba(0,0,0,.028) 1px, transparent 0, transparent 50%);
  background-size: 18px 18px;
  pointer-events: none; z-index: 0;
}
#sidebar > * { position: relative; z-index: 1; }

/* ===== Tab Bar ===== */
#tab-bar {
  display: flex; border-bottom: 2px solid var(--border);
  flex-shrink: 0; background: var(--washi-dark);
}
#tab-bar button {
  flex: 1; padding: 14px 4px; background: transparent; border: none;
  color: var(--muted); font-size: 15px; cursor: pointer;
  transition: all .15s; border-bottom: 2px solid transparent;
  font-weight: 600; letter-spacing: 0.02em; margin-bottom: -2px;
}
#tab-bar button.active {
  color: var(--beni); border-bottom-color: var(--beni);
  background: var(--washi);
}
#tab-bar button:hover:not(.active) { color: var(--sumi-mid); }

#sidebar-content { flex: 1; overflow-y: auto; }

/* ===== Category Filter ===== */
#category-filter {
  padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 6px;
  border-bottom: 1px solid var(--border); background: var(--washi);
}
.cat-btn {
  padding: 7px 14px; border-radius: 3px; border: 1px solid;
  font-size: 13px; cursor: pointer; transition: all .15s;
  background: transparent; font-weight: 600; letter-spacing: 0.02em;
}
.cat-btn[data-cat="all"]       { border-color: var(--border); color: var(--muted); }
.cat-btn[data-cat="lifestyle"] { border-color: var(--lifestyle); color: var(--lifestyle); }
.cat-btn[data-cat="dining"]    { border-color: var(--dining); color: var(--dining); }
.cat-btn[data-cat="nightlife"] { border-color: var(--nightlife); color: var(--nightlife); }
.cat-btn[data-cat="access"]    { border-color: var(--access); color: var(--access); }

.cat-btn.active[data-cat="all"]       { background: var(--sumi-mid); color: #fff; border-color: var(--sumi-mid); }
.cat-btn.active[data-cat="lifestyle"] { background: var(--lifestyle); color: #fff; }
.cat-btn.active[data-cat="dining"]    { background: var(--dining); color: #fff; }
.cat-btn.active[data-cat="nightlife"] { background: var(--nightlife); color: #fff; }
.cat-btn.active[data-cat="access"]    { background: var(--access); color: #fff; }

/* ===== Spot List ===== */
#spot-list { padding: 10px; }

.spot-card {
  background: #FFFDF8;
  border-radius: var(--radius); padding: 12px 14px;
  margin-bottom: 8px; cursor: pointer;
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  transition: all .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.spot-card:hover { border-left-color: var(--kin); box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.spot-card.active { border-left-color: var(--beni); box-shadow: 0 2px 10px rgba(181,35,47,.15); }
.spot-card.hidden { display: none; }

.spot-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.spot-icon { font-size: 20px; flex-shrink: 0; }
.spot-name { font-size: 16px; font-weight: 700; line-height: 1.3; color: var(--sumi); font-family: var(--font-sans); }
.spot-cat-badge {
  font-size: 11px; padding: 3px 8px; border-radius: 2px; margin-left: auto; flex-shrink: 0;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.spot-desc { font-size: 14px; color: var(--muted); line-height: 1.6; margin-bottom: 6px; }
.spot-highlight {
  font-size: 13px; color: var(--beni); font-weight: 700; margin-bottom: 4px;
}
.spot-hashtag { font-size: 12px; color: var(--ai-light); opacity: .8; }

/* ===== Itinerary Tab ===== */
#itinerary-panel { padding: 14px; }

/* 和風 section divider */
.itin-divider {
  text-align: center; color: var(--kin); font-size: 12px; letter-spacing: 0.3em;
  margin: 6px 0 10px; opacity: .5;
}
.itin-divider::before, .itin-divider::after {
  content: '───'; margin: 0 8px;
}

.itin-block {
  background: #FFFDF8; border-radius: var(--radius); padding: 13px 14px;
  margin-bottom: 10px; border: 1px solid var(--border);
  border-top: 3px solid var(--ai);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  position: relative; overflow: hidden;
}
.itin-block::after {
  content: ''; position: absolute; right: -10px; top: -10px;
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--ai); opacity: .04;
}
.itin-time { font-size: 16px; font-weight: 700; color: var(--ai); margin-bottom: 6px; font-family: var(--font-sans); }
.itin-note { font-size: 14px; color: var(--muted); line-height: 1.6; margin-bottom: 8px; }
.itin-spots { display: flex; flex-wrap: wrap; gap: 4px; }
.itin-spot-chip {
  font-size: 13px; padding: 4px 11px; background: var(--washi-dark);
  border: 1px solid var(--border); border-radius: 3px;
  cursor: pointer; transition: all .15s; color: var(--sumi-mid); font-weight: 500;
}
.itin-spot-chip:hover { border-color: var(--beni); color: var(--beni); background: #fff; }

/* ===== UGC Tab ===== */
#ugc-panel { padding: 16px; }
.ugc-hero {
  background: var(--ai);
  border-radius: var(--radius); padding: 18px;
  margin-bottom: 16px; text-align: center;
  position: relative; overflow: hidden;
}
.ugc-hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.03) 0, rgba(255,255,255,.03) 1px, transparent 0, transparent 50%),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.03) 0, rgba(255,255,255,.03) 1px, transparent 0, transparent 50%);
  background-size: 16px 16px;
}
.ugc-hero h3 { font-size: 17px; color: var(--kin-light); margin-bottom: 8px; font-family: var(--font-sans); position: relative; }
.ugc-hero p { font-size: 14px; color: rgba(255,255,255,.75); line-height: 1.7; position: relative; }
.hashtag-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; justify-content: center; position: relative; }
.hashtag-pill {
  padding: 5px 12px; background: rgba(255,255,255,.1);
  border: 1px solid var(--kin); border-radius: 3px;
  font-size: 13px; color: var(--kin-light); font-weight: 600;
}
.ugc-tips h4 { font-size: 13px; font-weight: 700; color: var(--sumi-mid); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .08em; }
.ugc-tip { display: flex; gap: 10px; margin-bottom: 10px; align-items: flex-start; background: #FFFDF8; border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.ugc-tip-icon { font-size: 20px; flex-shrink: 0; }
.ugc-tip-text { font-size: 14px; color: var(--muted); line-height: 1.6; }

/* ===== Map ===== */
#map { flex: 1; }

/* ===== Leaflet popup — light theme ===== */
.leaflet-popup-content-wrapper {
  background: #FFFDF8 !important; color: var(--sumi) !important;
  border: 1px solid var(--border) !important; border-radius: var(--radius) !important;
  border-top: 3px solid var(--beni) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.18) !important;
}
.leaflet-popup-tip { background: #FFFDF8 !important; }

.popup-body { min-width: 220px; max-width: 280px; }
.popup-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.popup-icon { font-size: 22px; }
.popup-title { font-size: 16px; font-weight: 700; line-height: 1.3; font-family: var(--font-sans); color: var(--sumi); }
.popup-desc { font-size: 14px; color: var(--muted); line-height: 1.6; margin-bottom: 8px; }
.popup-highlight { font-size: 13px; color: var(--beni); font-weight: 700; margin-bottom: 6px; }
.popup-hashtag { font-size: 12px; color: var(--ai-light); opacity: .8; }

/* ===== Map Markers ===== */
.map-marker {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  border: 2px solid; font-size: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25), 0 0 0 3px rgba(255,255,255,.6);
  transition: transform .15s; background: #fff;
}
.map-marker:hover { transform: scale(1.2); }

/* ===== Detail Panel ===== */
#detail-panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: 380px; background: var(--washi);
  border-left: 1px solid var(--border);
  z-index: 500; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
#detail-panel.open { transform: translateX(0); }

#detail-close {
  position: absolute; top: 12px; right: 12px; z-index: 10;
  background: rgba(255,255,255,.9); border: 1px solid var(--border); border-radius: 50%;
  width: 32px; height: 32px; cursor: pointer; color: var(--muted); font-size: 14px;
  display: flex; align-items: center; justify-content: center; transition: all .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}
#detail-close:hover { color: var(--beni); border-color: var(--beni); }

#detail-body { overflow-y: auto; flex: 1; padding-bottom: 32px; }

.detail-hero {
  height: 200px; display: flex; align-items: center; justify-content: center;
  font-size: 56px; position: relative; flex-shrink: 0;
  border-bottom: 2px solid var(--kin);
}
.detail-hero-bg {
  position: absolute; inset: 0; opacity: .12;
}
/* 青海波パターン — detail hero overlay */
.detail-hero::after {
  content: '';
  position: absolute; inset: 0; opacity: .06;
  background-image: radial-gradient(circle at 50% 120%, rgba(27,63,110,1) 60%, transparent 61%),
    radial-gradient(circle at 0% 120%, rgba(27,63,110,1) 60%, transparent 61%),
    radial-gradient(circle at 100% 120%, rgba(27,63,110,1) 60%, transparent 61%);
  background-size: 40px 24px;
  background-position: 0 0, -20px 0, 20px 0;
}

.detail-content { padding: 16px 18px; }

.detail-cat-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.detail-cat-badge {
  font-size: 9px; padding: 3px 8px; border-radius: 2px;
  font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
}
.detail-highlight { font-size: 12px; color: var(--beni); font-weight: 700; }

.detail-title { font-size: 20px; font-weight: 800; line-height: 1.3; margin-bottom: 3px; font-family: var(--font-sans); color: var(--sumi); }
.detail-name-ja { font-size: 13px; color: var(--muted); margin-bottom: 12px; letter-spacing: 0.05em; }
.detail-desc { font-size: 14px; color: var(--sumi-mid); line-height: 1.75; margin-bottom: 16px; }

/* 和風 divider */
.detail-divider {
  width: 100%; height: 1px; background: linear-gradient(to right, transparent, var(--border), transparent);
  margin: 14px 0; position: relative;
}
.detail-divider::after {
  content: '◆'; position: absolute; left: 50%; top: -7px; transform: translateX(-50%);
  color: var(--kin); font-size: 10px; background: var(--washi); padding: 0 6px;
}

.detail-section { margin-bottom: 14px; }
.detail-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .10em; color: var(--muted); margin-bottom: 8px; }
.detail-row { display: flex; gap: 9px; align-items: flex-start; margin-bottom: 6px; }
.detail-row-icon { font-size: 15px; flex-shrink: 0; margin-top: 1px; opacity: .7; }
.detail-row-text { font-size: 14px; color: var(--sumi-mid); line-height: 1.5; }

.detail-tip {
  background: #FFF8F0; border-radius: var(--radius); padding: 10px 13px;
  border: 1px solid #E8CEAD; border-left: 3px solid var(--kin); margin-bottom: 14px;
}
.detail-tip-label { font-size: 11px; font-weight: 700; color: var(--kin); text-transform: uppercase; letter-spacing: .10em; margin-bottom: 5px; }
.detail-tip-text { font-size: 14px; color: var(--sumi-mid); line-height: 1.7; }

.detail-photospot {
  background: #F0F4FA; border-radius: var(--radius); padding: 10px 13px; margin-bottom: 14px;
  border: 1px solid #C4D0E4; border-left: 3px solid var(--ai);
}
.detail-photospot-text { font-size: 14px; color: var(--sumi-mid); line-height: 1.7; }

.detail-gmaps {
  display: flex; align-items: center; gap: 8px; padding: 11px 16px;
  background: #F0F7F0; border: 1px solid #9DC49D; border-radius: var(--radius);
  text-decoration: none; color: var(--matcha); font-size: 13px; font-weight: 700;
  transition: all .15s; margin-bottom: 8px; letter-spacing: 0.02em;
}
.detail-gmaps:hover { background: #E4F0E4; box-shadow: 0 2px 6px rgba(74,124,89,.2); }

.detail-fullpage {
  display: flex; align-items: center; gap: 8px; padding: 11px 16px;
  background: var(--ai); border-radius: var(--radius);
  text-decoration: none; color: #fff; font-size: 13px; font-weight: 700;
  transition: all .15s; margin-bottom: 14px; letter-spacing: 0.02em;
}
.detail-fullpage:hover { background: var(--ai-light); }

.detail-hashtags { display: flex; flex-wrap: wrap; gap: 5px; }
.detail-hashtag { font-size: 12px; color: var(--ai); font-weight: 500; }

/* ===== Hero Image ===== */
#hero {
  height: 250px; position: relative; flex-shrink: 0;
  overflow: hidden; border-bottom: 3px solid var(--beni);
}
#hero-img {
  width: 100%; height: 100%; object-fit: cover; object-position: center;
  display: block;
}
#hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to right, rgba(10,10,10,.78) 0%, rgba(10,10,10,.45) 60%, rgba(10,10,10,.2) 100%);
  display: flex; align-items: flex-end; padding: 18px 24px;
}
#hero-text { display: flex; flex-direction: column; gap: 4px; }
#hero-title {
  font-family: var(--font-sans); font-size: 28px; font-weight: 800;
  color: #ffffff; letter-spacing: -0.01em;
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}
#hero-sub {
  font-size: 13px; color: var(--beni-light); letter-spacing: 0.14em;
  text-transform: uppercase; font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
}
#hero-desc {
  font-size: 14px; color: rgba(255,255,255,.85); line-height: 1.7;
  margin-top: 8px; max-width: 520px;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}

/* ===== Detail Hero Photo ===== */
.detail-hero-photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center; z-index: 0;
  opacity: 0.85;
}
.detail-hero { position: relative; }
.detail-hero .detail-hero-bg { z-index: 1; }
.detail-hero > span { z-index: 2; position: relative; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ===== Mobile ===== */
@media (max-width: 700px) {
  :root { --sidebar-w: 100%; }
  #hero { height: 160px; }
  #hero-title { font-size: 18px; }
  #hero-desc { font-size: 11px; display: none; }
  #main { flex-direction: column-reverse; }
  #sidebar { width: 100%; height: 45vh; border-right: none; border-top: 1px solid var(--border); }
  #map { height: 55vh; flex: none; }
  #header .logo-main { font-size: 15px; }
  #detail-panel { width: 100%; top: 0; }
  #sidebar::before { display: none; }
}

/* ===== Detail Panel: Photo Gallery ===== */
.detail-gallery {
  display: flex; gap: 4px; padding: 0 0 8px;
}
.detail-gallery-thumb {
  flex: 1; height: 64px; object-fit: cover; border-radius: 4px;
  cursor: zoom-in; transition: opacity .15s;
}
.detail-gallery-thumb:hover { opacity: .85; }

/* ===== Detail Panel: Share Row ===== */
.detail-share-row {
  display: flex; gap: 6px; margin: 12px 0; flex-wrap: wrap;
}
.detail-share-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 10px; border-radius: 4px; font-size: 13px; font-weight: 700;
  cursor: pointer; text-decoration: none; border: none; font-family: inherit;
  transition: opacity .15s;
}
.detail-share-btn:hover { opacity: .82; }
.detail-share-x     { background: #0f0f0f; color: #fff; flex: 1; }
.detail-share-insta { background: linear-gradient(45deg,#f09433,#e6683c,#dc2743,#cc2366,#bc1888); color: #fff; flex: 1; }
.detail-share-copy  { background: var(--ai); color: #fff; flex: 1; }
