/* style.css (mobile-first, overflow-safe) */

:root{
  color-scheme: light;
  --bg:#f6f7fb;
  --card:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --border:#e5e7eb;
  --primary:#2563eb;
  --primary2:#7c3aed;
  --shadow: 0 12px 30px rgba(0,0,0,.08);
  --radius:16px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; max-width:100%; overflow-x:hidden; }

body{
  margin:0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP",
               "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  color:var(--text);
  background: radial-gradient(1200px 600px at 10% 0%, #eef2ff 0%, transparent 60%),
              radial-gradient(900px 500px at 90% 10%, #f3e8ff 0%, transparent 55%),
              var(--bg);
}

/* --- Top bar --- */
.topbar{
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,.82);
  border-bottom: 1px solid var(--border);
}

.brand{
  display:block;
  margin:0 auto;
  padding:14px 16px;
  font-weight:800;
  text-decoration:none;
  color:var(--text);
  letter-spacing:.02em;
  max-width: 980px;
}

/* --- Layout --- */
.container{
  width: 100%;
  max-width: 980px;
  margin: 16px auto 48px;
  padding: 0 14px;
}

h1{ margin: 18px 0 14px; font-size: 22px; }
h2{ margin: 0 0 12px; font-size: 18px; }

.card{
  width:100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin: 14px 0;
}

.muted{ color:var(--muted); font-size: 13px; line-height: 1.7; }

/* --- Forms (no overflow) --- */
label{ font-weight:700; color:#374151; }

input, textarea, select{
width:100%;
  max-width:100%;
  min-width:0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 16px; /* iOSã®åæãºã¼ã é²æ­¢ */
  background:#fff;
  outline:none;

  color: var(--text);
  -webkit-text-fill-color: var(--text);
}

input::placeholder,
textarea::placeholder{
  color: #9ca3af;
  opacity: 1;
  -webkit-text-fill-color: #9ca3af;
}

input[type="date"]{
  min-width:0;
  width:100%;
  max-width:100%;
}

input:focus, textarea:focus, select:focus{
  border-color: rgba(37,99,235,.55);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

.row{
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
  margin: 10px 0;
}

.row > label{
  flex: 0 0 110px;
  min-width: 90px;
}

.row > input,
.row > select,
.row > textarea{
  flex: 1 1 0;
  min-width: 0;
}

/* --- People (adults/children) layout --- */
.peopleSplit{
  width:100%;
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
}
.peopleBox{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:6px;
}
.peopleBox label{
  font-weight:800;
  color:#6b7280;
  font-size:13px;
}
@media (max-width: 520px){
  .peopleSplit{ grid-template-columns: 1fr; }
}

/* --- Buttons --- */
.actions{
  display:flex;
  flex-wrap:wrap;
  gap: 10px;
  align-items:center;
  margin-top: 12px;
}

button{
  border: 1px solid var(--border);
  background: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  cursor:pointer;
  font-weight:800;
}

button:hover{ filter: brightness(0.98); }
button:disabled{ opacity:.6; cursor:not-allowed; }

button.primary{
  border: none;
  color:#fff;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  box-shadow: 0 10px 22px rgba(37,99,235,.22);
}

/* --- Slot cards --- */
.slot{
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin: 10px 0;
  background: #ffffff;
}

.slot-time{
  font-weight: 900;
  letter-spacing: .02em;
  font-size: 16px;
}

/* --- Summary chips (wrap-safe) --- */
.slot-head{
  display:flex;
  flex-wrap:wrap;
  gap:12px 14px;
  align-items:flex-start;
  justify-content:space-between;
}

.seatSummary{
  display:grid;
  gap:8px;
  max-width: 100%;
}

.seatRow{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
  justify-content:flex-start; /* ã¢ãã¤ã«ã¯å·¦å¯ãã§æãè¿ã */
}

.seatTag{
  font-size:12px;
  font-weight:900;
  padding:6px 12px;
  border-radius:999px;
  color:#fff;
  background:#111827;
}

.seatTag.reserved{ background:#ef4444; }

.seatChip{
  font-size:13px;
  padding:7px 12px;
  border:1px solid var(--border);
  border-radius:999px;
  background:#fff;
  max-width: 100%;
}

/* --- Admin: seat inputs grid (wrap-safe) --- */
.seatgrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:12px;
  align-items:start;
  width:100%;
}

.seatitem{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:0;
}

.seatitem .label{
  white-space: normal;
  min-width:0;
}

.seatactions{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:center;
  justify-content:flex-end;
  width:100%;
  grid-column: 1 / -1; /* æ¨ªå¹ãã£ã±ã */
}

/* --- Link buttons (customer pages) --- */
a.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 14px;
  border-radius:12px;
  border:1px solid var(--border);
  background:#fff;
  color:var(--text);
  font-weight:800;
  text-decoration:none;
}

a.btn:hover{ filter: brightness(0.98); }

a.btn.primary{
  border:none;
  color:#fff;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  box-shadow: 0 10px 22px rgba(37,99,235,.22);
}

.badge{
  display:inline-block;
  font-size:12px;
  font-weight:900;
  padding:6px 10px;
  border-radius:999px;
  color:#fff;
  background:#ef4444;
}

/* --- Mobile: form rows stack earlier (phones/tablets) --- */
@media (max-width: 768px){
  /* ラベル・入力が横並びで潰れるのを防ぐ */
  .row{ flex-direction: column; align-items: stretch; }
  .row > label{ flex: 0 0 auto; min-width:0; white-space: normal; }

  /* 日本語が上下で欠ける／文字色が消える端末対策（iOS Safari対策） */
  input, select, textarea{
    min-height: 52px;
    padding: 14px 12px;
    line-height: 1.4;
    font-size: 16px;
    color: #111827 !important;
    background-color: #ffffff !important;
    -webkit-text-fill-color: #111827 !important;
  }
  select{ padding-right: 38px; }
}

/* --- Mobile tweaks --- */
@media (max-width: 560px){
  .container{ padding: 0 12px; }
  .row{ flex-direction: column; align-items: stretch; }
  .row > label{ flex: 0 0 auto; min-width:0; }
  .actions button{ width: 100%; }
  .seatgrid{ grid-template-columns: 1fr; }
  .seatactions{ justify-content:flex-start; }
}

/* =========================
   æ¥ä»ãã¼ï¼label + dateï¼ãºã¬ä¿®æ­£
   ========================= */

/* æ¥ä»è¡ã ãã2ååºå®ãã«ããï¼ã¹ããã§ãå´©ããªãï¼ */
#dateRow{
  display: grid !important;
  grid-template-columns: 84px 1fr; /* â ã©ãã«å¹ãå¿è¦ãªã 70ã110ã§èª¿æ´ */
  gap: 10px;
  align-items: center;
}

/* ã©ãã«ãä¸ä¸ã«ãºã¬ãªãããã« */
#dateRow > label{
  margin: 0 !important;
  line-height: 1.2;
  white-space: nowrap;
}

/* date ãã¯ã¿åºãããå³ã«å¯ã£ããããã®ãæ­¢ãã */
#dateRow > input[type="date"]{
  width: 100%;
  min-width: 0 !important;
  max-width: 100%;
  height: 44px;               /* ãã¼ã®é«ããåºå® */
  padding: 10px 12px;
  line-height: 1.2;
  display: block;
  font-size: 16px;            /* iOSã®èªåãºã¼ã å¯¾ç­ */
  -webkit-appearance: none;
  appearance: none;
}

/* =========================
   ã¯ã¼ãã³æ¬æï¼å¹ã¯ä»ã¨æããï¼
   ========================= */
#cBody{
  /* å¹ã¯ .row > textarea (flex: 1 1 0) ã«ä»»ãã â ã¿ã¤ãã«/æéã¨åãåå¹ã«ãªã */
  min-height: 160px;
  line-height: 1.6;
  resize: vertical;
}


select option{ color: var(--text); }


/* --- People split (adults/children) --- */
.peopleSplit{
  display:flex;
  gap:12px;
  width:100%;
  flex: 1 1 0;
  min-width: 0;
}
.peopleBox{
  flex:1 1 0;
  min-width:0;
}
.subLabel{
  display:block;
  font-weight:700;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}


/* IOS_MOBILE_FORM_FIX */
@media (max-width: 560px){
  /* iOS Safariã§select/textareaãæ½°ãããæå­ãæ¶ããå¯¾ç­ */
  select{
    min-height:48px;
    height:auto;
    padding: 11px 12px;
    line-height: 1.2;
    color: var(--text) !important;
    -webkit-text-fill-color: var(--text) !important;
    background:#fff;
  }
  textarea{
    min-height:120px;
    height:auto;
    line-height:1.6;
  }
  #note{ min-height:120px; }

  .peopleSplit{ flex-direction: column; }
}

/* =========================
   MOBILE FORM BAR FIX v3
   - iOS/Androidでラベル&選択バーが潰れる/文字が欠ける/消える対策
   ========================= */
@media (max-width: 900px){
  /* 横並びを強制終了：スマホは縦積み */
  .row{
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: stretch;
  }
  .row > label{
    flex: none;
    min-width: 0;
    white-space: normal;
    line-height: 1.4;
  }

  /* フォーム部品の高さと文字色を強制（ダークモードで文字が消える端末対策） */
  input, textarea, select{
    min-height: 52px;
    padding: 14px 12px;
    line-height: 1.4;
    font-size: 16px;
    color: #111827 !important;
    background-color: #ffffff !important;
    -webkit-text-fill-color: #111827 !important;
  }

  /* selectの上下欠け対策：line-heightを上げる */
  select{
    line-height: 1.5 !important;
  }

  /* 人数（大人/子供）は2列→縦（スマホ） */
  .peopleSplit{ flex-direction: column; }
}
