/* 看圖美化：reminders（_build/polish.py） */
body .s-reminders {
  gap: var(--sp-4);
}

/* ---------- 示範橫幅（只在本頁調整）---------- */
body:has(.s-reminders) .c-demo-banner {
  justify-content: flex-start;
  gap: var(--sp-3);
  text-align: left;
  margin-bottom: var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-input);
}
body:has(.s-reminders) .c-demo-banner .c-btn {
  margin-left: auto;
  flex: none;
  white-space: nowrap;
  padding: 0 var(--sp-3);
  font-size: var(--fs-footnote);
}

/* ---------- 說明文字：補上缺少的樣式，去掉預設 p 外距 ---------- */
body .s-rem-note,
body .s-rem-status {
  margin: 0;
  text-wrap: pretty;
}
body .s-rem-note {
  font-size: var(--fs-callout);
  line-height: var(--lh-callout);
  color: var(--text-2);
}
body .s-rem-status {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-input);
  background: var(--surface-2);
  color: var(--text);
  font-size: var(--fs-callout);
  line-height: var(--lh-callout);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
body .s-rem-note.is-paused {
  padding: var(--sp-3) var(--sp-4);
  border-left: 3px solid var(--up);
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  color: var(--text);
}

/* ---------- 提醒說明卡：淡色底、重點先行、其餘條列 ---------- */
body .s-rem-card[aria-labelledby="rem-intro"] {
  gap: var(--sp-2);
  background: var(--primary-tint);
  border-color: var(--primary-soft);
  box-shadow: none;
}
body .s-rem-card[aria-labelledby="rem-intro"] > .s-rem-card__title + .s-rem-note {
  margin-bottom: var(--sp-1);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 600;
  color: var(--text);
}
body .s-rem-card[aria-labelledby="rem-intro"] > .s-rem-note:nth-child(n+3) {
  position: relative;
  padding-left: var(--sp-4);
  font-size: var(--fs-footnote);
  line-height: var(--lh-footnote);
}
body .s-rem-card[aria-labelledby="rem-intro"] > .s-rem-note:nth-child(n+3)::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-3);
}

/* ---------- 用藥記錄提醒：主卡片，帶左側色條 ---------- */
body .s-rem-card[aria-labelledby="rem-inj"] {
  padding-left: calc(var(--sp-5) + 4px);
  overflow: hidden;
}
body .s-rem-card[aria-labelledby="rem-inj"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
}

/* 用藥與喝水卡：星期／時間、開始／結束並排，縮短卡片高度 */
body .s-rem-card[aria-labelledby="rem-inj"],
body .s-rem-card[aria-labelledby="rem-water"] {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: var(--sp-3);
}
body .s-rem-card[aria-labelledby="rem-inj"] > *,
body .s-rem-card[aria-labelledby="rem-water"] > * {
  grid-column: 1 / -1;
  min-width: 0;
}
body .s-rem-card[aria-labelledby="rem-inj"] > label.c-field:nth-of-type(-n+2),
body .s-rem-card[aria-labelledby="rem-water"] > label.c-field:nth-of-type(n+2):nth-of-type(-n+3) {
  grid-column: auto;
}
body .s-rem-card[aria-labelledby="rem-inj"] > label.c-field--inline:nth-of-type(3) {
  font-weight: 600;
}

/* ---------- 輸入欄 ---------- */
body .s-rem-card .c-field__input {
  padding: 0 var(--sp-3);
  min-height: 48px;
}
body .s-rem-card select.c-field__input {
  padding-right: var(--sp-8);
}
body .s-rem-card .c-field__label {
  color: var(--text-2);
}
body .s-rem-card input[type="time"].c-field__input::-webkit-calendar-picker-indicator {
  opacity: .7;
  cursor: pointer;
}

/* ---------- 按鈕：高度與圓角一致 ---------- */
body .s-rem-card .c-btn {
  min-height: 48px;
  border-radius: var(--r-btn);
}
body .s-rem-actions > .c-btn {
  flex: 1 1 0;
  min-width: 0;
  white-space: nowrap;
}

/* 時區切換：改為分段控制 */
body .s-rem-actions[role="group"] {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: var(--r-chip);
  background: var(--surface-3);
}
body .s-rem-actions[role="group"] > .c-btn {
  min-height: 40px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-chip);
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-callout);
  box-shadow: none;
}
body .s-rem-actions[role="group"] > .c-btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-1);
}

/* ---------- 開關列：分隔線一致、關閉狀態更清楚 ---------- */
body .s-rem-card > .c-field--inline {
  padding-top: var(--sp-3);
  border-top: 1px solid var(--divider);
}
body .s-rem-card > .s-rem-card__title + .c-field--inline {
  padding-top: 0;
  border-top: 0;
  font-weight: 600;
}
body .c-field--inline > input[type="checkbox"]:not(:checked) {
  background: color-mix(in srgb, var(--text-3) 55%, var(--surface));
  border-color: color-mix(in srgb, var(--text-3) 70%, var(--surface));
}

/* ---------- 星期晶片：七天等寬、已選用實心主色 ---------- */
body .s-rem-chips {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--sp-1);
}
body .s-rem-chips::before {
  content: "提醒的星期";
  content: "提醒的星期" / "";
  grid-column: 1 / -1;
  margin-bottom: var(--sp-1);
  font-size: var(--fs-footnote);
  line-height: 1.3;
  font-weight: 600;
  color: var(--text-2);
}
body .s-rem-chips > .c-chip {
  min-width: 0;
  min-height: 44px;
  padding: 0;
  justify-content: center;
  border-radius: var(--r-input);
  font-size: var(--fs-footnote);
  font-variant-numeric: tabular-nums;
}
body .s-rem-chips > .c-chip[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--text-on-primary);
}

/* ---------- 排程歷史 ---------- */
body .s-rem-history__item {
  line-height: 1.55;
  text-wrap: pretty;
}

/* ---------- 寬容器：兩欄依序流動，避免兩邊高度不齊留下大塊空白 ---------- */
@container view (min-width: 680px) {
  body .s-reminders {
    display: block;
    columns: 2;
    column-gap: var(--sp-4);
  }
  body .s-reminders > .s-rem-card {
    margin: 0 0 var(--sp-4);
    break-inside: avoid;
  }
  body .s-reminders > .s-rem-card[aria-labelledby="rem-intro"],
  body .s-reminders > .s-rem-card[aria-labelledby="rem-history"],
  body .s-reminders > .s-rem-card[aria-labelledby="rem-cal"] {
    column-span: all;
  }
}

/* ---------- 指標裝置 ---------- */
@media (pointer: fine) {
  body .s-rem-card .c-btn {
    min-height: 44px;
  }
  body .s-rem-actions[role="group"] > .c-btn {
    min-height: 36px;
  }
  body .s-rem-chips > .c-chip {
    min-height: 40px;
  }
}

@media (hover: hover) and (pointer: fine) {
  body .s-rem-actions[role="group"] > .c-btn[aria-pressed="false"]:hover {
    background: color-mix(in srgb, var(--surface) 55%, transparent);
    color: var(--text);
  }
  body .s-rem-actions[role="group"] > .c-btn[aria-pressed="true"]:hover {
    background: var(--surface);
  }
  body .s-rem-chips > .c-chip[aria-pressed="true"]:hover {
    border-color: var(--primary-strong);
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  body .s-reminders {
    gap: var(--sp-3);
  }
}
