/* ==========================================================
   IZU Explorer — レスポンシブCSS
   ========================================================== */

/* --- CSS変数 --- */
:root {
  --primary: #0a7a7a;
  --primary-light: #0d9c9c;
  --primary-dark: #075e5e;
  --secondary: #f4a22a;
  --bg: #f0f9f7;
  --surface: #ffffff;
  --border: #cce8e4;
  --text: #2d3748;
  --text-muted: #718096;
  --danger: #e53e3e;
  --success: #38a169;
  --nav-height: 64px;
  --header-height: 56px;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(0,0,0,0.10);
}

/* --- リセット・ベース --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; }

/* --- ヘッダー --- */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

.app-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* --- メインコンテンツエリア --- */
.app-main {
  padding-top: var(--header-height);
  padding-bottom: var(--nav-height);
  min-height: 100%;
}

/* --- タブコンテンツ --- */
.tab-content {
  display: none;
  padding: 16px;
  overflow-y: auto;
}

.tab-content.active {
  display: block;
}

/* --- ボトムナビゲーション --- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.08);
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: none;
  cursor: pointer;
  padding: 8px 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-family: inherit;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.nav-btn .nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-btn.active {
  color: var(--primary);
  font-weight: 600;
}

/* --- カード共通 --- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  overflow: hidden;
}

.card-body {
  padding: 14px 16px;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* タグバッジ */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
}

.tag-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* --- 地図コンテナ --- */
.map-container {
  height: 300px;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

/* --- 進捗バー --- */
.progress-wrap {
  background: var(--bg);
  border-radius: 9999px;
  height: 10px;
  margin: 6px 0 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

/* --- スタンプカード --- */
.stamp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stamp-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  text-align: center;
  border: 2px solid var(--border);
  transition: border-color 0.2s;
}

.stamp-card.stamped {
  border-color: var(--primary);
  background: #e8f7f5;
}

.stamp-icon {
  font-size: 2rem;
  margin-bottom: 6px;
}

.stamp-card .stamp-name {
  font-size: 0.85rem;
  font-weight: 600;
}

.stamp-card .stamp-pts {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stamp-btn {
  margin-top: 8px;
  display: block;
  width: 100%;
  padding: 6px;
  font-size: 0.8rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  background: var(--primary);
  color: #fff;
  transition: background 0.15s;
}

.stamp-btn:disabled {
  background: var(--text-muted);
  cursor: default;
}

/* --- バッジカード --- */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.badge-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 12px;
  text-align: center;
  border: 2px solid var(--border);
  transition: all 0.2s;
}

.badge-card.earned {
  border-color: var(--secondary);
  background: #fff8ee;
  box-shadow: 0 0 12px rgba(244, 162, 42, 0.3);
}

.badge-card.unearned {
  opacity: 0.55;
  filter: grayscale(0.7);
}

.badge-icon {
  font-size: 2.5rem;
  margin-bottom: 6px;
  line-height: 1;
}

.badge-name {
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.badge-cond {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- プレゼントカード --- */
.gift-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
  margin-bottom: 10px;
  border-left: 4px solid var(--border);
}

.gift-card.reachable {
  border-left-color: var(--secondary);
}

.gift-pts {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--secondary);
  white-space: nowrap;
}

/* --- ポイント表示 --- */
.point-display {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}

.point-num {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
}

.point-label {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 4px;
}

/* --- モーダル --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.center {
  align-items: center;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 16px;
  animation: slideUp 0.25s ease;
}

.modal-overlay.center .modal-box {
  border-radius: var(--radius);
  max-width: 360px;
  text-align: center;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  font-family: inherit;
}

/* --- スタンプアニメーション --- */
@keyframes stampPop {
  0%   { transform: scale(0.2) rotate(-20deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.stamp-pop {
  animation: stampPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

/* --- 祝福モーダル --- */
.celebration-icon {
  font-size: 5rem;
  margin: 16px 0;
  line-height: 1;
}

.celebration-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

/* --- ボタン共通 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  transition: background 0.15s, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--text-muted); cursor: default; }

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

.btn-block {
  width: 100%;
}

/* --- フォーム --- */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text);
}

.form-input, .form-select, .form-textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* --- 星評価 --- */
.star-rating {
  display: flex;
  gap: 4px;
  font-size: 1.6rem;
  cursor: pointer;
}

.star-rating .star {
  color: #ccc;
  transition: color 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.star-rating .star.active { color: var(--secondary); }

/* --- カテゴリフィルター --- */
.filter-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  margin-bottom: 12px;
  scrollbar-width: none;
}

.filter-row::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 5px 14px;
  border-radius: 9999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.filter-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* --- AIレコメンドUI --- */
.ai-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.ai-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--primary);
}

.pref-tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.pref-tag {
  padding: 5px 14px;
  border-radius: 9999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.pref-tag.selected {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.ai-result {
  background: var(--bg);
  border-radius: 8px;
  padding: 14px;
  margin-top: 14px;
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.7;
  border: 1px solid var(--border);
}

.loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255,255,255,0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- セクション見出し --- */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin: 16px 0 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}

/* --- 通知トースト --- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 10px 20px;
  border-radius: 9999px;
  font-size: 0.9rem;
  z-index: 300;
  animation: toastIn 0.25s ease, toastOut 0.3s ease 2s forwards;
  white-space: nowrap;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; pointer-events: none; }
}

/* --- ローディング --- */
.loading-placeholder {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
}

/* --- レビュー表示 --- */
.review-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.review-item:last-child { border-bottom: none; }

.review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.review-nickname { font-weight: 700; font-size: 0.9rem; }
.review-date { font-size: 0.78rem; color: var(--text-muted); }
.review-stars { color: var(--secondary); font-size: 0.9rem; }
.review-comment { font-size: 0.9rem; color: var(--text); }

/* --- タブレット/PC (768px+) --- */
@media (min-width: 768px) {
  .app-header h1 { font-size: 1.4rem; }

  .app-main { max-width: 960px; margin: 0 auto; }

  .tab-content { padding: 20px 24px; }

  .stamp-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }

  .badge-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

  .two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  .map-container { height: 400px; }

  .modal-overlay { align-items: center; }

  .modal-box {
    border-radius: var(--radius);
    max-width: 520px;
    max-height: 80vh;
  }

  /* PCのボトムナビを左サイドバーに変換（オプション） */
  .bottom-nav { font-size: 13px; }
}
