/* datecalc.css */

:root {
  --blue:     #3b82f6;
  --blue-dk:  #2563eb;
  --blue-sh:  rgba(59,130,246,0.12);
  --text:     #1e293b;
  --text-sub: #64748b;
  --text-dim: #94a3b8;
  --bg:       #f8fafc;
  --surface:  #ffffff;
  --surface2: #f1f5f9;
  --border:   #e2e8f0;
  --font: "Noto Sans JP","Hiragino Kaku Gothic ProN","Hiragino Sans",Meiryo,sans-serif;
}
html[data-theme="dark"] {
  --text:     #e2e8f0;
  --text-sub: #94a3b8;
  --text-dim: #475569;
  --bg:       #0f172a;
  --surface:  #1e293b;
  --surface2: #0f172a;
  --border:   #334155;
}

/* ライトモードではグラデーション背景を出さない */
html:not([data-theme="dark"]) body::before { display: none; }

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background 0.3s, color 0.3s;
}

/* ── ヘッダー ── */
.dc-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.backmenu-button {
  padding: 0.38rem 0.85rem;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  text-decoration: none;
  color: var(--text-sub);
  font-size: 0.82rem;
  font-family: var(--font);
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}
.backmenu-button:hover { border-color: var(--blue); color: var(--blue); }
.dc-header-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

/* ── メインエリア ── */
.dc-main {
  flex: 1;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

/* ── タブ（アンダーライン式）── */
.dc-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 0;
  margin-bottom: 2rem;
  overflow-x: auto;
  scrollbar-width: none;
}
.dc-tabs::-webkit-scrollbar { display: none; }

.dc-tab {
  flex-shrink: 0;
  padding: 0.9rem 1rem;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.dc-tab:hover { color: var(--text-sub); }
.dc-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* ── パネル ── */
.dc-panel { display: none; flex-direction: column; gap: 1.4rem; }
.dc-panel.active { display: flex; }

/* ── フィールド ── */
.field-block {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.field-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-sub);
}

/* 今日 / 今 ボタン（ラベル横の小さいリンク風） */
.today-link,
.now-link {
  background: none;
  border: none;
  font-size: 0.75rem;
  font-family: var(--font);
  color: var(--blue);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.today-link:hover,
.now-link:hover { opacity: 1; }

/* ── 入力要素 ── */
input[type="date"],
input[type="time"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
input[type="date"]:focus,
input[type="time"]:focus { border-color: var(--blue); }

.text-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.text-input:focus { border-color: var(--blue); }

.num-input {
  width: 90px;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font);
  color: var(--text);
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}
.num-input-sm {
  width: 72px;
  padding: 0.6rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  color: var(--text);
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}
.num-input:focus,
.num-input-sm:focus { border-color: var(--blue); }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; }

/* インライン行（数値＋単位＋ラジオ等） */
.inline-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.unit-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-sub);
}

/* ラジオ pill */
.radio-pill {
  display: flex;
  align-items: center;
  gap: 0;
  cursor: pointer;
}
.radio-pill input[type="radio"] { display: none; }
.radio-pill span {
  padding: 0.42rem 0.85rem;
  border: 1.5px solid var(--border);
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font);
  color: var(--text-sub);
  border-radius: 5px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  cursor: pointer;
}
.radio-pill input[type="radio"]:checked + span {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

/* 翌日チェックボックス行 */
.next-day-row { display: flex; }
.check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-sub);
  cursor: pointer;
}
.check-label input[type="checkbox"] { accent-color: var(--blue); width: 16px; height: 16px; }

/* 入れ替えボタン */
.swap-btn {
  align-self: flex-start;
  background: none;
  border: none;
  font-size: 0.78rem;
  font-family: var(--font);
  color: var(--text-dim);
  cursor: pointer;
  padding: 0.2rem 0;
  transition: color 0.15s;
}
.swap-btn:hover { color: var(--text-sub); }

/* ── 結果表示 ── */
.dc-result {
  border-left: 3px solid var(--blue);
  background: var(--surface);
  border-radius: 0 10px 10px 0;
  padding: 1.25rem 1.5rem;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
}

.result-empty {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.result-number {
  font-size: clamp(2.6rem, 11vw, 4rem);
  font-weight: 800;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.result-number .unit {
  font-size: 0.45em;
  font-weight: 700;
  color: var(--text-sub);
  letter-spacing: 0;
  margin-left: 0.1em;
}
.result-sub {
  font-size: 0.82rem;
  color: var(--text-sub);
  line-height: 1.6;
}
.result-note {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* 過去・エラー状態 */
.dc-result.is-past  { border-left-color: var(--text-dim); }
.dc-result.is-today { border-left-color: #10b981; }

/* ── ダークモード補足 ── */
html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(1);
}
html[data-theme="dark"] .dc-result {
  background: var(--surface2);
}

/* ── 軽量モード ── */
html[data-performance="low"] * { transition: none !important; animation: none !important; }
