/* ============================================================
   app.css - SPA共通レイアウト・ナビ・TOP・児童管理・モーダル拡張
   ============================================================ */

/* ============ グローバルナビ ============ */

.global-nav {
  position: sticky;
  top: 0;
  z-index: 80;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 1px 4px rgba(47,58,54,0.06);
}

.nav-inner {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 20px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-brand {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary-dark);
  text-decoration: none;
  white-space: nowrap;
}

.nav-brand:hover { color: var(--color-primary); }

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover { background: var(--color-bg); color: var(--color-text); }

.nav-link-active {
  background: var(--color-primary-soft);
  color: var(--color-primary-dark);
}

/* ============ SPAレイアウト ============ */

.spa-main { min-height: calc(100vh - 52px); }

.spa-page[hidden] { display: none; }

/* ============ TOPページ ============ */

.page-top { max-width: 860px; }

.due-banner {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  margin-bottom: 28px;
  color: #fff;
}

.due-banner-zero {
  background: linear-gradient(135deg, #B0BDB9 0%, #8E9E9A 100%);
}

.due-banner-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.due-count-block {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}

.due-count {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  color: #fff;
}

.due-label { font-size: 1.3rem; font-weight: 700; color: rgba(255,255,255,0.9); }
.due-desc  { font-size: 0.95rem; color: rgba(255,255,255,0.82); width: 100%; }

/* ============ セクション ============ */

.top-section { margin-bottom: 28px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-heading);
  margin: 0;
}

/* ============ 児童カード ============ */

.child-list { display: flex; flex-direction: column; gap: 10px; }

.child-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  position: relative;
  transition: box-shadow 0.15s;
}

.child-card:hover { box-shadow: 0 3px 12px rgba(47,58,54,0.08); }

.child-card-due {
  border-color: var(--color-primary);
  border-left: 4px solid var(--color-primary);
}

.child-card-main {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.child-card-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.child-nickname { font-weight: 700; font-size: 1rem; }

.child-dates {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.date-sep   { color: var(--color-border); }
.date-due   { color: var(--color-primary-dark); font-weight: 700; }
.date-overdue { color: var(--color-danger); font-weight: 700; }

.child-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.child-card-due-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--color-primary);
  color: #fff;
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.child-card-due-badge.badge-overdue {
  background: var(--color-danger);
}

/* ============ ボタン追加バリアント ============ */

.btn-accent-sm {
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-accent-sm:hover { background: var(--color-primary-dark); }

.btn-ghost-sm {
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn-ghost-sm:hover { border-color: var(--color-primary); color: var(--color-primary-dark); }

.btn-danger-sm {
  background: transparent;
  color: var(--color-danger);
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-danger-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.btn-danger-sm:hover { background: var(--color-danger-soft); border-color: var(--color-danger); }

.btn-primary-sm {
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-primary-sm:hover { background: var(--color-primary-dark); }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.88rem;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-danger:hover { opacity: 0.85; }

.btn-ghost-lg {
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: border-color 0.15s, color 0.15s;
}

.btn-ghost-lg:hover { border-color: var(--color-primary); color: var(--color-primary-dark); }

/* ============ 空状態 ============ */

.empty-state {
  background: var(--color-surface);
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
}

.empty-icon  { font-size: 2.5rem; margin: 0 0 12px; }
.empty-title { font-family: var(--font-heading); font-size: 1.05rem; font-weight: 700; margin: 0 0 8px; }
.empty-desc  { font-size: 0.88rem; color: var(--color-text-muted); margin: 0 0 20px; max-width: 420px; margin-left: auto; margin-right: auto; }

/* ============ モーダル ============ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(47,58,54,0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 100;
  padding: 24px 16px;
  overflow-y: auto;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 48px rgba(47,58,54,0.18);
  width: 100%;
  max-width: 520px;
  margin: auto;
}

/* ① 児童登録モーダルは幅広に */
.modal-wide { max-width: 800px; }

.modal-sm { max-width: 420px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  z-index: 1;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-heading);
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s;
}

.modal-close:hover { color: var(--color-text); }

.modal-body { padding: 20px 24px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--color-border);
  position: sticky;
  bottom: 0;
  background: var(--color-surface);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ============ モーダル内セクション ============ */

.modal-section { margin-bottom: 28px; }
.modal-section:last-child { margin-bottom: 0; }

.modal-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-heading);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
}

.modal-section-sub {
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-left: 8px;
}

.modal-fieldset { margin-bottom: 18px; }
.modal-fieldset:last-child { margin-bottom: 0; }

/* ============ フォーム共通（モーダル内） ============ */

.form-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--color-text);
}

.date-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

input[type="date"] {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: var(--color-bg);
}

input[type="date"]:focus { outline: 3px solid #BFD9D1; outline-offset: 1px; }

.field-error-msg {
  color: var(--color-danger);
  font-size: 0.82rem;
  font-weight: 700;
  margin: 6px 0 0;
}

.field-error-msg[hidden] { display: none; }

.delete-warning {
  color: var(--color-danger);
  font-size: 0.85rem;
  font-weight: 700;
  margin: 8px 0 0;
}

.notice-box-sm {
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 0.84rem;
}

.notice-box-sm p { margin: 0; }
