/* ========================================
   無人販売所マップ - 共通スタイル
   ======================================== */

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

:root {
  --primary-color: #2d5a27;
  --primary-light: #4a8c3f;
  --primary-dark: #1e3d1a;
  --secondary-color: #f5a623;
  --accent-color: #e74c3c;
  --bg-color: #fafafa;
  --bg-light: #ffffff;
  --text-color: #333333;
  --text-light: #666666;
  --text-muted: #999999;
  --border-color: #e0e0e0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
  --radius: 8px;
  --radius-lg: 12px;
  --transition: 0.3s ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  color: var(--primary-light);
}

img {
  max-width: 100%;
  height: auto;
}

/* ========================================
   ヘッダー
   ======================================== */
.header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: bold;
  color: white;
}

.logo:hover {
  color: white;
  opacity: 0.9;
}

.logo-icon {
  font-size: 1.5rem;
}

/* ナビゲーション */
.nav {
  display: flex;
  align-items: center;
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 0.5rem;
}

.nav-link {
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  transition: background var(--transition);
  font-size: 0.9rem;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.25);
}

/* ハンバーガーメニュー */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

/* ========================================
   メインコンテンツ
   ======================================== */
.main {
  flex: 1;
  padding: 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.main-full {
  flex: 1;
  padding: 0;
  max-width: none;
}

/* ページタイトル */
.page-title {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-title-icon {
  font-size: 1.5rem;
}

/* セクション */
.section {
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--primary-dark);
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary-light);
}

/* ========================================
   カード
   ======================================== */
.card {
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-body {
  padding: 1.25rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: var(--primary-dark);
}

.card-text {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

/* ========================================
   販売所カード（一覧用）
   ======================================== */
.stand-card {
  display: block;
  color: inherit;
}

.stand-card:hover {
  color: inherit;
}

.stand-card .card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.stand-name {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--primary-dark);
}

.stand-address {
  font-size: 0.85rem;
  color: var(--text-light);
  display: flex;
  align-items: flex-start;
  gap: 0.25rem;
}

.stand-products {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

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

.stand-meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* タグ */
.tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  background: #e8f5e9;
  color: var(--primary-color);
  border-radius: 4px;
  font-size: 0.75rem;
}

.tag-payment {
  background: #fff3e0;
  color: #e65100;
}

.tag-parking {
  background: #e3f2fd;
  color: #1565c0;
}

/* 距離表示 */
.distance-badge {
  background: var(--secondary-color);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: bold;
}

/* ========================================
   グリッドレイアウト
   ======================================== */
.grid {
  display: grid;
  gap: 1.5rem;
}

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

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

/* ========================================
   フォーム
   ======================================== */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}

.form-label .required {
  color: var(--accent-color);
  margin-left: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(45, 90, 39, 0.1);
}

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

.form-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* チェックボックス */
.form-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.form-checkbox input {
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ========================================
   ボタン
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
}

.btn-secondary {
  background: var(--bg-light);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-color);
  color: var(--text-color);
}

.btn-accent {
  background: var(--secondary-color);
  color: white;
}

.btn-accent:hover {
  background: #e09000;
  color: white;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.125rem;
}

.btn-block {
  width: 100%;
}

/* ========================================
   検索・フィルター
   ======================================== */
.search-box {
  background: var(--bg-light);
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.search-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-input-wrapper {
  flex: 1;
  min-width: 250px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 1rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.filter-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.filter-select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 0.9rem;
  background: white;
  min-width: 120px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* ========================================
   地図
   ======================================== */
.map-container {
  height: calc(100vh - 60px);
  width: 100%;
}

#map {
  height: 100%;
  width: 100%;
}

/* 地図上のポップアップ */
.map-popup {
  min-width: 200px;
}

.map-popup-title {
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  color: var(--primary-dark);
}

.map-popup-address {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.map-popup-products {
  margin-bottom: 0.5rem;
}

.map-popup-link {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.4rem 0.8rem;
  background: var(--primary-color);
  color: white;
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.map-popup-link:hover {
  background: var(--primary-dark);
  color: white;
}

/* 地図コントロール */
.map-controls {
  position: absolute;
  top: 80px;
  right: 10px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.map-control-btn {
  background: white;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.map-control-btn:hover {
  background: var(--bg-color);
}

/* ========================================
   詳細ページ
   ======================================== */
.detail-header {
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.detail-title {
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.detail-address {
  color: var(--text-light);
  margin-bottom: 1rem;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-section {
  background: var(--bg-light);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.detail-section-title {
  font-size: 1.1rem;
  color: var(--primary-dark);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

.detail-row {
  display: flex;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  width: 120px;
  font-weight: 500;
  color: var(--text-light);
  flex-shrink: 0;
}

.detail-value {
  flex: 1;
}

.detail-description {
  line-height: 1.8;
  color: var(--text-color);
}

.detail-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ========================================
   FAQ
   ======================================== */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  background: var(--bg-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.faq-question {
  padding: 1.25rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  color: var(--primary-dark);
}

.faq-question:hover {
  background: var(--bg-color);
}

.faq-icon {
  transition: transform var(--transition);
}

.faq-item.open .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 1.25rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.open .faq-answer {
  padding: 0 1.25rem 1.25rem;
  max-height: 500px;
}

.faq-answer p {
  color: var(--text-light);
  line-height: 1.8;
}

/* ========================================
   フッター
   ======================================== */
.footer {
  background: var(--primary-dark);
  color: white;
  padding: 2rem 1rem;
  margin-top: auto;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2rem;
}

.footer-section {
  min-width: 200px;
}

.footer-title {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--secondary-color);
}

.footer-list {
  list-style: none;
}

.footer-list li {
  margin-bottom: 0.5rem;
}

.footer-list a {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

.footer-list a:hover {
  color: white;
}

.footer-bottom {
  max-width: 1200px;
  margin: 2rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

/* ========================================
   ヒーローセクション（トップページ）
   ======================================== */
.hero {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  padding: 3rem 1rem;
  text-align: center;
  margin: -2rem -1rem 2rem;
}

.hero-title {
  font-size: 2rem;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 2rem;
}

.hero-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-btn {
  padding: 1rem 2rem;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}

.hero-btn-primary {
  background: white;
  color: var(--primary-color);
}

.hero-btn-primary:hover {
  background: var(--bg-color);
  color: var(--primary-dark);
}

.hero-btn-secondary {
  background: transparent;
  color: white;
  border: 2px solid white;
}

.hero-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

/* 特徴セクション */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.feature-card {
  text-align: center;
  padding: 2rem 1.5rem;
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.feature-title {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--primary-dark);
}

.feature-text {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* ========================================
   確認画面（submit）
   ======================================== */
.confirm-section {
  background: #fffde7;
  border: 1px solid #ffc107;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.confirm-title {
  color: #f57f17;
  margin-bottom: 1rem;
}

.json-preview {
  background: #263238;
  color: #aed581;
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: "Courier New", Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ========================================
   アラート・通知
   ======================================== */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.alert-info {
  background: #e3f2fd;
  color: #1565c0;
  border: 1px solid #90caf9;
}

.alert-success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.alert-warning {
  background: #fff3e0;
  color: #e65100;
  border: 1px solid #ffcc80;
}

.alert-error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

/* ========================================
   ローディング
   ======================================== */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 3rem;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* 結果なし */
.no-results {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.no-results-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

/* ========================================
   ユーティリティ
   ======================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none !important; }

/* ========================================
   レスポンシブ
   ======================================== */
@media (max-width: 768px) {
  .header-inner {
    height: 56px;
  }

  .nav-toggle {
    display: block;
  }

  .nav-list {
    display: none;
    position: absolute;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--primary-dark);
    flex-direction: column;
    padding: 1rem;
    gap: 0;
  }

  .nav-list.open {
    display: flex;
  }

  .nav-link {
    padding: 0.75rem 1rem;
    border-radius: 0;
  }

  .hero {
    padding: 2rem 1rem;
    margin: -2rem -1rem 1.5rem;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .page-title {
    font-size: 1.4rem;
  }

  .search-row {
    flex-direction: column;
  }

  .search-input-wrapper {
    min-width: 100%;
  }

  .filter-row {
    flex-direction: column;
  }

  .filter-select {
    width: 100%;
  }

  .detail-row {
    flex-direction: column;
  }

  .detail-label {
    width: 100%;
    margin-bottom: 0.25rem;
  }

  .detail-actions {
    flex-direction: column;
  }

  .btn-block-mobile {
    width: 100%;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }

  .map-container {
    height: calc(100vh - 56px);
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .main {
    padding: 1rem 0.75rem;
  }

  .card-body {
    padding: 1rem;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }

  .hero-btn {
    width: 100%;
    max-width: 280px;
  }
}
