/* Reserve page module - Material Design 3 Style */

:root {
  --res-side-margin: 20px;
}

@media (max-width: 480px) {
  :root {
    --res-side-margin: 12px;
  }
}

.reserve-container {
  padding: 0 0 100px;
  animation: pageFadeIn 0.4s var(--md-ease);
}

/* 页面标题栏 */
.page-title-bar {
  padding: 24px 20px 12px;
  color: var(--md-text);
}

/* 让预约页标题栏在深色模式下不发白、不穿透 */
#page-reserve .page-title-bar {
  position: sticky;
  top: 0;
  z-index: 120;
  background: color-mix(in srgb, var(--md-surface) 92%, transparent);
  backdrop-filter: blur(var(--md-glass-blur)) saturate(var(--md-glass-sat)) brightness(var(--md-glass-bright));
  -webkit-backdrop-filter: blur(var(--md-glass-blur)) saturate(var(--md-glass-sat)) brightness(var(--md-glass-bright));
  border-bottom: 1px solid var(--md-outline);
  box-shadow: var(--md-elev-1);
}

/* WheelDateTimePicker 深色模式/M3 覆盖：库里大量写死 white/#E8E8E8/#333 */
#wheel-datetime-picker-modal.wheel-datetime-picker-modal {
  background: rgba(0, 0, 0, 0.55) !important;
}

#wheel-datetime-picker-modal .wheel-datetime-picker-container {
  background: var(--md-surface) !important;
  color: var(--md-text) !important;
  border-radius: 20px 20px 0 0 !important;
  border: 1px solid var(--md-outline) !important;
  box-shadow: var(--md-elev-2) !important;
}

/* WheelDateTimePicker 标题文字对比度（库里写死 #333） */
#wheel-datetime-picker-modal .wheel-datetime-picker-container > div:first-child > div {
  color: var(--md-text) !important;
}

#wheel-datetime-picker-modal .wheel-picker-cancel-btn {
  color: var(--md-text-2) !important;
}

#wheel-datetime-picker-modal .wheel-picker-cancel-btn:hover {
  background: var(--md-surface-2) !important;
}

#wheel-datetime-picker-modal .wheel-picker-confirm-btn {
  background: var(--brand-1) !important;
  color: #fff !important;
}

#wheel-datetime-picker-modal .wheel-picker-confirm-btn:hover {
  filter: brightness(0.95);
}

#wheel-datetime-picker-modal .wheel-datetime-picker-container > div:first-child {
  border-bottom: 1px solid var(--md-outline) !important;
}

#wheel-datetime-picker-modal .wheel-highlight {
  border-top: 1px solid var(--md-outline) !important;
  border-bottom: 1px solid var(--md-outline) !important;
}

#wheel-datetime-picker-modal .wheel-item {
  color: var(--md-text-3) !important;
}

#wheel-datetime-picker-modal .wheel-item.selected {
  color: var(--md-text) !important;
}

.title-text-group .main-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--md-text);
  letter-spacing: -0.5px;
}

/* 预约查询区块 - 卡片容器 */
.reservation-query-section {
  margin: 16px var(--res-side-margin);
}

.reservation-table-container {
  background: var(--md-surface);
  border-radius: var(--md-r-lg);
  border: 1px solid var(--md-outline);
  overflow: hidden;
  box-shadow: var(--md-elev-1);
  transition: box-shadow var(--md-dur-2) var(--md-ease);
}

/* 机种标签页 - MD3 Primary Tabs 风格 */
.machine-tabs {
  display: flex;
  background: var(--md-surface-2);
  border-bottom: 1px solid var(--md-outline);
}

.machine-tab {
  flex: 1;
  padding: 14px 4px;
  border: none;
  background: transparent;
  color: var(--md-text-2);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--md-dur-2) var(--md-ease);
  position: relative;
}

.machine-tab::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 3px;
  background: var(--brand-1);
  border-radius: 3px 3px 0 0;
  transform: scaleX(0);
  transition: transform var(--md-dur-2) var(--md-ease);
}

.machine-tab.active {
  color: var(--brand-1);
  background: var(--md-brand-soft);
}

.machine-tab.active::after {
  transform: scaleX(1);
}

/* 表格包装器 */
.table-content-wrapper {
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--md-surface);
}

.reservation-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.reservation-table th {
  padding: 12px 8px;
  background: var(--md-surface-2);
  color: var(--md-text-2);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  border-bottom: 1px solid var(--md-outline);
  white-space: nowrap;
  box-shadow: inset 0 -1px 0 0 var(--md-outline);
}

.res-date-th {
  width: 55px;
  min-width: 55px;
}

.res-date-md {
  font-weight: 900;
  line-height: 1.1;
}

.res-date-wd {
  margin-top: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--md-text-3);
  line-height: 1.1;
}

/* 固定时段列 */
.reservation-table th:first-child,
.reservation-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 10;
  width: 64px;
  min-width: 64px;
  background: var(--md-surface-2);
  border-right: 1px solid var(--md-outline);
}

.reservation-table td:first-child {
  background: var(--md-surface);
  font-weight: 800;
  color: var(--md-text);
}

/* 表格单元格 */
.reservation-table td {
  padding: 16px 8px;
  text-align: center;
  font-size: 14px;
  border-bottom: 1px solid var(--md-outline);
  border-right: 1px solid var(--md-outline);
  color: var(--md-text-2);
  background: transparent;
}

.reservation-table tr.row-alt td {
  background: color-mix(in srgb, var(--md-surface-2) 70%, transparent);
}

.reservation-table tr:last-child td {
  border-bottom: none;
}

.reservation-table td:last-child {
  border-right: none;
}

/* JS 生成的单元格 class（替代内联 style） */
.res-slot-cell {
  position: sticky;
  left: 0;
  z-index: 10;
  width: 64px;
  min-width: 64px;
  padding: 16px 8px;
  text-align: center;
  font-weight: 800;
  font-size: 14px;
  color: var(--md-text);
  background: var(--md-surface);
  border-right: 1px solid var(--md-outline);
}

.res-data-cell {
  padding: 16px 8px;
  text-align: center;
  font-size: 14px;
  color: var(--md-text-2);
  border-right: 1px solid var(--md-outline);
  border-bottom: 1px solid var(--md-outline);
}

.reservation-table tr:last-child .res-data-cell {
  border-bottom: none;
}

.reservation-table .res-data-cell:last-child {
  border-right: none;
}

/* 预约人数状态色 */
.reservation-count {
  font-weight: 800;
  color: var(--brand-1);
}

.reservation-count[data-count="0"] {
  color: var(--md-text-2);
  font-weight: 700;
  opacity: 0.72;
}

/* 预约表单区块 */
.reservation-form-section {
  margin: 16px var(--res-side-margin);
  background: var(--md-surface);
  border-radius: var(--md-r-lg);
  padding: 24px;
  border: 1px solid var(--md-outline);
  box-shadow: var(--md-elev-1);
}

.section-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--md-text);
  margin-bottom: 16px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.hint-text {
  font-size: 12px;
  color: var(--md-text-3);
  font-weight: 700;
}

.input-row {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.input-field {
  flex: 1;
}

.input-label {
  display: block;
  font-size: 12px;
  color: var(--md-text-3);
  margin-bottom: 6px;
  margin-left: 4px;
}

.display-value-box {
  width: 100%;
  padding: 14px;
  background: var(--md-surface-2);
  border: 1px solid var(--md-outline);
  border-radius: var(--md-r-sm);
  color: var(--md-text);
  font-size: 14px;
  text-align: center;
  cursor: pointer;
  transition: all var(--md-dur-2) var(--md-ease);
  user-select: none;
}

.display-value-box.placeholder {
  color: var(--md-text-3);
}

.display-value-box:hover {
  border-color: var(--brand-1);
  background: var(--md-brand-soft);
}

/* 机种选择按钮组 - 强制覆盖全局 style.css 的 .machine-btn 白底 */
#page-reserve .machine-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#page-reserve .machine-btn {
  padding: 10px 16px;
  border-radius: var(--md-r-sm);
  border: 1px solid var(--md-outline);
  background: var(--md-surface);
  color: var(--md-text-2);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all var(--md-dur-2) var(--md-ease);
}

#page-reserve .machine-btn:hover {
  background: var(--md-surface-2);
}

#page-reserve .machine-btn.selected {
  background: var(--brand-1);
  color: #fff;
  border-color: var(--brand-1);
  box-shadow: 0 4px 12px rgba(211, 47, 47, 0.25);
}

/* 费用提示条（极简 M3 卡片） */
/* 费用提示条（M3 Summary Card 风格） */
#page-reserve #reservation-cost-hint.temp-reservation-hint {
  margin: 0 var(--res-side-margin) 16px;
  padding: 24px 20px 20px; /* 增加顶部 padding 给问号留位 */
  background: var(--md-surface-2);
  border-radius: var(--md-r-lg);
  border: 1px solid var(--md-outline);
  box-shadow: var(--md-elev-1);
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: auto;
  box-sizing: border-box;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.res-cost-summary-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.res-cost-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding-right: 24px; /* 避免挡住右侧问号 */
}

.res-cost-row-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.res-cost-title {
  font-size: 16px; /* 字体加大 */
  font-weight: 1000; /* 字体加粗 */
  color: var(--md-text);
  letter-spacing: 0.2px;
}

.res-cost-sub {
  font-size: 13px; /* 字体加大 */
  font-weight: 800;
  color: var(--md-text-2); /* 颜色加深一点增强可读性 */
}

.res-cost-row-right {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  flex-shrink: 0;
}

.res-cost-amount {
  font-size: 32px; /* 主金额进一步加大 */
  font-weight: 1000;
  color: var(--brand-1);
  line-height: 1;
}

.res-cost-unit {
  font-size: 14px;
  font-weight: 1000;
  color: var(--brand-1);
}

.res-cost-divider {
  height: 1px;
  background: var(--md-outline);
  width: 100%;
  opacity: 0.8;
}

.res-cost-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.res-cost-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--md-surface);
  border: 1px solid var(--md-outline);
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

#page-reserve #reservation-cost-help.temp-reservation-help {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px; /* 稍微加大按钮点击区域 */
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--md-outline);
  background: var(--md-surface-2);
  color: var(--md-text-2);
  font-size: 16px;
  font-weight: 1000;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s var(--md-ease);
  z-index: 10;
}

#page-reserve #reservation-cost-help.temp-reservation-help:hover {
  background: var(--md-surface);
  border-color: var(--brand-1);
  color: var(--brand-1);
  transform: scale(1.05);
}

.res-chip-name {
  font-size: 12px;
  font-weight: 800;
  color: var(--md-text-2);
}

.res-chip-val {
  font-size: 12px;
  font-weight: 900;
  color: var(--brand-1);
}

#page-reserve #reservation-cost-help.temp-reservation-help {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--md-outline);
  background: var(--md-surface);
  color: var(--md-text-3);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.temp-reservation-help {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--md-outline);
  background: var(--md-surface);
  color: var(--md-text-3);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 提交按钮 */
.reservation-submit-section {
  margin: 0 var(--res-side-margin) 40px;
}

#submit-reservation-btn {
  width: 100%;
  padding: 18px;
  background: var(--brand-1);
  color: #fff;
  border: none;
  border-radius: var(--md-r-lg);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: all var(--md-dur-2) var(--md-ease);
  box-shadow: var(--md-elev-2);
}

#submit-reservation-btn:active {
  transform: scale(0.98);
  box-shadow: var(--md-elev-1);
}

#submit-reservation-btn:disabled {
  background: var(--md-text-3);
  opacity: 0.5;
  cursor: not-allowed;
}

/* 通用弹窗覆盖（避免深色模式白底） */
#page-reserve .modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

#page-reserve .modal-content {
  margin: 20px;
  background: var(--md-surface);
  color: var(--md-text);
  border-radius: var(--md-r-lg);
  padding: 24px;
  width: min(420px, 92vw);
  border: 1px solid var(--md-outline);
  box-shadow: var(--md-elev-2);
}

#page-reserve .reservation-success-modal-content {
  text-align: center;
}

#page-reserve .success-icon {
  font-size: 44px;
  color: var(--brand-1);
  margin-bottom: 12px;
  font-weight: 900;
}

#page-reserve .success-title {
  font-size: 18px;
  font-weight: 900;
  margin-bottom: 10px;
}

#page-reserve .success-details {
  font-size: 14px;
  color: var(--md-text-2);
  line-height: 1.6;
  margin-bottom: 18px;
  white-space: pre-line;
}

#page-reserve .confirm-btn {
  background: var(--brand-1);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: var(--md-r-md);
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: var(--md-elev-1);
}

/* 响应式 */
@media (max-width: 480px) {
  .reservation-query-section,
  .reservation-form-section,
  .reservation-submit-section {
    margin-left: 12px;
    margin-right: 12px;
  }

  .input-row {
    flex-direction: column;
    gap: 12px;
  }

  .reservation-table th,
  .reservation-table td {
    padding: 12px 4px;
    font-size: 13px;
  }
}

@media (min-width: 768px) {
  .reserve-container {
    max-width: 640px;
    margin: 0 auto;
  }
}
