/* =========================================================
   東京駅ロッカーナビ — スタイル
   モバイル縦画面（片手操作）を最優先に設計
   ========================================================= */

/* ---------- 基本設定 ---------- */
:root {
  --color-bg: #f5f5f7;
  --color-text: #1c1c1e;
  --color-muted: #6b6b6f;
  --color-primary: #2c3e50;
  --color-accent: #1ea7fd;
  --color-deposit: #f6a821;
  --color-border: #e0e0e3;

  /* サイズ別の色（凡例にも使う） */
  --color-small: #3498db;   /* 小: 青 */
  --color-medium: #f39c12;  /* 中: 橙 */
  --color-large: #e74c3c;   /* 大: 赤 */

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--color-accent); }

/* ---------- ヘッダー ---------- */
.app-header {
  background: var(--color-primary);
  color: #fff;
  padding: calc(8px + var(--safe-top)) 12px 8px;
  flex-shrink: 0;
}
.app-header__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* ---------- 道案内バナー ---------- */
.route-banner {
  background: var(--color-deposit);
  color: #fff;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.route-banner[hidden] { display: none; }
.route-banner__close {
  background: rgba(0,0,0,0.15);
  color: #fff;
  border: 0;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- 地図 ---------- */
.map-wrap {
  position: relative;
  flex: 0 0 55vh;     /* 画面の55%を地図に */
  min-height: 280px;
}
.map {
  width: 100%;
  height: 100%;
}
.locate-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 500;
  width: 44px;
  height: 44px;
  border-radius: 22px;
  border: 0;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  font-size: 20px;
  cursor: pointer;
}
.locate-btn:active { background: #e8e8ea; }

/* ---------- ロッカーピン（DivIconで描画） ---------- */
.locker-pin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.locker-pin--small  { background: var(--color-small); }
.locker-pin--medium { background: var(--color-medium); }
.locker-pin--large  { background: var(--color-large); }
.locker-pin--deposited {
  background: var(--color-deposit);
  width: 34px; height: 34px;
  font-size: 18px;
  border-color: #fff;
  box-shadow: 0 2px 8px rgba(246,168,33,0.55);
}

/* 現在地マーカー */
.user-marker {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1ea7fd;
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px rgba(30,167,253,0.5);
}

/* ---------- ヒントバナー ---------- */
.hint-banner {
  padding: 6px 12px;
  background: #fff8e0;
  color: #5b4a00;
  font-size: 12px;
  line-height: 1.4;
  border-top: 1px solid #f0e3a8;
  border-bottom: 1px solid #f0e3a8;
}
.hint-banner.is-error {
  background: #fde2e1;
  color: #7a1f1c;
  border-color: #f3b8b6;
}
.hint-banner.is-ok {
  background: #e6f4ea;
  color: #1f5132;
  border-color: #b8dec3;
}

/* ---------- 操作バー ---------- */
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
}
.controls__group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.chip {
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
  border-radius: 18px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.chip:active { background: #f0f0f3; }
.chip--size.is-active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}
.chip--deposit {
  background: var(--color-deposit);
  color: #fff;
  border-color: var(--color-deposit);
  font-weight: 600;
}
.chip--deposit[disabled] {
  background: #ddd;
  color: #888;
  border-color: #ddd;
  cursor: not-allowed;
}
.sort-select {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 6px 10px;
  background: #fff;
  font-size: 13px;
}

/* ---------- リスト ---------- */
.list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 12px calc(12px + var(--safe-bottom));
  background: var(--color-bg);
  -webkit-overflow-scrolling: touch;
}
.list__empty {
  text-align: center;
  color: var(--color-muted);
  padding: 32px 16px;
  font-size: 14px;
  line-height: 1.6;
}
.card {
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card:active { background: #f0f0f3; }
.card__color {
  width: 10px;
  align-self: stretch;
  border-radius: 5px;
  flex-shrink: 0;
}
.card__color--small  { background: var(--color-small); }
.card__color--medium { background: var(--color-medium); }
.card__color--large  { background: var(--color-large); }
.card__body { flex: 1; min-width: 0; }
.card__title {
  margin: 0 0 2px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.card__meta {
  font-size: 12px;
  color: var(--color-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.card__badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 11px;
  background: var(--color-deposit);
  color: #fff;
  font-weight: 600;
}

/* ---------- 詳細ボトムシート ---------- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
  animation: fadeIn 0.18s ease-out;
}
.sheet-overlay[hidden] { display: none; }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: #fff;
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.18);
  max-height: 80vh;
  overflow-y: auto;
  padding: 8px 16px calc(20px + var(--safe-bottom));
  animation: slideUp 0.22s ease-out;
}
.sheet[hidden] { display: none; }
.sheet__handle {
  width: 40px;
  height: 4px;
  background: #d0d0d3;
  border-radius: 2px;
  margin: 6px auto 12px;
}
.sheet__close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: 0;
  font-size: 24px;
  color: var(--color-muted);
  width: 36px;
  height: 36px;
  cursor: pointer;
}
.sheet h2 {
  margin: 0 30px 8px 0;
  font-size: 16px;
}
.sheet__meta { color: var(--color-muted); font-size: 13px; margin-bottom: 10px; }
.sheet__fee-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
  font-size: 14px;
}
.sheet__fee-table th, .sheet__fee-table td {
  border: 1px solid var(--color-border);
  padding: 6px 8px;
  text-align: center;
}
.sheet__fee-table th { background: #fafafa; font-weight: 600; }
.sheet__row {
  display: flex;
  gap: 6px;
  font-size: 13px;
  margin: 6px 0;
  align-items: flex-start;
}
.sheet__row b { color: var(--color-muted); flex-shrink: 0; min-width: 5em; }
.sheet__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}
.sheet__btn {
  display: block;
  width: 100%;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}
.sheet__btn--primary {
  background: var(--color-deposit);
  color: #fff;
}
.sheet__btn--remove {
  background: #fff;
  color: #c0392b;
  border: 1px solid #e9c0bc;
}
.sheet__btn--ext {
  background: #fff;
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}
.sheet__memo {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 14px;
  margin-top: 6px;
  font-family: inherit;
}
.sheet__sample-note {
  font-size: 11px;
  color: var(--color-muted);
  margin-top: 8px;
  padding: 6px;
  background: #f5f5f7;
  border-radius: 6px;
}

/* ---------- フッター ---------- */
.app-footer {
  flex-shrink: 0;
  padding: 8px 12px calc(8px + var(--safe-bottom));
  text-align: center;
  color: var(--color-muted);
  font-size: 11px;
  background: #fff;
  border-top: 1px solid var(--color-border);
}
.app-footer a { color: var(--color-muted); text-decoration: underline; }

/* ---------- アニメーション ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideUp {
  from { transform: translateY(20%); opacity: 0.6; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ---------- 狭い画面用の微調整 ---------- */
@media (max-height: 600px) {
  .map-wrap { flex: 0 0 50vh; }
}
@media (min-width: 768px) {
  /* PCで開いた時は中央寄せ */
  body { max-width: 480px; margin: 0 auto; box-shadow: 0 0 30px rgba(0,0,0,0.08); }
}
