/* ------------------------------
 🏇 競馬アラーム スタイルシート
 2025/11 対応版（ナイトモード・残り時間対応）
------------------------------ */

/* 🔤 基本レイアウト */
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: #2b6cb0;
  font-size: 1.3rem;
  margin-top: 18px;
  margin-bottom: 6px;
}

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

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

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

/* 🔔 次に通知予定表示 */
#nextNotifyInfo {
  background: #eaf6ff;
  color: #003366;
  border: 2px solid #b5d6f2;
  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: #f5f5f5; /* 柔らかい白（目に優しい） */
  font-weight: 600;
}

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

/* 🧭 デバッグパネル */
#debugPanel {
  margin-top: 30px;
  background: #f4f4f4;
  border-top: 2px solid #ccc;
  padding: 10px;
  font-family: monospace;
  font-size: 14px;
}
/* 🏇 開催場ブロック */
.venue {
  flex: 1;
  min-width: 280px;
  max-width: 380px;
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 10px;
  box-sizing: border-box;
  transition: background 0.3s;
}

/* 🌙 ナイトモード対応 */
body.dark-mode .venue {
  background: #1b1b1b;
  border-color: #444;
}
/* ------------------------------
 🌙 ナイトモード
------------------------------ */

body.dark-mode {
  background-color: #121212;
  color: #e5e5e5;
}

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

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

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

body.dark-mode #nextNotifyInfo {
  background: #1e2a35;
  color: #d8ecff;
  border: 1px solid #444;
}

body.dark-mode button {
  background: #3c6eb4;
}

body.dark-mode button:hover {
  background: #244d8a;
}

body.dark-mode #debugPanel {
  background: #1a1a1a;
  border-color: #444;
  color: #aaa;
}
/* ------------------------------
 🪧 広告バナーエリア
------------------------------ */

#adArea {
  position: fixed;
  left: 0;
  top: 0;
  width: 300px;
  height: 100vh;
  background: #f9f9f9;
  border-right: 2px solid #ddd;
  padding: 10px;
  box-sizing: border-box;
  overflow-y: auto;
}

#adArea h3 {
  text-align: center;
  font-size: 1rem;
  color: #444;
  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: #ccc;
}

/* 📱 モバイル時（600px以下）は下部に移動 */
@media (max-width: 1000px) {
  #adArea {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-top: 2px solid #ccc;
    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 > div:first-child {
  font-weight: bold;
}

#trackListArea label {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* 🌙 タイトルより上・右上配置（修正版） */
/* 💡 ページ最上部に自然に配置されるヘッダー */
#headerBar {
  position: relative; /* ← absoluteを解除 */
  top: 0;
  left: 0;     /* ← 広告分だけ右にずらす */
  right: 0;        /* ← 右端まで広げる */
  width: auto;     /* ← 自動調整 */
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  background: linear-gradient(to right, #f9f9f9, #eef5ff);
  border-bottom: 1px solid #ccc;
  padding: 10px 20px;
  border-radius: 0 0 8px 8px;
  box-sizing: border-box;
  z-index: 50;
}

/* 💡 ヘッダー背景を追加（オプション） */
#headerBar {
  background: linear-gradient(to right, #f9f9f9, #eef5ff);
  border-bottom: 1px solid #ccc;
  padding: 8px 20px;
  border-radius: 0 0 8px 8px;
}
/* 🌙 ナイトモード対応 */
body.dark-mode #headerBar {
  background: linear-gradient(to right, #1a1a1a, #2a2a2a);
  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: #ff7b00;
  color: white;
}

/* 🌙 ナイトモードボタン */
#nightModeButton {
  background: #2b6cb0;
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.3s;
}

#nightModeButton:hover {
  background: #1e4e85;
}

/* 🌙 ナイトモード時（リンクも調整） */
body.dark-mode #localLink {
  background: #444;
  color: #ddd;
}
body.dark-mode #localLink:hover {
  background: #c98232;
  color: #fff;
}

body.dark-mode #nightModeButton {
  background: #3c6eb4;
}
body.dark-mode #nightModeButton:hover {
  background: #244d8a;
}


/* 💾 設定を保存ボタンを緑系カラーに変更 */
#saveSettings {
  background: #2e8b57; /* 深めのグリーン（シーグリーン） */
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  transition: background 0.3s;
}
#saveSettings:hover {
  background: #3cb371; /* 少し明るめのグリーン */
}
/* 🌙 ナイトモード時（落ち着いたグリーン） */
body.dark-mode #saveSettings {
  background: #3ba165;
}
body.dark-mode #saveSettings:hover {
  background: #48c67b;
}
