/* MotoTOPICS Deep Ocean デザインシステム (モック v5 準拠・Case A 確定) */

:root {
  --bg: #1D3557;
  --bg-2: #22406A;
  --accent: #457B9D;
  --accent-hover: #5F94B5;
  --card: #F1FAEE;
  --text-on-bg: #F1FAEE;
  --text-on-card: #1D3557;
  --muted-on-card: #6B7A8A;
  --border: #A8DADC;
  --disabled: #C9CED4;
  --danger: #E63946;
  --success: #2E7D32;
  --google: #4285F4;
  --shadow: 0 2px 6px rgba(0,0,0,0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-on-bg);
  font-family: "Hiragino Sans", "Yu Gothic UI", -apple-system, BlinkMacSystemFont, "Noto Sans JP", sans-serif;
  -webkit-tap-highlight-color: transparent;
  font-feature-settings: "palt" 1;
}

main {
  padding: 12px 16px 20px;
  padding-top: max(12px, env(safe-area-inset-top, 12px));
  padding-bottom: max(20px, env(safe-area-inset-bottom, 20px));
  min-height: 100vh;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.header {
  text-align: center;
  padding: 4px 0 6px;
  flex-shrink: 0;
}
.brand {
  font-family: "Hiragino Mincho ProN", "YuMincho", serif;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.14em;
}
.subtitle {
  font-size: 10px;
  color: var(--border);
  margin-top: 3px;
  letter-spacing: 0.03em;
}

/* --- Screens --- */
.screen {
  display: none;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.screen.active { display: flex; animation: fadein 0.2s ease-out; }
@keyframes fadein {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Spacer + op-area (親指エリア: 一番下から 1ボタン分だけ上) --- */
.spacer { flex: 1; min-height: 16px; }

.op-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  padding-bottom: 64px;
}

.op-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--border);
  letter-spacing: 0.05em;
  padding-left: 2px;
  margin: 0;
}

.op-hint {
  font-size: 9px;
  color: var(--border);
  opacity: 0.7;
  padding-left: 2px;
  margin: 0;
}

/* --- Card (顧客情報表示) --- */
.card {
  background: var(--card);
  color: var(--text-on-card);
  border-radius: 10px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.customer-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(29,53,87,0.1);
}
.customer-line:last-child { border-bottom: none; padding-bottom: 0; }
.label {
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
}
.value {
  font-size: 14px;
  font-weight: 600;
}

/* --- Buttons --- */
.btn-primary, .btn-secondary, .btn-google {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.1s;
}
.btn-primary {
  background: var(--accent);
  color: var(--card);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
  background: var(--disabled);
  cursor: not-allowed;
}
.btn-secondary {
  background: transparent;
  color: var(--card);
  border: 1px solid var(--border);
}
.btn-secondary:active { opacity: 0.7; }

.btn-google {
  background: #FFFFFF;
  color: var(--google);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.g-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(90deg, #4285F4 25%, #34A853 25% 50%, #FBBC05 50% 75%, #EA4335 75%);
  color: transparent;
  font-size: 10px;
}

/* --- Date grid --- */
.date-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.date-cell {
  background: var(--card);
  color: var(--text-on-card);
  border-radius: 6px;
  padding: 6px 0;
  text-align: center;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.1s;
  position: relative;
}
.date-cell:not(.disabled):not(.blocked):active {
  transform: scale(0.95);
  border-color: var(--accent);
}
.date-cell.selected {
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 700;
}
.date-cell.selected .date-day { color: rgba(255,255,255,0.85); }
.date-cell.today::before {
  content: "";
  position: absolute;
  top: 3px;
  right: 4px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.date-cell.disabled { opacity: 0.25; cursor: not-allowed; }
.date-cell.blocked {
  background: rgba(241,250,238,0.12);
  color: rgba(241,250,238,0.4);
  cursor: not-allowed;
}
.date-cell.blocked::after {
  content: "休";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 15px;
  font-weight: 700;
  color: var(--border);
  opacity: 0.55;
}
.date-cell .date-num {
  font-weight: 700;
  font-size: 12px;
  display: block;
}
.date-cell .date-day {
  font-size: 9px;
  color: var(--accent);
  margin-top: 1px;
  display: block;
}
.date-cell.sunday .date-day { color: var(--danger); }
.date-cell.saturday .date-day { color: #4A90D9; }

/* --- Slot grid --- */
.slots-scroll {
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
}
.slots-scroll::-webkit-scrollbar { width: 3px; }
.slots-scroll::-webkit-scrollbar-track { background: transparent; }
.slots-scroll::-webkit-scrollbar-thumb { background: rgba(241,250,238,0.2); border-radius: 2px; }

.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.slot {
  background: var(--card);
  color: var(--text-on-card);
  border-radius: 6px;
  padding: 9px 0;
  text-align: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  transition: transform 0.1s;
}
.slot:not(.busy):active { transform: scale(0.95); }
.slot.selected {
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 700;
}
.slot.busy {
  background: rgba(241,250,238,0.12);
  color: rgba(241,250,238,0.4);
  cursor: not-allowed;
  text-decoration: line-through;
}
.slots-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 12px;
  color: var(--border);
  font-size: 13px;
  line-height: 1.6;
}

/* --- Confirm screen (顧客情報カード＋備考入力) --- */
.confirm-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(29,53,87,0.1);
}
.confirm-line:last-child { border-bottom: none; padding-bottom: 0; }

.note-label {
  display: block;
  margin-top: 12px;
  font-size: 11px;
  color: var(--border);
  font-weight: 500;
}
.note-label textarea,
.note-label > textarea {
  display: block;
  width: 100%;
  min-height: 60px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  color: var(--text-on-card);
  background: white;
  box-sizing: border-box;
}

/* --- Done screen --- */
.done-screen {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 12px 8px;
  flex: 1;
  justify-content: flex-start;
}
.done-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  animation: pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-weight: 700;
}
@keyframes pop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}
.done-title {
  font-family: "Hiragino Mincho ProN", "YuMincho", serif;
  font-size: 18px;
  font-weight: 400;
}
.done-text {
  font-size: 12px;
  color: var(--border);
  line-height: 1.7;
}

.done-detail {
  margin-top: 8px;
  padding: 12px 14px;
  background: rgba(241,250,238,0.06);
  border-radius: 8px;
  width: 100%;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 12px;
  display: grid;
  gap: 6px;
  text-align: left;
}
.done-detail-row {
  display: flex;
  justify-content: space-between;
}
.done-detail-row span:first-child { color: var(--border); }

.reminder-note {
  background: rgba(69, 123, 157, 0.15);
  border: 1px solid rgba(168, 218, 220, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  text-align: left;
  font-size: 11px;
  color: var(--border);
  line-height: 1.5;
  width: 100%;
  margin-top: 4px;
}
.reminder-note .r-icon {
  font-size: 14px;
  flex-shrink: 0;
}
.reminder-note strong { font-weight: 600; color: var(--text-on-bg); }

.done-actions {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  padding-top: 12px;
  padding-bottom: 32px;
  flex-shrink: 0;
}

/* --- Loading & Error --- */
.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 60px auto 20px;
  animation: spin 0.8s linear infinite;
}
.loading-text {
  text-align: center;
  color: var(--border);
}
@keyframes spin { to { transform: rotate(360deg); } }

#error-message { color: var(--danger); margin-bottom: 12px; }

/* --- Section title (deprecated but kept for legacy) --- */
.section-title {
  font-size: 12px;
  font-weight: 600;
  padding-left: 2px;
  margin: 0 0 6px;
  letter-spacing: 0.03em;
}
