/* style.css - スマホ最適化 UI ／ ミニオンテーマ 🍌 */

/* ──────────────────────────────
   CSS 変数 & リセット
────────────────────────────── */
:root {
  /* ミニオンカラー */
  --primary:    #0000ff;          /* ミニオンのオーバーオール青 */
  --primary-dk: #0000cc;
  --primary-lt: #e8e8ff;
  --yellow:     #ffd600;          /* ミニオン本体イエロー */
  --yellow-dk:  #FFD600;
  --yellow-lt:  #fffde7;
  --success:    #00c853;
  --danger:     #ff1744;
  --warn:       #ff6d00;
  --bg:         #fffde7;          /* 薄い黄色背景 */
  --card:       #ffffff;
  --text:       #1a237e;          /* 濃い青文字 */
  --text-sub:   #5c6bc0;
  --border:     #ffd600;          /* 黄色ボーダー */
  --radius:     24px;             /* 丸っこく！ */
  --radius-sm:  16px;
  --shadow:     0 4px 16px rgba(0,0,255,.12);
  --nav-h:      64px;
  --safe-b:     env(safe-area-inset-bottom, 0px);
}

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

html, body {
  height: 100%;
  font-family: "Rounded Mplus 1c", "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* Google Fonts：丸ゴシック */
@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@700;800;900&display=swap');

/* ──────────────────────────────
   ローディング
────────────────────────────── */
#loading {
  position: fixed; inset: 0;
  background: linear-gradient(160deg, #ffd600 0%, #FFD600 100%);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: #0000ff; z-index: 9999; gap: 16px;
}
#loading .spin {
  width: 48px; height: 48px;
  border: 5px solid rgba(0,0,255,.2);
  border-top-color: #0000ff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading p { font-size: 16px; font-weight: 800; color: #0000cc; }
#loading::before {
  content: "🍌";
  font-size: 52px;
  animation: bounce 1s ease-in-out infinite alternate;
}
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-12px); } }

/* ──────────────────────────────
   画面レイアウト
────────────────────────────── */
#app {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  max-width: 480px; margin: 0 auto;
  position: relative; overflow: hidden;
}

.screen {
  display: none; flex-direction: column;
  flex: 1; overflow-y: auto;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 16px);
}
.screen.active { display: flex; }

/* ──────────────────────────────
   ヘッダー
────────────────────────────── */
.screen-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.screen-title {
  font-size: 20px; font-weight: 700; color: var(--text);
}

/* ──────────────────────────────
   ボトムナビ
────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  height: calc(var(--nav-h) + var(--safe-b));
  background: #ffd600;
  border-top: 3px solid #0000ff;
  display: flex; align-items: flex-start;
  padding-top: 4px;
  box-shadow: 0 -4px 16px rgba(0,0,255,.15);
  z-index: 100;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; height: var(--nav-h);
  background: none; border: none; cursor: pointer;
  color: #0000cc; font-size: 10px; font-weight: 900;
  transition: color .2s, transform .15s;
}
.nav-btn:active { transform: scale(.9); }
.nav-btn .icon { font-size: 22px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.nav-btn .icon svg { display: block; }
.nav-btn.active { color: #0000ff; }
.nav-btn.active .icon {
  background: #0000ff; color: #ffd600;
  border-radius: 50%; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
}
.nav-btn.add-btn .icon {
  background: #0000ff;
  color: #ffd600; border-radius: 50%;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; margin-top: -14px;
  box-shadow: 0 4px 0 #0000aa, 0 6px 16px rgba(0,0,255,.4);
  transition: transform .15s, box-shadow .15s;
}
.nav-btn.add-btn:active .icon {
  transform: scale(.9) translateY(3px);
  box-shadow: 0 1px 0 #0000aa;
}

/* ──────────────────────────────
   ホーム：月ナビ
────────────────────────────── */
.month-nav {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #ffd600 0%, #FFD600 100%);
  color: #0000cc;
  border-radius: var(--radius); padding: 12px 16px;
  margin-bottom: 16px;
  border: 3px solid #0000ff;
  box-shadow: 0 4px 0 #0000cc;
}
.month-nav button {
  background: #0000ff; border: none; color: #ffd600;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 20px; cursor: pointer; line-height: 1;
  font-weight: 900; box-shadow: 0 2px 0 #0000aa;
  transition: transform .1s;
}
.month-nav button:active { transform: scale(.9); }
#home-month { font-size: 20px; font-weight: 900; color: #0000cc; }

/* ──────────────────────────────
   ホーム：合計カード
────────────────────────────── */
.total-card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px 20px; margin-bottom: 16px;
  box-shadow: 0 6px 0 #ccccff;
  border: 3px solid #0000ff;
  display: flex; justify-content: space-between; align-items: center;
}
.total-card .label { font-size: 13px; color: var(--text-sub); margin-bottom: 4px; font-weight: 700; }
#home-total { font-size: 26px; font-weight: 900; color: #0000ff; }
#home-count { font-size: 16px; color: #0000ff; font-weight: 800; }

/* ──────────────────────────────
   セクション
────────────────────────────── */
.section-title {
  font-size: 14px; font-weight: 900; color: #0000ff;
  letter-spacing: .05em;
  margin: 20px 0 8px;
  display: flex; align-items: center; gap: 6px;
}
.section-title::before { content: "🍌"; font-size: 16px; }

/* ──────────────────────────────
   科目別サマリー
────────────────────────────── */
.summary-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; background: var(--card);
  border-radius: var(--radius-sm); margin-bottom: 6px;
  box-shadow: 0 3px 0 #ccccff;
  border: 2px solid #e8e8ff;
}
.summary-cat { font-size: 14px; color: #1a237e; font-weight: 700; }
.summary-amt { font-size: 15px; font-weight: 900; color: #0000ff; }

/* ──────────────────────────────
   経費カード
────────────────────────────── */
.expense-card {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border-radius: var(--radius-sm);
  padding: 12px 16px; margin-bottom: 8px;
  box-shadow: 0 4px 0 #ccccff;
  border: 2px solid #e8e8ff;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.expense-card:active { transform: scale(.97) translateY(2px); box-shadow: 0 1px 0 #ccccff; }
.card-left { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.card-date  { font-size: 12px; color: var(--text-sub); font-weight: 700; }
.card-vendor { font-size: 15px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #1a237e; }
.card-cat-badge {
  display: inline-block; font-size: 11px; font-weight: 800;
  background: #ffd600; color: #0000cc;
  padding: 2px 10px; border-radius: 99px; width: fit-content;
}
.card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; margin-left: 12px; }
.card-amount { font-size: 17px; font-weight: 900; color: #0000ff; white-space: nowrap; }
.card-cat-small { font-size: 11px; color: var(--text-sub); font-weight: 700; }

.empty-msg { color: var(--text-sub); font-size: 14px; text-align: center; padding: 32px 0; }

/* ──────────────────────────────
   一覧フィルター
────────────────────────────── */
.list-filters {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  margin-bottom: 8px;
}
.list-filters select, .list-filters input {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; background: var(--card); color: var(--text);
  appearance: none;
}
.list-filter-full { grid-column: 1 / -1; }

#list-total {
  font-size: 13px; color: var(--text-sub); margin-bottom: 12px;
}

/* ──────────────────────────────
   設定：勘定科目リスト
────────────────────────────── */
.cat-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--card); border-radius: var(--radius-sm);
  padding: 12px 16px; margin-bottom: 8px;
  box-shadow: 0 3px 0 #ccccff;
  border: 2px solid #e8e8ff;
}
.cat-name { font-size: 15px; font-weight: 900; color: #1a237e; }
.cat-actions { display: flex; gap: 8px; }
.btn-icon {
  background: #ffd600; border: none; border-radius: 99px;
  padding: 6px 12px; font-size: 16px; cursor: pointer;
  box-shadow: 0 2px 0 #cc9900;
  transition: transform .15s;
}
.btn-icon:active { transform: scale(.9); }
.btn-icon.danger { background: #ffe8e8; box-shadow: 0 2px 0 #ffaaaa; }

/* ──────────────────────────────
   モーダル共通
────────────────────────────── */
.modal {
  display: none; position: fixed; inset: 0; z-index: 200;
  align-items: flex-end; justify-content: center;
  background: rgba(0,0,128,.35);
  backdrop-filter: blur(4px);
}
.modal.active { display: flex; }
.modal-box {
  width: 100%; max-width: 480px;
  background: var(--card);
  border-radius: 28px 28px 0 0;
  border-top: 4px solid #ffd600;
  padding: 20px 20px calc(20px + var(--safe-b));
  max-height: 92vh; overflow-y: auto;
  animation: slide-up .25s cubic-bezier(.34,1.56,.64,1);
}
@keyframes slide-up { from { transform: translateY(100%); } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 18px; font-weight: 900; color: #0000cc; }
.btn-close {
  background: #ffd600; border: none; border-radius: 50%;
  width: 34px; height: 34px; font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; color: #0000cc;
  box-shadow: 0 2px 0 #cc9900;
}

/* ──────────────────────────────
   経費フォーム
────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-sub); margin-bottom: 5px; }

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; padding: 12px 16px;
  border: 2.5px solid #e8e8ff; border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 700; color: #1a237e; background: #fafafe;
  outline: none; transition: border-color .2s, box-shadow .2s;
  font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #0000ff;
  box-shadow: 0 0 0 3px rgba(0,0,255,.12);
  background: #fff;
}
.form-group textarea { height: 70px; resize: none; }

/* カメラボタン群 */
.camera-btns { display: flex; gap: 10px; }
.btn-camera {
  flex: 1; padding: 14px 8px;
  border: 3px dashed #0000ff;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #fffde7, #e8e8ff);
  color: #0000cc;
  font-size: 13px; font-weight: 900; cursor: pointer; text-align: center;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 3px 0 #ccccff;
}
.btn-camera:active { transform: scale(.95) translateY(2px); box-shadow: none; }
.btn-camera .cam-icon { font-size: 26px; display: block; margin-bottom: 4px; }

/* OCR プログレス */
#ocr-status { font-size: 12px; color: var(--text-sub); margin-top: 6px; min-height: 18px; }
#ocr-progress { height: 4px; background: var(--border); border-radius: 2px; margin-top: 4px; display: none; }
#ocr-bar { height: 100%; background: var(--primary); border-radius: 2px; transition: width .3s; width: 0; }

/* 自動入力バッジ */
#autofill-badge {
  display: none; font-size: 12px; color: var(--success);
  background: #ecfdf5; padding: 4px 10px; border-radius: 99px;
  margin-top: 4px; font-weight: 600;
}

/* レシートプレビュー */
#receipt-preview { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.receipt-thumb {
  width: 72px; height: 96px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}

/* ──────────────────────────────
   ボタン
────────────────────────────── */
.btn-primary {
  width: 100%; padding: 15px;
  background: #0000ff; color: #ffd600;
  border: none; border-radius: var(--radius-sm);
  font-size: 17px; font-weight: 900; cursor: pointer;
  box-shadow: 0 4px 0 #0000aa;
  transition: transform .15s, box-shadow .15s;
  font-family: inherit;
}
.btn-primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #0000aa; }

.btn-secondary {
  width: 100%; padding: 14px;
  background: #ffd600; color: #0000cc;
  border: 2.5px solid #0000ff; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 900; cursor: pointer; margin-top: 8px;
  box-shadow: 0 3px 0 #cc9900;
  transition: transform .15s, box-shadow .15s;
  font-family: inherit;
}
.btn-secondary:active { transform: translateY(2px); box-shadow: none; }

.btn-danger {
  width: 100%; padding: 14px;
  background: none; color: var(--danger);
  border: 2.5px solid var(--danger); border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 900; cursor: pointer; margin-top: 8px;
  font-family: inherit;
}

.btn-export {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 15px;
  border: none; border-radius: var(--radius-sm);
  font-size: 16px; font-weight: 900; cursor: pointer; margin-bottom: 10px;
  box-shadow: 0 4px 0 rgba(0,0,0,.2);
  transition: transform .15s, box-shadow .15s;
  font-family: inherit;
}
.btn-export:active { transform: translateY(3px); box-shadow: none; }
.btn-export.pdf { background: #e53935; color: #fff; }
.btn-export.csv { background: #43a047; color: #fff; }

/* ──────────────────────────────
   エクスポートモーダル
────────────────────────────── */
.export-range { display: flex; gap: 8px; align-items: center; margin-bottom: 20px; }
.export-range input { flex: 1; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; }
.export-range span { color: var(--text-sub); flex-shrink: 0; }

/* ──────────────────────────────
   設定ボタン群
────────────────────────────── */
.settings-section { margin-bottom: 24px; }

/* ──────────────────────────────
   FAB（フローティングアクションボタン）
────────────────────────────── */
.fab {
  position: fixed; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); right: 20px;
  width: 56px; height: 56px;
  background: var(--primary); color: #fff; border: none; border-radius: 50%;
  font-size: 28px; cursor: pointer; box-shadow: 0 4px 16px rgba(37,99,235,.4);
  display: none; align-items: center; justify-content: center; z-index: 90;
}
.screen-list.active ~ * .fab-list,
#screen-list.active + .fab-list { display: flex; }

/* スクロールバー非表示 */
.screen::-webkit-scrollbar { display: none; }
.screen { scrollbar-width: none; }
