/* ============================================================
 *  style.css — 日期計算機樣式（響應式、手機優先）
 * ============================================================ */
:root {
  --primary: #0e7c7b;
  --primary-dark: #0a5e5d;
  --accent: #f4a261;
  --bg: #f5f7f8;
  --card-bg: #ffffff;
  --text: #2d3436;
  --muted: #6b7280;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}
header.site {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 1.2rem 1rem;
  text-align: center;
}
header.site h1 { font-size: 1.6rem; font-weight: 700; }
header.site p { opacity: .9; font-size: .9rem; margin-top: .25rem; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 1rem; }

main { display: grid; grid-template-columns: 1fr; gap: 1.2rem; }

section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem;
}
section h2 {
  font-size: 1.2rem;
  color: var(--primary-dark);
  border-left: 4px solid var(--primary);
  padding-left: .6rem;
  margin-bottom: 1rem;
}

/* 輸入列 */
.row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field label { font-size: .85rem; color: var(--muted); }
input[type=date], input[type=number] {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .7rem;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  min-width: 150px;
}
input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: .55rem 1rem;
  font-size: .95rem;
  cursor: pointer;
  transition: background .15s;
}
button:hover { background: var(--primary-dark); }
button.ghost { background: #eef2f3; color: var(--primary-dark); }
button.ghost:hover { background: #e0e7e8; }

/* 結果 */
.big-result {
  background: #f0f9f9;
  border: 1px solid #cdeaea;
  border-radius: 10px;
  padding: .9rem 1rem;
  margin: 1rem 0 .4rem;
  font-size: 1.05rem;
}
.big-result b { color: var(--primary-dark); font-size: 1.5rem; }
.big-result small { display: block; color: var(--muted); margin-top: .3rem; font-size: .85rem; }
.big-result small b { font-size: 1rem; color: var(--accent); }
.hint { font-size: .8rem; color: var(--muted); margin: .5rem 0; }

/* 日期資訊卡片 */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .6rem; }
.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .8rem;
  background: #fbfcfc;
}
.card h4 { color: var(--primary-dark); margin-bottom: .5rem; font-size: .95rem; }
.card ul.info { list-style: none; }
.card ul.info li {
  display: grid;
  grid-template-columns: 3em 1fr auto;
  gap: .5rem;
  padding: .25rem 0;
  font-size: .9rem;
  border-bottom: 1px dashed var(--border);
}
.card ul.info li:last-child { border-bottom: none; }
.card ul.info li span { color: var(--muted); }
.card ul.info li em { color: var(--muted); font-style: normal; font-size: .82rem; }
.warn { color: #c0392b; font-size: .85rem; }

/* 月曆 */
.cal-head-bar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .8rem; flex-wrap: wrap; }
.cal-head-bar .title { font-size: 1.1rem; font-weight: 600; color: var(--primary-dark); }
.cal-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-row.cal-head { margin-bottom: 4px; }
.cal-row.cal-head > div {
  text-align: center; font-weight: 600; color: var(--muted); padding: .4rem 0; font-size: .85rem;
}
.cal-cell {
  aspect-ratio: 1.4 / 1;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: #f8fafb;
  font-size: .95rem;
  cursor: pointer;
  transition: background .12s, transform .12s;
  user-select: none;
}
.cal-cell:not(.empty):hover { background: #cdeaea; transform: scale(1.05); }
.cal-cell.empty { background: transparent; cursor: default; }
.cal-cell.today { background: var(--accent); color: #fff; font-weight: 700; }
.cal-row.cal-head > div:nth-child(1), .cal-row.cal-head > div:nth-child(7) { color: #c0392b; }

/* 廣告欄位（預留，日後插入 AdSense 代碼） */
.ad-slot {
  border: 2px dashed #cbd5e0;
  background: repeating-linear-gradient(45deg, #f9fafb, #f9fafb 10px, #f1f5f9 10px, #f1f5f9 20px);
  border-radius: var(--radius);
  min-height: 90px;
  display: flex; align-items: center; justify-content: center;
  color: #94a3b8;
  font-size: .85rem;
  margin: 0;
  text-align: center;
}
.ad-slot::before { content: "廣告 AD "; font-weight: 600; }
.ad-top, .ad-bottom { padding: 1.5rem; }
.ad-sidebar { min-height: 600px; }

/* 使用說明 */
.howto ol { padding-left: 1.3rem; color: var(--muted); font-size: .9rem; }
.howto ol li { margin: .25rem 0; }

footer.site { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 1rem 2rem; }
footer.site a { color: var(--primary); }

/* 桌面：側欄廣告在右側 */
@media (min-width: 860px) {
  .layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.2rem; align-items: start; }
  .layout main { gap: 1.2rem; }
  .layout aside { position: sticky; top: 1rem; }
}

/* 手機：卡片單欄 */
@media (max-width: 600px) {
  header.site h1 { font-size: 1.3rem; }
  .cards { grid-template-columns: 1fr; }
  .big-result b { font-size: 1.25rem; }
  .cal-cell { font-size: .85rem; }
}
