/* ルート変数 */
:root {
  --primary-color: #ff8c00; /* 橙色 */
  --navbar-bg: linear-gradient(to right, #ff8c00, #ffd700);
  --navbar-border-color: #ff4500;
  --navbar-hover-bg: #ff4500;
  --navbar-active-bg: #e67e22;
  --button-bg: #ff8c00;
  --button-hover-bg: #e67e22;
  --checkbox-checked-bg: #ff8c00;
  --checkbox-checked-border: #e67e22;
}

/* リセットと基本設定 */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  font-family: 'M PLUS Rounded 1c', '游ゴシック', 'Yu Gothic', sans-serif;
}

body {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 10px 0;
  margin: 0; /* body の上下マージンを0に */
  background: #ffffff;
  color: #333;
  min-height: 100vh;
  background-image: radial-gradient(circle, rgba(255, 215, 182, 0.3) 2px, transparent 2px);
  background-size: 10px 10px;
          box-sizing: border-box; /* padding を含めて高さを計算 */
  padding-top: 95px !important; /* PCナビゲーションの高さ変更分を反映 (129px -> 95px) */
}

/* メインコンテンツ */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1080px;
  width: 100%;
}

/* タイトル */
.main-title {
  font-family: 'M PLUS Rounded 1c', '游ゴシック', 'Yu Gothic', sans-serif;  
  font-size: 40px; /* 少し小さくしました */
  font-weight: 700;
  color: #ff1495;
  margin: 20px 0 15px; /* friend_board.php の .main-title の margin-bottom に合わせる */
  text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
  text-align: center;
}

/* イントロセクション */
.intro-tight {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.intro-tight h2 {
  font-size: 14px;
  font-family: '游ゴシック', 'Yu Gothic', sans-serif;
  font-weight: 700;
  color: #333;
  line-height: 20px;
  text-align: center;
  margin: 0;
  padding: 0;
}

.intro-tight p {
  font-size: 14px;
  font-family: '游ゴシック', 'Yu Gothic', sans-serif;
  font-weight: 700;
  color: #333;
  line-height: 20px;
  text-align: center;
  margin: 0;
  padding: 0;
}

/* 絞り込みフォーム */
#filter-form {
  padding: 15px; /* details内のフォームの余白 */
  margin-top: 0; /* HTML側でインラインスタイルで指定したものをCSSで上書き */
  background-color: transparent; /* details の背景色を活かすため、フォーム自体の背景は透明に */
  border: none; /* details が枠を持つので、フォーム自体の枠線は不要に */
  box-shadow: none; /* details が影を持つので、フォーム自体の影は不要に */
}

.filter-title {
  font-family: 'M PLUS Rounded 1c', '游ゴシック', 'Yu Gothic', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #ff4500;
  text-align: center;
  margin: 0 0 8px 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

/* チェックボックスコンテナ */
.checkbox-container-base {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  max-width: 1000px;
  padding: 0 10px;
}

.checkbox-container-row {
  margin: 2px 0;
}

.checkbox-container.compact {
  margin-top: 10px;
}

.checkbox-container {
  display: inline-flex;
  align-items: center;
  min-width: 24px;
  min-height: 24px;
}

/* チェックボックス */
input[type="checkbox"]:not(.visible-checkbox) {
  display: none;
}

input[type="checkbox"] + label {
  position: relative;
  padding: 2px 4px 2px 24px;
  cursor: pointer;
  font-size: 14px;
  font-family: '游ゴシック', 'Yu Gothic', sans-serif;
  font-weight: 700;
  color: #333;
  line-height: 20px;
  transition: background-color 0.2s ease;
  user-select: none;
}

input[type="checkbox"] + label::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid #666;
  background: #f0f0f0;
  border-radius: 4px;
  box-sizing: border-box;
}

input[type="checkbox"]:checked + label::before {
  background: var(--checkbox-checked-bg) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>') no-repeat center;
  background-size: 12px;
  border-color: var(--checkbox-checked-border);
}

/* パラメータ評価のトグルなど、明示的に表示したいチェックボックスのスタイル */
.visible-checkbox {
    display: inline-block;
    margin-left: 8px;
    flex-shrink: 0;
    -webkit-appearance: checkbox; /* Webkitブラウザ用 */
    appearance: checkbox;       /* 標準 */
    width: auto;                /* 幅を自動に */
    height: auto;               /* 高さを自動に */
}

input[type="checkbox"] + label:hover {
  background-color: #fff3e0;
}

label {
  display: inline-block;
  text-align: center;
  outline: none;
}

label:focus {
  outline: 2px solid var(--primary-color);
}

/* 詳細トグル */
details {
  margin: 10px 0;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 5px;
}

summary {
  cursor: pointer;
  font-weight: 700;
  padding: 5px;
  color: #333;
}

details[open] summary {
  border-bottom: 1px solid #ddd;
}

/* ボタンエリア */
.button-container {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 15px 0 0;
  flex-wrap: wrap;
  padding: 0 10px;
}

.csv-button {
  padding: 10px 20px;
  font-size: 14px;
  font-family: '游ゴシック', 'Yu Gothic', sans-serif;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  background: var(--button-bg);
  color: #fff;
  cursor: pointer;
  opacity: 0.9;
  transition: all 0.3s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  min-width: 100px;
}

.csv-button.active {
  background: #ff4500;
  color: #fff;
  opacity: 1;
  box-shadow: 0 2px 4px rgba(255, 69, 0, 0.2);
}

.csv-button:hover {
  background: var(--button-hover-bg);
}

/* リセットボタン */
.reset-button {
  background: var(--button-bg);
  color: #fff;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000; /* ナビゲーションバーより手前に表示されるように調整 */
  /* テキストを中央揃えにするためのスタイル */
  display: inline-flex; /* Flexbox を使用して中央揃え */
  align-items: center; /* 垂直方向中央揃え */
  justify-content: center; /* 水平方向中央揃え */
  text-align: center; /* フォールバックまたは単一行の場合 */
  line-height: normal; /* line-height をリセットして影響を避ける */
  font-size: 16px; /* 現在のサイズより2px大きく (例: 14px -> 16px) */
}

.reset-button:hover {
  background: var(--button-hover-bg); /* ホバー時の背景色 */
}

/* 画像表示エリア */
#image-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  max-width: 1080px;
  min-height: 200px;
  margin: 20px 0;
  padding: 20px;
  background-color: #e0f7fa; /* 薄い水色に変更 (例: Light Cyan) */
  border: 1px solid #ddd;
  border-radius: 5px;
  position: relative;
  flex-grow: 1;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.image-item {
  display: inline-block;
  margin: 5px;
  text-align: center;
  width: 208px;
  height: auto;
  vertical-align: top;
  position: relative;
  transition: height 0.3s ease;
  overflow: hidden;
}

.image-item img:not(.detail-image) {
  width: 208px;
  height: 117px;
  border-radius: 8px;
  border: 2px solid #ffd700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  object-fit: cover;
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.image-item img:not(.detail-image)[src$="placeholder.png"] {
  opacity: 0.5;
  border-color: #ccc;
}

.detail-image {
  width: 60px !important;
  height: 60px !important;
  position: absolute;
  display: none;
  z-index: 15;
  border-radius: 8px;
  border: 2px solid #ffd700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.detail-none {
  position: absolute;
  display: none;
  font-size: 18px;
  color: #666;
  z-index: 15;
  width: 60px;
  height: 60px;
  line-height: 60px;
  text-align: center;
  transform: translateX(-50%);
  border-radius: 8px;
  border: 2px solid #ffd700;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  background: #fff;
}

.info {
  position: absolute;
  width: auto;
  max-width: calc(100vw - 20px);
  background: #fff3e0;
  padding: 10px 10px 5px;
  font-size: 14px;
  text-align: left;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  border-radius: 8px; /* 角を丸くする */
  display: none;
}

.info ul {
  list-style-type: none;
  padding: 0;
  margin: 0;
}

.info li {
  margin: 5px 0;
  white-space: nowrap;
}

/* AdSense広告用（ポップアップ） */
.ad-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ad-container {
  position: relative;
  background-color: #fff;
  padding: 15px;
  border-radius: 8px;
  max-width: 90%;
  min-height: 100px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.ad-container .adsbygoogle {
  display: block !important;
  width: 100%;
  min-height: 50px;
}

.ad-container button {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 35px;
  height: 35px;
  font-size: 20px;
  line-height: 30px;
  background: #ff4500;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

/* AdSense広告用（インライン） */
.adsense-ad {
  margin: 20px 0;
  text-align: center;
  width: 100%;
}

.adsense-ad ins {
  display: block;
  width: 100%;
  max-width: 728px;
  margin: 0 auto;
  padding: 0 10px;
  box-sizing: border-box;
}

/* モバイル対応（768px以下） */
@media screen and (max-width: 768px) {
  .image-item {
    width: 180px;
    height: auto;
  }
  .image-item img:not(.detail-image) {
    width: 180px;
    height: auto;
  }
  .detail-image {
    width: 60px !important;
    height: 60px !important;
  }
  .info {
    width: 180px;
    max-width: 180px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow-x: hidden;
    padding: 10px 5px 5px;
    box-sizing: border-box;
    left: 0;
    margin: 0;
  }
  .info ul {
    margin: 0;
    padding: 0 5px;
  }
  .info li {
    white-space: normal;
    line-height: 1.2;
    margin: 2px 0;
  }
  #filter-form {
    padding: 15px;
    margin: 15px 0;
  }
  #image-container {
    padding: 15px;
    margin: 15px 0;
    gap: 8px;
  }
  .adsense-ad {
    margin: 15px 0;
  }
  .adsense-ad ins {
    max-width: 90%;
    padding: 0 5px;
  }
}

/* モバイル対応（600px以下） */
@media (max-width: 768px) { /* ブレークポイントをSPナビ表示基準に合わせる */
  body {
    /* padding: 0px 0; */ /* 上書きされるため、この行は不要な可能性 */
    padding-top: 70px !important; /* スマホナビゲーションの高さ変更分を反映 (50px -> 65px) */
  }
  .navbar { /* .navbar は style.css には存在しないようですが、もしあれば */    flex-wrap: nowrap;
    gap: 10px;
    padding: 5px;
  }
  .navbar a {
    font-size: 12px;
    padding: 8px 15px;
    white-space: nowrap;
  }
  .main-title {
    font-size: 28px;
    margin: 8px 0 4px;
    
  }
  .intro-tight h2 {
    font-size: 11px;
    line-height: 16px;
    color: #333;
  }
  .intro-tight p {
    font-size: 11px;
    line-height: 16px;
    color: #333;
  }
  #image-container {
    max-width: 100%;
    padding: 0 5px;
    gap: 5px;
  }
  .image-item {
    width: 150px;
    height: auto;
  }
  .image-item img:not(.detail-image) {
    width: 150px;
    height: auto;
  }
  .checkbox-container-base {
    max-width: 100%;
    padding: 0 5px;
    gap: 3px;
  }
  input[type="checkbox"] + label {
    font-size: 13px;
    padding: 2px 4px 2px 24px;
  }
  input[type="checkbox"] + label::before {
    width: 16px;
    height: 16px;
    left: 3px;
  }
  .checkbox-container {
    min-width: 24px;
    min-height: 24px;
  }
  .csv-button {
    padding: 8px 16px;
    font-size: 12px;
    min-width: 80px;
  }
  .reset-button {
    padding: 8px 16px;
    font-size: 12px;
    min-width: 80px;
    bottom: 15px;
    right: 15px;
  }
  .adsense-ad {
    margin: 10px 0;
  }
  .adsense-ad ins {
    max-width: 100%;
  }
}

/* モバイル対応（320px以下） */
@media (max-width: 320px) {
  .main-title {
    font-size: 24px;
  }
  .intro-tight h2 {
    font-size: 9px;
    line-height: 14px;
  }
  .intro-tight p {
    font-size: 9px;
    line-height: 14px;
  }
  .image-item {
    width: 120px;
  }
  .image-item img:not(.detail-image) {
    width: 120px;
    height: auto;
  }
  .csv-button {
    padding: 6px 12px;
    font-size: 10px;
    min-width: 70px;
  }
  input[type="checkbox"] + label {
    font-size: 12px;
    padding: 2px 4px 2px 24px;
  }
  input[type="checkbox"] + label::before {
    width: 16px;
    height: 16px;
    left: 3px;
  }
  .reset-button {
    padding: 6px 12px;
    font-size: 10px;
    min-width: 70px;
    bottom: 10px;
    right: 10px;
  }
  .adsense-ad {
    margin: 8px 0;
  }
  .adsense-ad ins {
    padding: 0 2px;
  }
}

/* デスクトップ対応（769px以上） */
@media screen and (min-width: 769px) {
  .image-item {
    height: auto;
    width: 208px;
  }
}

/* detailsとsummaryのスタイル (friend.css から持ってきたスタイルをベースに調整) */
.form-section-details {
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 25px;
  background-color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.form-section-summary {
  cursor: pointer;
  font-weight: bold;
  list-style-position: inside; /* summaryのマーカーを内側に */
  outline: none;
  transition: background-color 0.2s ease;
  padding: 0; /* summary自体のpaddingはボタン側で制御 */
  margin: 0; /* summary自体のmarginはボタン側で制御 */
}

.form-section-summary h3 {
  display: inline;
  margin: 0;
  font-size: 1.1em; /* ボタン内のテキストサイズ */
}

/* ポップなボタンスタイル (friend.css から持ってきたスタイル) */
.summary-button {
  display: block;
  padding: 12px 20px;
  text-align: center;
  border-radius: 25px; /* detailsが閉じているときの角丸 */
  color: white;
  font-size: 1.2em;
  font-weight: bold;
  text-shadow: 1px 1px 1px rgba(0,0,0,0.2);
  box-shadow: 0 4px 6px rgba(0,0,0,0.1), inset 0 -2px 2px rgba(0,0,0,0.1);
  transition: transform 0.1s ease-out, box-shadow 0.1s ease-out, background-color 0.2s ease;
  border-bottom: none; /* summaryなので不要 */
  margin: 0; /* summaryなので不要 */
}

.summary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 8px rgba(0,0,0,0.15), inset 0 -2px 2px rgba(0,0,0,0.1);
}

.summary-filter { /* 絞り込みボタンの色 */
  background-color: #3498db; /* 青系 (friend_board.php の検索ボタンに合わせる) */
}

.summary-exclusion-filter { /* 除外フィルターボタンの色 */
  background-color: #e74c3c; /* 赤系 */
}

.form-section-details[open] > .form-section-summary.summary-button {
  border-bottom: 1px solid #e0e0e0; /* 開いたときに下に線 */
  border-radius: 8px 8px 0 0; /* 開いたときの角丸 */
}

/* NEW! バッジのスタイル */
.new-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #ff4500; /* オレンジレッド系 */
    color: white;
    padding: 3px 6px;
    font-size: 0.8em;
    font-weight: bold;
    border-radius: 4px;
    z-index: 10; /* 画像の上に表示するため */
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* カスタム評価セクション */
.summary-custom-sort {
    background-color: #4CAF50; /* 例: 緑色 */
    color: white;
}

.custom-sort-container {
    padding: 15px;
    border-top: 1px solid #ddd;
}

.custom-sort-description {
    margin-bottom: 15px;
    line-height: 1.6;
}

.custom-sort-fieldset {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    background-color: #f9f9f9;
}

.custom-sort-fieldset legend {
    font-weight: bold;
    font-size: 1.1em;
    padding: 0 10px;
    margin-left: 10px;
    color: #333;
}

.custom-sort-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px 10px; /* 既存のgapを維持 */
}

/* レッスンカテゴリ専用のグリッド設定 */
.custom-sort-lesson-grid {
    grid-template-columns: repeat(3, 1fr);
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    margin-bottom: 5px;
    font-size: 0.9em;
    font-weight: bold;
}

.input-group input {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.custom-sort-actions {
    margin-top: 20px;
    text-align: center;
}

.custom-sort-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 15px 0 0;
    padding: 10px;
    background-color: #f0f8ff;
    border: 1px solid #bde0fe;
    border-radius: 8px;
}

.custom-sort-toggle-container label {
    font-weight: bold;
    cursor: pointer;
    padding-left: 0; /* カスタムチェックボックス用のパディングをリセット */
}

.template-button-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.template-btn {
    background-color: #5d6d7e; /* テンプレートボタン用の色 */
    font-size: 14px;
}

