/* ------------------------------
 🏇 地方競馬アラーム オレンジテーマ＋淡い琥珀ナイトモード
 （レイアウト・構造変更なし）
------------------------------ */

/* 🔤 基本レイアウト */
body {
  font-family: "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  background-color: #ffffff;
  color: #222;
  margin: 0;
  padding: 20px;
  line-height: 1.6;
  transition: background-color 0.4s, color 0.4s;
}

h1, h2, h3 {
  margin: 8px 0;
}

/* 🧭 コンテナ */
#container {
  margin-top: 15px;
}

/* 🏇 開催場タイトル */
h2 {
  color: #ff7b00;
  font-size: 1.3rem;
  margin-top: 18px;
  margin-bottom: 6px;
}

/* 🕒 レース時刻ブロック */
.race-time {
  font-size: 1rem;
  padding: 6px 10px;
  border-bottom: 1px solid #ffd6a5;
  transition: color 0.3s, background-color 0.3s;
}

/* 発送済み（グレーアウト） */
.race-time.notified {
  color: #999;
}

/* ⏱ 残り時間 */
.countdown {
  color: #ff7b00;
  font-weight: 500;
}

/* 🔔 次に通知予定表示 */
#nextNotifyInfo {
  background: #fff4e5;
  color: #663300;
  border: 2px solid #ffb347;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
  font-weight: bold;
  font-size: 1rem;
  transition: all 0.4s ease;
}

/* 📅 使用中データ */
#loadedFileInfo {
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
}
body.dark-mode #loadedFileInfo {
  color: #f5e4c1;
  font-weight: 600;
}

/* ⚙️ 設定エリア */
button {
  background: #ff7b00;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  margin-right: 6px;
  transition: background 0.3s;
}
button:hover {
  background: #e56700;
}

/* 🧭 デバッグパネル */
#debugPanel {
  margin-top: 30px;
  background: #fff8f0;
  border-top: 2px solid #ffd6a5;
  padding: 10px;
  font-family: monospace;
  font-size: 14px;
}

/* 🏇 開催場ブロック */
.venue {
  flex: 1;
  min-width: 280px;
  max-width: 380px;
  background: #fffaf5;
  border: 1px solid #ffd6a5;
  border-radius: 8px;
  padding: 10px;
  box-sizing: border-box;
  transition: background 0.3s;
}

/* 🌙 ナイトモード（琥珀トーン） */
body.dark-mode {
  background-color: #121212;
  color: #f0e0b0;
}

body.dark-mode h2 {
  color: #f0c67f;
}

body.dark-mode .race-time {
  border-bottom: 1px solid #333;
}

body.dark-mode .countdown {
  color: #eacb95;
}

body.dark-mode #nextNotifyInfo {
  background: #1e1e1e;
  color: #e8d4a2;
  border: 1px solid #555;
}

body.dark-mode button {
  background: #c98232;
  color: #fff;
}
body.dark-mode button:hover {
  background: #a36d32;
}

body.dark-mode #saveSettings {
  background: #e0b060;
  color: #fff;
}
body.dark-mode #saveSettings:hover {
  background: #f0c67f;
}

body.dark-mode #debugPanel {
  background: #1a1a1a;
  border-color: #444;
  color: #aaa;
}

/* 🪧 広告バナーエリア */
#adArea {
  position: fixed;
  left: 0;
  top: 0;
  width: 300px;
  height: 100vh;
  background: #fff8f0;
  border-right: 2px solid #ffd6a5;
  padding: 10px;
  box-sizing: border-box;
  overflow-y: auto;
}
#adArea h3 {
  text-align: center;
  font-size: 1rem;
  color: #663300;
  margin-bottom: 10px;
}
.ad-slot {
  text-align: center;
  margin-bottom: 12px;
}
.ad-slot img {
  width: 100%;
  border-radius: 6px;
  box-shadow: 0 0 4px rgba(0,0,0,0.1);
}

/* メインエリア右ずらし */
body {
  margin-left: 320px;
}
body.dark-mode #adArea {
  background: #1a1a1a;
  border-color: #333;
}
body.dark-mode #adArea h3 {
  color: #f0c67f;
}

/* 📱 モバイル対応 */
@media (max-width: 1000px) {
  #adArea {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-top: 2px solid #ffd6a5;
    margin-top: 20px;
  }
  body {
    margin-left: 0;
    padding: 12px;
    font-size: 15px;
  }

  h2 {
    font-size: 1.1rem;
  }

  .race-time {
    padding: 4px 6px;
  }

  #nextNotifyInfo {
    font-size: 0.95rem;
    padding: 8px 10px;
  }

  button {
    padding: 5px 10px;
    font-size: 0.9rem;
  }
}
/* ------------------------------
 📱 スマホで広告を下に移動（完全版）
------------------------------ */
@media (max-width: 1000px) {
  body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 12px;
  }
  #headerBar {
    position: relative;
    left: 0;
    width: 100%;
    text-align: center;
    justify-content: center;
    margin: 10px 0;
  }

  h1 {
    margin-top: 10px; /* モバイル時の余白 */
  }

  main {
    flex: 1;
    order: 1; /* 本文を上に */
  }

  #adArea {
    order: 2; /* 広告を下に */
    position: relative; /* 固定解除 */
    width: 100%;
    height: auto;
    border-right: none;
    border-top: 2px solid #ccc;
    margin-top: 20px;
    background: #f9f9f9;
  }

  body.dark-mode #adArea {
    background: #1a1a1a;
    border-color: #333;
  }

  /* 広告画像がはみ出さないように */
  .ad-slot img {
    max-width: 100%;
    height: auto;
    display: block;
  }
}
/* ------------------------------
 📱 通知設定をスマホ時に縦並びにする
------------------------------ */
@media (max-width: 1000px) {
  #settings {
    display: flex;
    flex-direction: column; /* 縦方向に並べる */
    align-items: flex-start;
    gap: 10px;              /* 各ブロックの間に余白 */
  }

  /* 子要素をブロック化して自然に改行 */
  #settings select,
  #settings label {
    display: block;
    width: 100%;            /* 幅いっぱいに広げる（見やすく） */
    margin-bottom: 6px;
  }

  /* ラベル行全体の調整（横並び崩し） */
  #settings label input[type="checkbox"] {
    margin-right: 6px;
  }
}

/* 🏇 通知する競馬場エリア */
#trackListArea {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
#trackListArea label {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 💡 ヘッダー */
#headerBar {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  width: auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  background: linear-gradient(to right, #fff5eb, #ffe1bf);
  border-bottom: 1px solid #ffd6a5;
  padding: 10px 20px;
  border-radius: 0 0 8px 8px;
  box-sizing: border-box;
  z-index: 50;
}
body.dark-mode #headerBar {
  background: linear-gradient(to right, #1a1a1a, #222);
  border-color: #333;
}

/* 地方競馬リンク */
#localLink {
  background: #e0e0e0;
  color: #333;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: bold;
  transition: background 0.3s, color 0.3s;
}
#localLink:hover {
  background: #2b6cb0;
  color: white;
}
body.dark-mode #localLink {
  background: #444;
  color: #ddd;
}
body.dark-mode #localLink:hover {
  background: #3c6eb4;
  color: #fff;
}

/* 🌙 ナイトモードボタン */
#nightModeButton {
  background: #ff7b00;
  color: white;
}
#nightModeButton:hover {
  background: #e56700;
}
body.dark-mode #nightModeButton {
  background: #c98232;
}
body.dark-mode #nightModeButton:hover {
  background: #a36d32;
}

/* 💾 設定を保存ボタン（オレンジ強調） */
#saveSettings {
  background: #ffb347;
  color: #fff;
  font-weight: 600;
}
#saveSettings:hover {
  background: #ff9933;
}
body.dark-mode #saveSettings {
  background: #e0b060;
}
body.dark-mode #saveSettings:hover {
  background: #f0c67f;
}
