/* ============================================================
   BondDrive Kids AI - Phase 1.5
   モックアップ準拠のスマホUI
============================================================ */

:root {
  /* ベースカラー（ヘッダー画像の背景色 #fdfaf6 に統一） */
  --bg-cream: #fdfaf6;
  --bg-cream-light: #fdfaf6;
  --surface: #ffffff;

  /* テキスト */
  --text: #3d4a5c;
  --text-strong: #2d3a4d;
  --muted: #8a96a4;
  --line: #ecf0f5;

  /* アクセントカラー（モックアップから抽出） */
  --teal: #5dc4a8;          /* メインアクション・登園 */
  --teal-dark: #4ba88f;
  --teal-light: #d6f0e8;
  --teal-deep: #3d9382;     /* 音声入力リング */

  --blue: #5b9bd1;          /* 記録完了 */
  --blue-light: #d9e9f5;

  --orange: #f0a955;        /* 未記録・警告 */
  --orange-light: #fde9d0;
  --orange-deep: #d8923c;

  --coral: #ee8978;         /* 送迎・お迎え変更 */
  --coral-light: #fde0d8;
  --coral-deep: #dc6d58;

  --pink-soft: #fce3e8;
  --pink-deep: #c97a8a;

  --green-soft: #e4f8ef;
  --green-deep: #1f8b63;

  --warning-bg: #fff3e3;
  --warning-border: #f7d4a3;

  /* 影とボーダー */
  --shadow-sm: 0 2px 8px rgba(180, 165, 140, 0.08);
  --shadow-md: 0 6px 18px rgba(180, 165, 140, 0.12);
  --shadow-lg: 0 14px 32px rgba(180, 165, 140, 0.18);
  --shadow-soft: 0 8px 24px rgba(150, 140, 120, 0.10);

  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Zen Maru Gothic', 'Zen Kaku Gothic New', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg-cream);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "palt";
}

a { text-decoration: none; color: inherit; }
button { font: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ============================================================
   サイトシェル：スマホ縦長を意識
============================================================ */
.site-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px 130px;
  position: relative;
  min-height: 100vh;
  background: var(--bg-cream);
}

@media (min-width: 720px) {
  .site-shell { max-width: 520px; }
}

/* ============================================================
   HERO BANNER（ヘッダー）
   - 画像をカードの横幅いっぱいに表示
   - ベルだけを右上に重ねて配置
============================================================ */
.hero-banner {
  position: relative;
  margin: 0 -16px 16px; /* site-shell の左右パディング分を打ち消して画面端まで広げる */
  border-radius: 0;
  overflow: hidden;
  line-height: 0; /* img の余分な下余白対策 */
  background: #fdfaf6;
}

.hero-banner-img {
  display: block;
  width: 100%;
  height: auto;
}

/* ベル：画像の右上に重ねる */
.bell-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(220, 200, 170, .5);
  display: grid;
  place-items: center;
  box-shadow:
    0 2px 6px rgba(180, 160, 130, .15),
    0 0 0 4px rgba(255, 255, 255, .35); /* ハロー効果で画像背景に映える */
  cursor: pointer;
  z-index: 2;
  transition: transform .15s ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.bell-button:hover { transform: scale(1.06); }
.bell-button:active { transform: scale(0.96); }

.bell-button svg { display: block; }

.bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--coral);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 5px rgba(238, 137, 120, .4);
  border: 2px solid #fff;
  line-height: 1;
}

/* ============================================================
   統計カード（4列）
============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border-radius: 22px;
  padding: 14px 4px 14px;
  text-align: center;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .9) inset,
    0 4px 14px -4px rgba(180, 160, 130, .15),
    0 1px 3px rgba(180, 160, 130, .06);
  border: 1px solid rgba(255, 255, 255, .9);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 22px 22px 0 0;
}

.stat-card.teal::before { background: linear-gradient(90deg, transparent, var(--teal), transparent); opacity: .35; }
.stat-card.blue::before { background: linear-gradient(90deg, transparent, var(--blue), transparent); opacity: .35; }
.stat-card.orange::before { background: linear-gradient(90deg, transparent, var(--orange), transparent); opacity: .35; }
.stat-card.coral::before { background: linear-gradient(90deg, transparent, var(--coral), transparent); opacity: .35; }

.stat-icon {
  width: 38px;
  height: 38px;
  margin-bottom: 4px;
}

.stat-icon svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 2px 4px rgba(0,0,0,.06)); }

.stat-card-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  margin: 0;
  letter-spacing: -.01em;
}

.stat-card-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  margin: 4px 0 0;
  font-family: 'Plus Jakarta Sans', 'Zen Maru Gothic', sans-serif;
  letter-spacing: -.04em;
}

.stat-card-value .v-sub {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: -.02em;
  margin-left: 0;
}

.stat-card-unit {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
  font-weight: 500;
}

.stat-card.teal .stat-card-value { color: var(--teal-dark); }
.stat-card.blue .stat-card-value { color: #2d6ea0; }
.stat-card.orange .stat-card-value { color: var(--orange-deep); }
.stat-card.coral .stat-card-value { color: var(--coral-deep); }

/* ============================================================
   汎用カード
============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px 14px 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, .9);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.section-head .head-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -.01em;
}

.section-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-strong);
}

.section-head p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.section-link {
  font-size: 12px;
  color: var(--teal-dark);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
}

.section-link::after {
  content: '›';
  font-size: 16px;
  line-height: 1;
}

/* ============================================================
   園児行（リスト）
============================================================ */
.children-list {
  display: flex;
  flex-direction: column;
}

.child-row {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f4eee0;
  position: relative;
}

.child-row:last-child { border-bottom: none; }

.child-row .row-chevron {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.child-avatar {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden;
}

.child-avatar svg { display: block; width: 100%; height: 100%; }

.child-main {
  flex: 1;
  min-width: 0;
  padding-right: 18px;
}

.child-name-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 6px;
}

.child-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -.01em;
}

.child-meta {
  font-size: 11.5px;
  color: var(--muted);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

/* ============================================================
   ステータスチップ（アイコン付き）
============================================================ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px 4px 6px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.3;
}

.chip svg { flex-shrink: 0; }

.chip-success {
  background: var(--green-soft);
  color: var(--green-deep);
}

.chip-blue {
  background: var(--blue-light);
  color: #2d6ea0;
}

.chip-warning {
  background: var(--warning-bg);
  color: var(--orange-deep);
}

.chip-coral {
  background: var(--coral-light);
  color: var(--coral-deep);
}

.chip-muted {
  background: #f0f2f6;
  color: var(--muted);
}

.chip-teal {
  background: var(--teal-light);
  color: var(--teal-dark);
}

/* ============================================================
   警告バナー（未記録の園児が4名います）
============================================================ */
.alert-banner {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-banner-text {
  flex: 1;
  font-size: 13px;
  color: var(--orange-deep);
  font-weight: 700;
}

.alert-banner-text strong {
  font-weight: 800;
  margin: 0 1px;
}

.alert-banner-link {
  font-size: 12px;
  color: var(--orange-deep);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.alert-banner-link::after {
  content: '›';
  font-size: 16px;
  line-height: 1;
}

/* ============================================================
   下部の3つの大型アクションカード
============================================================ */
.action-trio {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.action-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px 8px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(255, 255, 255, .9);
  position: relative;
  overflow: hidden;
}

.action-card .ac-icon {
  width: 50px;
  height: 50px;
}

.action-card .ac-icon svg { width: 100%; height: 100%; display: block; }

.action-card .ac-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-top: 2px;
  white-space: nowrap;
}

.action-card .ac-sub {
  font-size: 9.5px;
  color: var(--muted);
  line-height: 1.45;
  letter-spacing: -.02em;
}

.action-card .ac-sub::after {
  content: ' ›';
  font-size: 11px;
  color: var(--muted);
}

.action-card.parents {
  background: linear-gradient(180deg, #e8f8f1, #d8f0e6);
}

.action-card.parents .ac-title { color: var(--teal-dark); }

.action-card.car {
  background: linear-gradient(180deg, #fde4dc, #fcd4c8);
}

.action-card.car .ac-title { color: var(--coral-deep); }

.action-card.mic {
  background: var(--teal);
  color: #fff;
  position: relative;
  padding: 10px 8px 14px;
}

.action-card.mic::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 22px;
  background: radial-gradient(circle at 30% 25%, rgba(255,255,255,.2), transparent 60%);
  pointer-events: none;
}

/* キラキラ装飾 */
.action-card.mic::after {
  content: '✦';
  position: absolute;
  top: 8px;
  right: 14px;
  color: rgba(255,255,255,.55);
  font-size: 10px;
  text-shadow: 14px 8px 0 rgba(255,255,255,.45),
               -8px 30px 0 rgba(255,255,255,.4),
               20px 60px 0 rgba(255,255,255,.5),
               -22px 70px 0 rgba(255,255,255,.4);
}

.action-card.mic .mic-circle {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--teal);
  border: 4px solid #fff;
  box-shadow: 0 0 0 3px var(--teal-deep), 0 8px 18px rgba(61, 147, 130, .35);
  display: grid;
  place-items: center;
  margin: 6px 0 8px;
  position: relative;
  z-index: 1;
}

.action-card.mic .ac-title {
  color: #fff;
  font-size: 15px;
  margin-top: 2px;
  position: relative;
  z-index: 1;
}

.action-card.mic.is-recording .mic-circle {
  animation: pulse-mic 1s infinite alternate;
}

@keyframes pulse-mic {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

/* ============================================================
   ボトムナビ
============================================================ */
.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid #f0e8d6;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 100;
}

@media (min-width: 720px) {
  .bottom-nav { max-width: 520px; }
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  color: #9ca7b3;
  font-size: 10.5px;
  font-weight: 600;
}

.bottom-nav a svg { width: 22px; height: 22px; }

.bottom-nav a.active {
  color: var(--teal-dark);
}

/* ============================================================
   園児詳細（record.php）用
============================================================ */
.child-hero {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 16px 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.child-hero .child-avatar {
  width: 72px;
  height: 72px;
}

.child-hero-text { flex: 1; min-width: 0; }

.child-hero-name {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-strong);
  margin: 0 0 4px;
}

.child-hero-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin: 0 0 8px;
}

/* 音声入力パネル */
.voice-panel {
  display: flex;
  gap: 14px;
  align-items: center;
}

.mic-button {
  width: 70px;
  height: 70px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  box-shadow: 0 0 0 3px var(--teal-deep), 0 10px 22px rgba(61, 147, 130, .3);
  font-size: 28px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.mic-button.is-recording { animation: pulse-mic 1s infinite alternate; }

.voice-copy { flex: 1; min-width: 0; }

.voice-copy strong {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-strong);
  margin-bottom: 4px;
}

.voice-copy p {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.transcript-box {
  background: #fbf5e8;
  border: 1px solid #f0e6cf;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
}

/* チップグリッド（未記録項目） */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* 記録項目 */
.field-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}

.field-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.field-card-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
}

.field-pill {
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.field-pill.filled {
  background: var(--green-soft);
  color: var(--green-deep);
}

.field-pill.empty {
  background: var(--warning-bg);
  color: var(--orange-deep);
}

.field-textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid #efe9d8;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fbf7ec;
  color: var(--text);
  min-height: 72px;
  font-size: 13px;
  line-height: 1.7;
  font-family: inherit;
}

.field-textarea:focus {
  outline: none;
  border-color: var(--teal);
  background: #fff;
}

/* ボタン */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  font-size: 13px;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 6px 14px rgba(93, 196, 168, .28);
}

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

.btn-soft {
  background: var(--teal-light);
  color: var(--teal-dark);
}

.btn-white {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
}

/* フィルタピル（園児一覧） */
.filter-row {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.filter-pill {
  border: 1px solid #efe9d8;
  background: #fff;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-pill.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
}

/* ============================================================
   管理画面（admin/index.php）
============================================================ */
.admin-stats { grid-template-columns: repeat(4, 1fr); }

.admin-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -14px;
  padding: 0 14px;
}

.admin-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table th {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  letter-spacing: .03em;
}

.admin-table td {
  padding: 12px 8px;
  border-bottom: 1px solid #f4eee0;
  color: var(--text);
  white-space: nowrap;
}

.admin-table a { color: var(--teal-dark); font-weight: 700; }

.admin-checks {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.admin-check {
  background: #fbf5e8;
  border: 1px solid #f0e6cf;
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--orange-deep);
  font-weight: 700;
}

@media (min-width: 720px) {
  .admin-checks { grid-template-columns: repeat(3, 1fr); }
}

/* 小さい画面調整 */
@media (max-width: 360px) {
  .stat-card-value { font-size: 22px; }
  .stat-icon { width: 36px; height: 36px; }
  .child-name { font-size: 14px; }
  .action-card .ac-title { font-size: 13px; }
  .action-card.mic .mic-circle { width: 66px; height: 66px; }
}
