/* CSS変数定義 */
:root {
  /* メインカラー */
  --primary-color: #ff6b35;
  --primary-color-hover: #e55a2e;
  --primary-color-shadow: rgba(255, 107, 53, 0.2);
  
  /* セカンダリーカラー */
  --secondary-color: #50c8c3;
  --secondary-color-light: rgba(80, 200, 195, 0.2);
  
  /* グラデーションカラー */
  --blue-gradient-start: #4fc3f7;
  --blue-gradient-end: #29b6f6;
  --blue-gradient: linear-gradient(135deg, var(--blue-gradient-start) 0%, var(--blue-gradient-end) 100%);
  --blue-shadow: rgba(79, 195, 247, 0.3);
  --blue-shadow-hover: rgba(79, 195, 247, 0.4);
  
  --green-gradient-start: #66bb6a;
  --green-gradient-end: #4caf50;
  --green-gradient: linear-gradient(135deg, var(--green-gradient-start) 0%, var(--green-gradient-end) 100%);
  --green-shadow: rgba(76, 175, 80, 0.3);
  --green-shadow-hover: rgba(76, 175, 80, 0.4);
  
  /* ニュートラルカラー */
  --white: #fff;
  --background-light: #f8f9fa;
  --text-primary: #333;
  --text-secondary: #666;
  --text-muted: #6c757d;
  --text-light: #495057;
  
  /* ボーダー・シャドウ */
  --border-light: #e9ecef;
  --border-medium: #dee2e6;
  --border-button: 3px;
  --shadow-light: rgba(0, 0, 0, 0.08);
  --shadow-medium: rgba(0, 0, 0, 0.1);
  --shadow-strong: rgba(0, 0, 0, 0.12);
  --shadow-hover: rgba(0, 0, 0, 0.15);
  
  /* オーバーレイ */
  --overlay-bg: rgba(0, 0, 0, 0.5);
  --modal-bg-light: rgba(255, 255, 255, 0.2);
  --modal-bg-light-hover: rgba(255, 255, 255, 0.3);
  
  /* その他 */
  --border-radius: 12px;
  --border-radius-small: 6px;
  --border-radius-tag: 12px;
  --border-radius-circle: 50%;
}

/* * {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
} */

/* body {
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic",
    "Meiryo", sans-serif;
  background: var(--background-light);
  min-height: 100vh;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  color: var(--text-primary);
} */

/* メインページ（CMS組み込み用） */
.ff-main-page {
  /* min-height: 100vh; */
  display: flex;
  align-items: center;
  justify-content: center;
  /* padding: 20px; */
  margin-top: 90px; /* 固定ヘッダー分のマージン + 10px */
  margin-bottom: 10px; /* 下部にもマージンを追加 */
}

.ff-hero-section {
  text-align: center;
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 40px 30px;
  box-shadow: 0 2px 8px var(--shadow-light);
  /* max-width: 500px; */
  width: 100%;
  border: 1px solid var(--border-light);
}

.ff-hero-section h1 {
  font-size: 2rem;
  color: var(--text-primary);
  margin-bottom: 15px;
  font-weight: 700;
}

.ff-hero-section p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 30px;
  line-height: 1.6;
}

/* モーダル */
.ff-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay-bg);
  z-index: 1001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 110px 20px 30px 20px; /* 上部パディング110px、下部パディング30px */
  box-sizing: border-box;
  overflow: hidden; /* 横スクロールバーを非表示 */
}

.ff-modal-overlay.ff-show {
  display: flex;
  animation: fadeIn 0.3s ease-in-out;
}

.ff-modal-container {
  background: var(--white);
  border-radius: var(--border-radius);
  max-width: 460px;
  width: 100%;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px var(--shadow-strong);
  animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border-light);
  overflow: hidden; /* 横スクロールバーを非表示 */
}

.ff-modal-header {
  background: var(--secondary-color);
  color: var(--white);
  padding: 10px;
  text-align: center;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  box-shadow: 0 2px 4px var(--shadow-light);
  position: relative;
  font-weight: bold;
}

.ff-modal-header h1 {
  font-size: 1.2rem;
  margin-bottom: 10px;
  font-weight: 600;
}

.ff-close-modal-button {
  position: absolute;
  top: 7px;
  right: 20px;
  background: var(--modal-bg-light);
  border: none;
  color: var(--white);
  font-size: 20px;
  width: 35px;
  height: 35px;
  border-radius: var(--border-radius-circle);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
  line-height: 35px;
  padding-bottom: 5px;
}

.ff-close-modal-button:hover {
  background: var(--modal-bg-light-hover);
}

.ff-modal-main {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.ff-progress {
  background: var(--modal-bg-light);
  display: inline-block;
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: bold;
  font-size: 0.9rem;
}

.ff-main {
  flex: 1;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.ff-question-screen,
.ff-result-screen {
  width: 100%;
  animation: fadeIn 0.5s ease-in-out;
  min-height: auto;
}

.ff-question-content,
.ff-result-content {
  text-align: center;
}

.ff-question-title {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 30px;
  font-weight: 600;
  line-height: 1.5;
}

.ff-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 15px;
  max-width: 100%;
}

.ff-choice-button {
  background: var(--white);
  border: var(--border-button) solid var(--border-medium);
  border-radius: var(--border-radius);
  padding: 18px 20px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-wrap: break-word;
  hyphens: auto;
}

/* 文字数が多い場合は1列に戻す */
.ff-choice-button.ff-long-text {
  grid-column: 1 / -1;
}

.ff-choice-button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    var(--secondary-color-light),
    transparent
  );
  transition: left 0.5s;
}

.ff-choice-button:hover {
  transform: translateY(-1px);
  border-color: var(--secondary-color);
  background: var(--background-light);
}

.ff-choice-button:hover::before {
  left: 100%;
}

.ff-choice-button:active {
  transform: translateY(0);
  background: var(--secondary-color);
  color: var(--white);
  border-color: var(--secondary-color);
}

.ff-result-title {
  font-size: 1.4rem;
  color: var(--text-primary);
  margin-bottom: 20px;
  margin-top: 0;
  font-weight: 700;
  text-align: center;
}

.ff-facilities-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 30px;
}

.ff-facility-card {
  background: var(--white);
  border-radius: var(--border-radius);
  overflow: hidden;
  transition: transform 0.3s ease, border-color 0.3s ease;
  border: var(--border-button) solid var(--border-light);
}

/* キーカラー対応スタイル */
.ff-facility-card-themed {
  border: 3px solid var(--key-color);
}

.ff-facility-card-themed .ff-facility-name {
  color: var(--key-color);
}

.ff-facility-card-themed .ff-map-button {
  background: linear-gradient(
    135deg,
    var(--key-color) 0%,
    var(--key-color) 100%
  );
  filter: brightness(1.1);
}

.ff-facility-card-themed .ff-map-button:hover {
  filter: brightness(1.2);
  border-color: var(--key-color);
}

.ff-facility-image-container {
  width: 100%;
  /* height: 180px; */
  overflow: hidden;
}

.ff-facility-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ff-facility-info {
  padding: 15px;
}

.ff-modal-overlay .ff-facility-name {
  margin: 5px auto 10px;
  font-size: 1.2rem;
  color: var(--text-primary);
  margin-bottom: 10px;
  font-weight: 600;
}

.ff-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.ff-tag {
  background: var(--blue-gradient);
  color: var(--white);
  padding: 4px 8px;
  border-radius: var(--border-radius-tag);
  font-size: 0.7rem;
  font-weight: 500;
}

.ff-tag-clickable {
  cursor: pointer;
  transition: all 0.3s ease;
}

.ff-tag-clickable:hover {
  transform: translateY(-1px);
  background: var(--green-gradient);
  box-shadow: 0 2px 8px var(--green-shadow);
}

.ff-facility-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 15px;
  text-align: left;
}

.ff-facility-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.ff-map-button,
.ff-detail-button {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 0 solid transparent;
  border-radius: var(--border-radius-small);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ff-map-button {
  background: var(--blue-gradient);
  color: var(--white);
  border-color: var(--text-primary);
}

.ff-map-button:hover {
  transform: translateY(-1px);
  border-color: var(--blue-gradient-start);
}

.ff-detail-button {
  background: var(--green-gradient);
  color: var(--white);
  border-color: var(--green-gradient-end);
}

.ff-detail-button:hover {
  transform: translateY(-1px);
  border-color: var(--green-gradient-start);
}

/* 1つのボタンしかない場合は幅を広げる */
.ff-facility-actions .ff-map-button:only-child,
.ff-facility-actions .ff-detail-button:only-child {
  flex: none;
  width: 100%;
}

.ff-result-actions {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.ff-restart-button,
.ff-back-button {
  padding: 12px 20px;
  background: var(--background-light);
  color: var(--text-muted);
  border: 2px solid var(--border-medium);
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  margin: 0 5px;
  width: auto;
  min-height: auto;
}

.ff-restart-button:hover,
.ff-back-button:hover {
  background: var(--border-light);
  transform: translateY(-1px);
  border-color: var(--text-muted);
}

.ff-restart-button:active,
.ff-back-button:active {
  background: var(--text-muted);
  color: var(--white);
  border-color: var(--text-muted);
  transform: translateY(0);
}

/* 質問画面での戻るボタン専用配置 */
.ff-choices .ff-back-button {
  grid-column: 1 / -1;
  margin: 15px auto 0;
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.8) translateY(50px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.ff-slide-in {
  animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 480px) {
  .ff-main-page {
    margin-top: 90px; /* スマートフォンでも固定ヘッダー分のマージンを確保 + 10px */
    margin-bottom: 10px; /* 下部にもマージンを追加 */
  }

  .ff-modal-overlay {
    padding: 110px 15px 25px 15px; /* スマートフォンでも上部パディング110px、下部パディング25px */
  }

  .ff-container {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .ff-main {
    padding: 15px;
  }

  .ff-question-title {
    font-size: 1.2rem;
    margin-bottom: 25px;
  }

  .ff-choice-button {
    padding: 16px 18px;
    font-size: 0.95rem;
  }

  .ff-result-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
  }

  .ff-facilities-container {
    gap: 15px;
    margin-bottom: 20px;
  }

  .ff-facility-card {
    border-radius: 8px;
  }

  /* .ff-facility-image-container {
    height: 150px;
  } */

  .ff-facility-info {
    padding: 12px;
  }

  .ff-facility-name {
    font-size: 1.1rem;
    margin-bottom: 8px;
  }

  .ff-facility-description {
    font-size: 0.8rem;
    margin-bottom: 12px;
  }

  .ff-map-button,
  .ff-detail-button {
    padding: 8px 10px;
    font-size: 0.7rem;
  }
}

@media (max-height: 700px) {
  .ff-header {
    padding: 15px;
  }

  .ff-header h1 {
    font-size: 1.1rem;
    margin-bottom: 8px;
  }

  .ff-main {
    padding: 15px;
  }

  .ff-question-title {
    margin-bottom: 20px;
  }

  .ff-choices {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
  }

  .ff-facilities-container {
    gap: 15px;
  }

  /* .ff-facility-image-container {
    height: 120px;
  } */

  .ff-facility-info {
    padding: 10px;
  }
}

/* ========== 画像スライダー ========== */

/* スライダーコンテナのスタイル */
.ff-slider-container {
  position: relative;
}

.ff-image-slider {
  position: relative;
  width: 100%;
  height: 180px;
  overflow: hidden;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.ff-slider-slides {
  position: relative;
  width: 100%;
  height: 100%;
}

.ff-slider-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.ff-slider-slide.ff-active {
  opacity: 1;
}

.ff-slider-slide .ff-facility-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* スライダーナビゲーション */
.ff-slider-nav {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  pointer-events: none;
}

.ff-slider-prev,
.ff-slider-next {
  background: rgba(0, 0, 0, 0.5);
  color: var(--white);
  border: none;
  border-radius: var(--border-radius-circle);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.3s ease;
  pointer-events: auto;
  line-height: 1;
  user-select: none;
}

.ff-slider-prev:hover,
.ff-slider-next:hover {
  background: rgba(0, 0, 0, 0.7);
  transform: scale(1.1);
}

.ff-slider-prev:active,
.ff-slider-next:active {
  transform: scale(0.95);
}

/* スライダーインジケーター */
.ff-slider-indicators {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

.ff-slider-indicator {
  width: 8px;
  height: 12px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.ff-slider-indicator.ff-active {
  background: var(--white);
  transform: scale(1);
}

.ff-slider-indicator:hover {
  background: rgba(255, 255, 255, 0.8);
}

/* レスポンシブ対応 */
@media (max-width: 480px) {
  .ff-image-slider {
    height: 150px;
  }
  
  .ff-slider-prev,
  .ff-slider-next {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }
  
  .ff-slider-nav {
    padding: 0 8px;
  }
  
  .ff-slider-indicators {
    bottom: 8px;
    gap: 4px;
  }
  
  .ff-slider-indicator {
    width: 6px;
    height: 6px;
  }
}

@media (max-height: 700px) {
  .ff-image-slider {
    height: 120px;
  }
}
