/* 電動レンタサイクル予約カレンダーのスタイル定義 */

:root {
  /* 配色をまとめて管理するためのカラー変数 */
  --color-primary: #059669;      /* メインカラー（緑系） */
  --color-primary-dark: #047857;
  --color-accent: #2563eb;
  --color-border: #d1d5db;
  --color-text: #1f2937;
  --color-muted: #6b7280;
  --color-free-hover: #ecfdf5;
  --color-danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  color: var(--color-text);
  background: #f3f4f6;
}

/* ヘッダー */
.app-header {
  background: var(--color-primary);
  color: #fff;
  padding: 20px 24px;
  text-align: center;
}

.app-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.subtitle {
  margin: 6px 0 0;
  font-size: 0.9rem;
  opacity: 0.95;
}

/* メインコンテナ（.container はサイト共通ヘッダー等と衝突するため予約画面は .app-container を使用） */
.app-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* 汎用の非表示クラス */
.hidden {
  display: none;
}

/* 管理者ボタンを置く上部バー（右寄せ） */
.calendar-topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

/* 無効化されたボタン */
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* 管理者向け設定エリア（定休日トグルなど） */
.admin-controls {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.admin-controls .checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: bold;
  cursor: pointer;
}

/* 月移動のヘッダー */
.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.calendar-controls h2 {
  margin: 0;
  font-size: 1.3rem;
}

/* ボタン共通（サイト共通ヘッダーのボタンに影響しないよう範囲を限定） */
.app-container button,
.app-header button,
.modal-overlay button {
  cursor: pointer;
  font-size: 0.95rem;
  padding: 10px 16px;
  border-radius: 6px;
  border: none;
}

.nav-btn {
  background: #e5e7eb;
  color: var(--color-text);
}

.nav-btn:hover:not(:disabled) {
  background: #d1d5db;
}

/* 管理者ログインボタン */
.admin-btn {
  background: #e5e7eb;
  color: var(--color-text);
  font-size: 0.85rem;
}

.admin-btn:hover {
  background: #d1d5db;
}

.admin-btn.active {
  background: #047857;
  color: #fff;
}

.admin-btn.active:hover {
  background: #065f46;
}

/* カレンダー本体 */
.calendar-wrapper {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

#calendar {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
}

#calendar th {
  background: #f9fafb;
  padding: 10px 0;
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
}

#calendar th.sun { color: #dc2626; }
#calendar th.sat { color: #2563eb; }

#calendar td {
  border: 1px solid var(--color-border);
  height: 84px;
  vertical-align: top;
  padding: 4px;
}

/* 日付マス（クリック可能） */
#calendar td.day {
  cursor: pointer;
  transition: background 0.15s;
}

#calendar td.day:hover {
  background: var(--color-free-hover);
}

/* 月外の空きマス */
#calendar td.empty-day {
  background: #f9fafb;
}

/* 選択できない過去の日 */
#calendar td.disabled-day {
  background: #f9fafb;
  cursor: default;
}

#calendar td.disabled-day:hover {
  background: #f9fafb;
}

#calendar td.disabled-day .day-num {
  color: #cbd5e1;
}

/* 満車で予約できない日 */
#calendar td.full-day {
  cursor: default;
  background: #fef2f2;
}

#calendar td.full-day:hover {
  background: #fef2f2;
}

/* 定休日（火曜）で予約できない日 */
#calendar td.closed-cell {
  cursor: default;
  background: #f3f4f6;
}

#calendar td.closed-cell:hover {
  background: #f3f4f6;
}

/* 日付の数字 */
.day-num {
  font-size: 0.95rem;
  font-weight: bold;
}

.day-num.sun { color: #dc2626; }
.day-num.sat { color: #2563eb; }

/* 本日のマス */
#calendar td.today {
  background: #feffc7;
}

#calendar td.today:hover {
  background: #fef9a8;
}

/* 残り台数バッジ */
.bike-badge {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: bold;
  padding: 3px 8px;
  border-radius: 12px;
}

/* 空きあり */
.bike-badge.available {
  background: var(--color-primary);
  color: #fff;
}

/* 満車 */
.bike-badge.full {
  background: var(--color-danger);
  color: #fff;
}

/* 定休日 */
.bike-badge.closed {
  background: #6b7280;
  color: #fff;
}

/* カレンダー下部のヒント文 */
.calendar-hint {
  margin-top: 14px;
  color: var(--color-muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ===== 月別集計（管理者向け） ===== */
.admin-summary {
  margin-top: 28px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 18px 20px 20px;
}

.summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.summary-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.summary-table-wrapper {
  overflow-x: auto;
}

#summary-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
}

#summary-table th,
#summary-table td {
  border: 1px solid var(--color-border);
  padding: 10px 12px;
  text-align: right;
  font-size: 0.9rem;
}

#summary-table thead th {
  background: #f9fafb;
  text-align: center;
}

#summary-table .s-date {
  text-align: left;
  font-weight: bold;
}

#summary-table .s-empty {
  text-align: center;
  color: var(--color-muted);
}

#summary-table .summary-total td {
  background: #ecfdf5;
  font-weight: bold;
}

.summary-note {
  margin: 12px 0 0;
  font-size: 0.78rem;
  color: var(--color-muted);
}

/* ===== モーダル ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  width: 90%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 12px;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.modal-close-btn {
  background: var(--color-primary);
  border: none;
  font-size: 1rem;
  font-weight: bold;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
}

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

/* 利用日・残り台数の表示 */
.slot-summary {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 0 0 16px;
}

.slot-summary > div {
  display: flex;
  gap: 8px;
  padding: 2px 0;
}

.slot-summary dt {
  margin: 0;
  width: 72px;
  font-size: 0.85rem;
  color: var(--color-muted);
  flex-shrink: 0;
}

.slot-summary dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: bold;
}

/* 管理者：予約一覧 */
.admin-reservations {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: #fafafa;
}

.admin-reservations h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

#reservation-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#reservation-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed #e5e7eb;
  font-size: 0.88rem;
}

#reservation-list li:last-child {
  border-bottom: none;
}

#reservation-list .no-reservation {
  color: var(--color-muted);
  justify-content: flex-start;
}

.res-info {
  flex: 1;
  min-width: 0;
}

.res-cancel {
  background: #fee2e2;
  color: var(--color-danger);
  font-size: 0.8rem;
  padding: 6px 10px;
  flex-shrink: 0;
}

.res-cancel:hover {
  background: #fecaca;
}

/* 満車メッセージ */
.full-message {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 6px;
  padding: 12px 14px;
  font-size: 0.9rem;
  margin: 0 0 12px;
}

/* フォーム */
.modal label {
  display: block;
  font-size: 0.85rem;
  font-weight: bold;
  margin: 12px 0 4px;
}

/* ※ 電話・FAXの type="tel" を忘れずに入れること。
   1 つ抜けるとその欄だけブラウザ既定の幅になり、
   他の入力欄と揃わなくなる（2026-10-22 に実際に起きた）。 */
.modal input[type="text"],
.modal input[type="email"],
.modal input[type="tel"],
.modal select {
  width: 100%;
  padding: 10px;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fff;
}

/* 必須ラベル */
.req {
  display: inline-block;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: bold;
  padding: 1px 6px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 4px;
}

/* 台数の入力（select＋「台」） */
.inline-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-field select {
  width: 100px;
}

/* 料金表示 */
.price-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 10px 14px;
  margin: 16px 0 4px;
}

.price-box span {
  font-size: 0.85rem;
  color: var(--color-muted);
}

.price-box strong {
  font-size: 1rem;
  color: #15803d;
  text-align: right;
}

/* エラー表示 */
.modal-error {
  color: var(--color-danger);
  font-size: 0.85rem;
  margin: 10px 0 0;
}

.modal-error.hidden {
  display: none;
}

/* モーダルのボタン */
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

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

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

.btn-secondary {
  background: #e5e7eb;
  color: var(--color-text);
}

.btn-secondary:hover {
  background: #d1d5db;
}

/* 行先予定（チェックボックスグループ） */
.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 6px 0;
}

.checkbox-group .checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: normal;
  cursor: pointer;
  margin: 0;
}

/* 当地を訪れた回数（ラジオボタングループ） */
.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 6px 0;
}

.radio-group .radio-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: normal;
  cursor: pointer;
  margin: 0;
}

/* 利用規約同意チェックボックス */
.agree-check {
  margin-top: 16px;
  padding: 12px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
}

.agree-check .checkbox-inline {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.9rem;
  font-weight: normal;
  cursor: pointer;
  line-height: 1.5;
}

/* ===== サーバー版での追加分 ===== */

/* 管理者からのお知らせ */
.notice-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

/* 読み込み中・読み込み失敗の表示 */
.calendar-loading {
  margin: 0;
  padding: 14px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-muted);
  background: #fff;
  border-top: 1px solid var(--color-border);
}

.calendar-loading.hidden {
  display: none;
}

/* フッター（管理者ログインへのリンク） */
.app-footer {
  margin-top: 28px;
  text-align: center;
}

.admin-link {
  font-size: 0.8rem;
  color: var(--color-muted);
  text-decoration: none;
}

.admin-link:hover {
  text-decoration: underline;
}

/* 行先予定「その他」の自由記入欄 */
.dest-other {
  margin-top: 6px;
}

.dest-other.hidden {
  display: none;
}

/* 予約完了の表示 */
.done-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 8px;
  padding: 16px 18px;
}

.done-box.hidden {
  display: none;
}

.done-title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: bold;
  color: #047857;
}

.done-detail {
  margin: 0;
}

.done-detail > div {
  display: flex;
  gap: 8px;
  padding: 3px 0;
}

.done-detail dt {
  margin: 0;
  width: 76px;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.done-detail dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: bold;
}

.done-note {
  margin: 12px 0 0;
  font-size: 0.8rem;
  color: var(--color-muted);
  line-height: 1.6;
}

/* ボット対策（Cloudflare Turnstile）の確認欄 */
.turnstile-box {
  margin: 16px 0 4px;
  min-height: 65px;
}

.turnstile-box:empty {
  min-height: 0;
}

/* サイト共通ヘッダー内に組み込んだ際の予約エリア背景 */
.bike-app {
  /*background: #f3f4f6;*/
}
