/* タクシー配車システム 共通スタイル */
:root {
  --ink: #1a2233;
  --ink-sub: #5a6478;
  --bg: #f2f4f8;
  --panel: #ffffff;
  --line: #dde2ec;
  --accent: #f5b301;      /* タクシーイエロー */
  --accent-ink: #232000;
  --primary: #1558d6;
  --danger: #d63a2f;
  --ok: #1d9e55;
  --warn: #e07f00;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(16, 24, 40, .12);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic UI", Meiryo, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }

/* ---- ヘッダー ---- */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--ink); color: #fff;
  position: sticky; top: 0; z-index: 50;
}
.app-header .brand { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.app-header .brand .logo { background: var(--accent); color: var(--accent-ink); border-radius: 6px; padding: 2px 7px; font-size: 13px; }
.app-header .who { font-size: 12px; opacity: .85; margin-right: 10px; }
.app-header .right { display: flex; align-items: center; }

/* ---- ボタン ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 10px; padding: 12px 18px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  background: #e7eaf1; color: var(--ink);
  transition: filter .15s;
}
.btn:hover { filter: brightness(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.accent  { background: var(--accent); color: var(--accent-ink); }
.btn.danger  { background: var(--danger); color: #fff; }
.btn.ok      { background: var(--ok); color: #fff; }
.btn.ghost   { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.btn.small   { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn.block   { width: 100%; }
.btn.xl      { padding: 16px 20px; font-size: 17px; }

/* ---- フォーム ---- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-sub); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 11px 12px; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus { outline: 2px solid var(--primary); border-color: transparent; }
.note { font-size: 12px; color: var(--ink-sub); }
.error-msg { color: var(--danger); font-size: 13px; min-height: 18px; margin: 6px 0; font-weight: 600; }

/* ---- カード/パネル ---- */
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.center-page { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 20px; margin: 0 0 4px; }
.auth-card .sub { font-size: 13px; color: var(--ink-sub); margin-bottom: 18px; }
.auth-card .switch { margin-top: 14px; font-size: 13px; text-align: center; }
a { color: var(--primary); }

/* ---- 地図レイアウト(乗客/ドライバー) ---- */
.map-page { display: flex; flex-direction: column; height: 100dvh; }
.map-wrap { position: relative; flex: 1; min-height: 200px; }
#map { position: absolute; inset: 0; }
.crosshair {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%);
  font-size: 34px; pointer-events: none; z-index: 10;
  text-shadow: 0 2px 4px rgba(0,0,0,.35);
}
.map-topbar {
  position: absolute; top: 10px; left: 10px; right: 10px; z-index: 20;
  display: flex; gap: 8px;
}
.map-topbar input {
  flex: 1; padding: 11px 12px; border: 0; border-radius: 10px;
  box-shadow: var(--shadow); font-size: 14px;
}
.search-results {
  position: absolute; top: 56px; left: 10px; right: 10px; z-index: 30;
  background: #fff; border-radius: 10px; box-shadow: var(--shadow);
  max-height: 40vh; overflow-y: auto;
}
.search-results div { padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--line); cursor: pointer; }
.search-results div:hover { background: #f5f7fb; }

/* ---- 下部シート ---- */
.sheet {
  background: var(--panel); border-radius: 16px 16px 0 0; box-shadow: 0 -4px 16px rgba(16,24,40,.15);
  padding: 16px; z-index: 40;
}
.sheet h2 { font-size: 16px; margin: 0 0 10px; }
.sheet .row { display: flex; gap: 8px; margin-bottom: 8px; }
.sheet .row .btn { flex: 1; }
.point-line { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 6px; }
.point-line .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.point-line .dot.p { background: var(--ok); }
.point-line .dot.d { background: var(--danger); }
.point-line .addr { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-sub); }
.point-line .addr.set { color: var(--ink); font-weight: 600; }

.fare-box {
  display: flex; justify-content: space-between; align-items: center;
  background: #fff8e1; border: 1px solid #f0d98a; border-radius: 10px;
  padding: 10px 14px; margin: 10px 0;
}
.fare-box .amount { font-size: 22px; font-weight: 800; }
.fare-box .meta { font-size: 12px; color: var(--ink-sub); }

/* ---- ステータス表示 ---- */
.status-banner { text-align: center; padding: 6px 0 2px; }
.status-banner .big { font-size: 18px; font-weight: 800; }
.status-banner .sub { font-size: 13px; color: var(--ink-sub); margin-top: 4px; }
.spinner {
  width: 26px; height: 26px; margin: 8px auto; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--primary);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; color: #fff; }
.badge.offline    { background: #8b93a5; }
.badge.available  { background: var(--ok); }
.badge.dispatched { background: var(--warn); }
.badge.in_ride    { background: var(--danger); }
.badge.requested  { background: var(--primary); }
.badge.assigned   { background: var(--warn); }
.badge.arriving   { background: var(--warn); }
.badge.arrived    { background: #7a3fd1; }
.badge.completed  { background: var(--ok); }
.badge.canceled   { background: #8b93a5; }
.badge.no_driver  { background: var(--danger); }

/* ---- オーバーレイ(打診/履歴/完了) ---- */
.overlay {
  position: fixed; inset: 0; background: rgba(10, 14, 24, .55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.overlay.hidden { display: none; }
.overlay .card { width: 100%; max-width: 430px; max-height: 85vh; overflow-y: auto; }
.offer-timer { font-size: 30px; font-weight: 800; text-align: center; color: var(--warn); }

/* ---- 管理画面 ---- */
.admin-layout { display: flex; flex-direction: column; height: 100dvh; }
.tabs { display: flex; gap: 2px; background: var(--ink); padding: 0 8px; overflow-x: auto; }
.tabs button {
  border: 0; background: transparent; color: #aeb6c8; padding: 11px 14px;
  font-size: 13px; font-weight: 700; cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap;
}
.tabs button.active { color: #fff; border-bottom-color: var(--accent); }
.tab-body { flex: 1; overflow: hidden; position: relative; }
.tab-pane { position: absolute; inset: 0; overflow-y: auto; padding: 16px; }
.tab-pane.map-pane { padding: 0; overflow: hidden; }
.tab-pane.hidden { display: none; }

table.list { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); font-size: 13px; }
table.list th { background: #eef1f7; text-align: left; padding: 9px 10px; font-size: 12px; color: var(--ink-sub); white-space: nowrap; }
table.list td { padding: 9px 10px; border-top: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type="date"] { padding: 8px; border: 1px solid var(--line); border-radius: 8px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; }
.form-actions { margin-top: 12px; display: flex; gap: 8px; }

.live-side {
  position: absolute; top: 10px; right: 10px; width: 300px; max-height: calc(100% - 20px);
  overflow-y: auto; z-index: 20; display: flex; flex-direction: column; gap: 8px;
}
.live-card { background: rgba(255,255,255,.96); border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; font-size: 12px; }
.live-card b { font-size: 13px; }

.marker-car {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; box-shadow: 0 2px 6px rgba(0,0,0,.35);
  border: 2px solid #fff; background: var(--ok); cursor: pointer;
}
.marker-car.dispatched { background: var(--warn); }
.marker-car.in_ride { background: var(--danger); }
.marker-car.offline { background: #8b93a5; }
.marker-pin { font-size: 30px; transform: translateY(-40%); text-shadow: 0 2px 4px rgba(0,0,0,.3); }

@media (max-width: 640px) {
  .live-side { width: 46%; }
}
