/* ==========================================
   css/style.css
   アプリ全体の共通デザイン・レイアウト
   ========================================== */

/* パステルテーマ V43 */
:root { 
  --bg: #fdfbf7; --main: #88d8b0; --main-dark: #6bc29a; 
  --accent: #ffcc5c; --accent-red: #ff6f69; --text: #5d5d5d; 
  --card-bg: #ffffff; --radius: 20px;
  --base-font-size: 15px; --icon-scale: 1.0;
}
body { 
  margin:0; font-family:-apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif; 
  background:var(--bg); color:var(--text); padding-bottom:120px; 
  -webkit-tap-highlight-color:transparent; font-size:var(--base-font-size);
  touch-action: manipulation; overscroll-behavior-y: none;
}
html { -webkit-text-size-adjust: 100%; touch-action: pan-x pan-y; }
.scalable-icon { transition: transform 0.2s; display: inline-block; transform: scale(var(--icon-scale)); transform-origin: center center; }

#error-report {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.95); color: #fff; z-index: 2147483647;
  padding: 30px; overflow-y: auto; font-family: monospace;
}
#error-msg { white-space: pre-wrap; word-break: break-all; margin-top:10px; font-size:1rem; line-height:1.5; color:#ffcccc; }

#loading-screen { position: fixed; inset: 0; background: var(--bg); z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: opacity 0.4s; }
#loading-screen.loaded { opacity: 0; visibility: hidden; pointer-events: none; }
.spinner { width: 45px; height: 45px; border: 5px solid #fff; border-top-color: var(--main); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 15px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
@keyframes spin { to { transform: rotate(360deg); } }

.settings-btn { position: fixed; top: 15px; right: 15px; z-index: 2000; background: rgba(255,255,255,0.9); border-radius: 50%; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.15); backdrop-filter: blur(4px); }

/* 共通ユーティリティ */
.container { max-width:600px; margin:0 auto; padding:0 20px; }
.hidden { display:none !important; }
.card { background:var(--card-bg); border-radius:var(--radius); padding:20px; margin-bottom:20px; box-shadow:0 4px 15px rgba(0,0,0,0.03); border: 1px solid #fcfcfc; }
.card-title { font-weight:bold; font-size:1.1rem; margin-bottom:15px; display:flex; justify-content:space-between; align-items:center; color: #444; }

/* ナビゲーションタブ */
.nav-tabs { display:flex; justify-content:center; gap:8px; margin:15px 0; padding:0 10px; }
.nav-item { flex:1; text-align:center; padding:12px 4px; background:#fff; border-radius:18px; color:#aaa; font-weight:bold; cursor:pointer; transition:0.3s; font-size:0.85rem; border: 1px solid #f0f0f0; }
.nav-item.active { background:var(--main); color:white; box-shadow:0 6px 15px rgba(136,216,176,0.4); transform:translateY(-2px); border-color:var(--main); }

/* 洗濯機パネル */
.laundry-panel { background: linear-gradient(135deg, #a8e6cf, #dcedc1); color: #5d5d5d; padding: 25px 20px; border-radius: 0 0 30px 30px; text-align: center; margin-bottom: 20px; box-shadow: 0 8px 20px rgba(168,230,207,0.4); }
.laundry-btn { background: #fff; border: none; color: var(--main-dark); padding: 8px 20px; border-radius: 30px; font-weight: bold; box-shadow: 0 4px 10px rgba(0,0,0,0.1); cursor: pointer; margin-top: 10px; }

/* 家計簿・固定費カード */
.fixed-cost-card { background: #e3f2fd; border: 1px solid #bbdefb; border-radius: var(--radius); padding: 15px; margin-bottom: 20px; }
.fixed-cost-title { font-weight: bold; color: #1565c0; display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.fixed-cost-item { 
  background: white; border-radius: 12px; padding: 12px; margin-bottom: 8px; 
  display: flex; justify-content: space-between; align-items: center; 
  box-shadow: 0 2px 5px rgba(0,0,0,0.05); cursor:pointer;
}
.fc-main { font-weight: bold; font-size: 1rem; color: #333; }
.fc-sub { font-size: 0.75rem; color: #666; margin-top: 2px; }
.fc-diff { font-size: 0.75rem; font-weight: bold; margin-left: 5px; }
.fc-diff.up { color: #e74a3b; }
.fc-diff.down { color: #1cc88a; }

.add-fixed-btn { background: #1565c0; color: white; border:none; padding: 6px 14px; border-radius: 20px; font-size: 0.8rem; cursor: pointer; font-weight:bold; }
.variable-cost-card { background: #fff3e0; border: 1px solid #ffe0b2; border-radius: var(--radius); padding: 15px; }
.variable-cost-title { font-weight: bold; color: #e65100; margin-bottom: 15px; }

.daily-budget-box { text-align:center; padding:15px; background:#fff; border-radius:20px; margin-bottom:20px; box-shadow: 0 4px 15px rgba(0,0,0,0.03); border:2px solid #f0f0f0; }
.daily-val { font-size:2rem; font-weight:800; margin:5px 0; color: #444; }
.daily-bar { height:12px; background:#f0f0f0; border-radius:6px; margin-top:10px; overflow:hidden; }
.daily-fill { height:100%; background:var(--main); width:0%; transition:width 0.6s; }

.passbook-container { width: 100%; border-collapse: collapse; margin-top: 5px; }
.passbook-row { border-bottom: 1px solid #eee; display: flex; align-items: center; padding: 12px 5px; cursor:pointer; }
.passbook-row:active { background: #f9f9f9; }
.passbook-row:last-child { border-bottom: none; }
.pb-date { width: 45px; font-size: 0.85rem; color: #888; font-weight: bold; text-align: center; line-height: 1.2; }
.pb-main { flex: 1; padding: 0 10px; }
.pb-title { font-weight: bold; font-size: 0.95rem; color: #333; display:flex; align-items:center; gap:5px; }
.pb-sub { font-size: 0.75rem; color: #888; margin-top: 2px; }
.pb-amount { font-weight: bold; font-size: 1rem; color: #333; text-align: right; min-width: 70px; }
.pb-amount.fixed { color: #1565c0; }
.pb-qty { font-size:0.75rem; background:#e3f2fd; color:#1565c0; padding:1px 6px; border-radius:8px; white-space:nowrap; }

.total-summary-box { background: linear-gradient(135deg, #88d8b0, #6bc29a); color:white; padding: 20px; border-radius: 20px; text-align: center; margin-bottom: 20px; box-shadow: 0 8px 20px rgba(136, 216, 176, 0.3); position:relative; }
.total-summary-label { font-size: 0.8rem; opacity: 0.9; }
.total-summary-val { font-size: 2.2rem; font-weight: 800; margin: 5px 0; letter-spacing: 1px; }
.btn-direct-add { position: absolute; right: 15px; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.25); border: 1px solid rgba(255,255,255,0.6); color: white; padding: 8px 12px; border-radius: 12px; font-size: 0.8rem; cursor: pointer; font-weight: bold; }

.budget-compact-row { display: flex; align-items: center; margin-bottom: 8px; font-size: 0.8rem; cursor:pointer; }
.bc-label { width: 80px; font-weight: bold; color: #666; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-bar-bg { flex: 1; height: 8px; background: #eee; border-radius: 4px; overflow: hidden; margin: 0 10px; }
.bc-bar-fill { height: 100%; background: var(--main); }
.bc-val { width: 80px; text-align: right; color: #888; }
.edit-budget-btn { font-size:0.8rem; background:none; border:none; cursor:pointer; color:#aaa; margin-left:5px; }

/* 買い物リスト・ToDo */
.todo-item { display:flex; align-items:center; padding:15px 0; border-bottom:1px solid #f5f5f5; cursor:pointer; position:relative; }
.todo-check { width:26px; height:26px; border:2px solid #ddd; border-radius:50%; margin-right:15px; display:flex; align-items:center; justify-content:center; color:white; transition:0.2s; flex-shrink:0; }
.todo-check.checked { background:var(--main); border-color:var(--main); transform:scale(1.1); }
.todo-text { flex:1; font-weight:bold; color:#555; display:flex; align-items:center; flex-wrap:wrap; gap:5px; }
.todo-meta { font-size:0.75rem; color:#aaa; display:block; width:100%; margin-top:2px; }
.todo-qty { background:#e7f1ff; color:#4e73df; font-weight:bold; font-size:0.8rem; padding:2px 8px; border-radius:12px; border:1px solid #d1e3ff; }
.badge { font-size:0.7rem; padding:2px 6px; border-radius:4px; margin-left:5px; color:white; display:inline-block; }
.badge.sold_out { background:var(--accent-red); }
.badge.skipped { background:var(--accent); color:#555; }
.badge.not_found { background:#858796; }
.list-memo { width: 100%; font-size: 0.75rem; color: #e74a3b; margin-top: 3px; font-weight: normal; display: block; }
.todo-filter { display:flex; gap:8px; margin-bottom:15px; overflow-x:auto; padding-bottom:5px; }
.filter-chip { padding:8px 16px; border-radius:20px; font-size:0.85rem; background:#f0f0f0; color:#888; cursor:pointer; white-space:nowrap; transition:0.2s; font-weight:bold; }
.filter-chip.active { background:var(--main); color:white; box-shadow:0 4px 10px rgba(136,216,176,0.3); }

/* カレンダー */
.calendar-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:15px; font-weight:bold; font-size:1.1rem; }
.calendar-grid { display:grid; grid-template-columns:repeat(7, 1fr); gap:6px; text-align:center; font-size:0.8rem; }
.cal-head { color:#aaa; font-size:0.75rem; padding-bottom:5px; }
.cal-cell { background:#fafafa; border-radius:12px; height:55px; display:flex; flex-direction:column; align-items:center; justify-content:start; padding-top:6px; cursor:pointer; border:2px solid transparent; }
.cal-cell.today { border-color:var(--accent); background:#fffdf5; }
.cal-cell.has-data { background:#f0fff8; color: var(--main-dark); }
.cal-total { font-size:0.65rem; font-weight:bold; margin-top:2px; }
.cal-cell.selected { background:var(--main); color:white; }
.cal-cell.selected .cal-total { color:white; }

.log-item { display:flex; justify-content:space-between; font-size:0.9rem; padding:12px 0; border-bottom:1px dashed #eee; }
.log-meta { color:#aaa; font-size:0.75rem; margin-right:8px; min-width:40px; }
.log-user { font-size:0.7rem; background:#f0f0f0; padding:2px 6px; border-radius:6px; margin-left:6px; color:#888; }

/* モーダル・入力フォーム群 */
.modal { position:fixed; inset:0; background:rgba(255,255,255,0.85); display:none; align-items:center; justify-content:center; z-index:100; backdrop-filter:blur(5px); }
.modal-box { background:white; width:90%; max-width:340px; border-radius:30px; padding:25px; animation:popIn 0.3s; box-shadow: 0 15px 40px rgba(0,0,0,0.1); overflow-y:auto; max-height:90vh; }
@keyframes popIn { from{transform:scale(0.8);opacity:0;} to{transform:scale(1);opacity:1;} }
input, select { width:100%; padding:14px; margin-bottom:15px; border:2px solid #f0f0f0; border-radius:12px; font-size:1rem; box-sizing:border-box; background:#fafafa; transition:0.2s; }
input:focus, select:focus { border-color:var(--main); background:#fff; outline:none; }
.btn-group { display:flex; gap:10px; margin-top:15px; }
button.save { flex:1; background:var(--main); color:white; border:none; padding:14px; border-radius:12px; font-weight:bold; font-size:1rem; cursor:pointer; box-shadow:0 4px 10px rgba(136,216,176,0.4); }
button.cancel { flex:1; background:#f0f0f0; color:#888; border:none; padding:14px; border-radius:12px; cursor:pointer; }
.calc-row { display:flex; gap:10px; } .calc-item { flex:1; }

.template-box { background:#f8f9fa; border-radius:15px; padding:15px; margin-bottom:20px; position:relative; }
.template-label { font-size:0.8rem; font-weight:bold; color:#888; margin-bottom:8px; display:flex; align-items:center; gap:5px; }
.set-btn { display:inline-block; font-size:0.85rem; background:#fff; border:2px solid var(--main); color:var(--main-dark); padding:8px 15px; border-radius:20px; cursor:pointer; font-weight:bold; margin-right:8px; margin-bottom:8px; transition:0.2s; }
.set-btn:active { background:var(--main); color:white; transform:scale(0.95); }
.setting-btn { position:absolute; top:10px; right:10px; font-size:1.2rem; cursor:pointer; color:#aaa; }
.status-actions { display:grid; grid-template-columns:repeat(2, 1fr); gap:10px; margin-bottom:15px; }
.stat-btn { padding:15px; border-radius:12px; font-weight:bold; cursor:pointer; border:none; color:white; display:flex; align-items:center; justify-content:center; gap:5px; font-size:0.9rem; }
.range-wrap { margin-bottom:20px; } .range-wrap label { display:block; margin-bottom:8px; font-weight:bold; color:#555; } .range-wrap input { width:100%; }
.temp-list-item { display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px dashed #eee; }
.temp-del-btn { color:#e74a3b; border:1px solid #e74a3b; background:white; padding:4px 10px; border-radius:15px; cursor:pointer; font-size:0.7rem; }
.new-set-area { background:#f8f9fa; padding:15px; border-radius:15px; margin-top:15px; }
.add-temp-box { background:white; padding:15px; border-radius:15px; border:1px solid #eee; margin-top:10px; }
.add-temp-box input { margin-bottom:8px; width:100%; box-sizing:border-box; }
.add-temp-btn { width:100%; background:#e0f2f1; color:#00695c; padding:12px; border-radius:12px; border:none; font-weight:bold; cursor:pointer; margin-top:5px; transition:0.2s; }
.add-temp-btn:active { transform:scale(0.98); }
.added-items-list { margin:10px 0; font-size:0.85rem; color:#666; }
.added-item-tag { display:inline-block; background:white; padding:4px 10px; border-radius:10px; border:1px solid #eee; margin-right:5px; margin-bottom:5px; font-size:0.8rem; }

/* FAB (フローティングアクションボタン) */
.fab { position: fixed; bottom: 30px; right: 20px; width: 60px; height: 60px; background: var(--main); border-radius: 50%; color: white; font-size: 2rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 20px rgba(136, 216, 176, 0.4); cursor: pointer; z-index: 1000; transition: transform 0.2s; }
.fab:active { transform: scale(0.9); }

/* スタンプパレット用デザイン */
.stamp-grid { display: flex; gap: 6px; justify-content: center; }
.stamp-btn { flex: 1; padding: 12px 2px; text-align: center; border-radius: 12px; background: #f8f9fa; color: #888; font-weight: bold; cursor: pointer; transition: 0.2s; border: 2px solid #eee; font-size: 0.8rem; }
.stamp-btn.active { transform: scale(1.05); box-shadow: 0 4px 10px rgba(0,0,0,0.1); border-color: var(--main); background: #f0fff8; color: var(--main-dark); }

/* 洗濯機パネルの履歴エリア */
.laundry-history-container {
    margin: 10px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.5); /* 半透明の白 */
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    text-align: left;
}

/* 履歴の各行 */
.history-item {
    display: flex;
    gap: 10px;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px dotted #eee;
}

.history-item:last-child {
    border-bottom: none;
}

/* 最終更新まわり */
.laundry-footer {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed #ddd;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: #999;
}

.refresh-btn {
    background: #f0f0f0;
    border: none;
    border-radius: 20px;
    padding: 4px 12px;
    cursor: pointer;
    transition: 0.3s;
}

.refresh-btn:hover {
    background: #e0e0e0;
}

/* ==========================================
   洗濯機パネル：モダン・エディション
   ========================================== */

.laundry-panel {
    background: #ffffff;
    border-radius: 24px;
    padding: 25px 20px;
    margin: 15px 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* メインステータス：洗濯中・乾燥中 */
#l-user {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--main-dark); /* パステルグリーンの濃い方 */
    letter-spacing: -1px;
    display: block;
    margin-bottom: 5px;
}

/* 工程：現在 洗い中 など */
#l-mode {
    font-size: 1rem;
    color: #5d5d5d;
    background: #f0fff8; /* 薄いグリーンの背景 */
    display: inline-block;
    padding: 4px 16px;
    border-radius: 20px;
    font-weight: bold;
    margin-bottom: 15px;
}

/* タイマーエリア：あと〇分 */
#l-timer-display {
    margin: 10px 0 20px;
    padding: 15px;
    background: #fdfbf7; /* ルートの背景色に合わせる */
    border-radius: 15px;
    border: 1px dashed var(--main);
}

/* アラート：洗剤補充など（手書きメモの重要部分） */
#l-alert {
    margin: 10px 0;
    padding: 12px;
    background: #fff5f5;
    border: 1px solid #ffdbdb;
    border-radius: 12px;
    color: #e74a3b; /* アクセントレッド */
    font-weight: bold;
    font-size: 0.9rem;
    display: none; /* 平時は非表示 */
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* お知らせ履歴リスト（メンテナンス関係） */
.laundry-history-container {
    margin-top: 15px;
    padding: 15px;
    background: #fafafa;
    border-radius: 12px;
    text-align: left;
    border: 1px solid #f0f0f0;
}

.history-item {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    color: #777;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #f0f0f0;
}

.history-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.history-time {
    color: #bbb;
    font-family: monospace;
    font-weight: bold;
}

/* フッター：同期と更新ボタン */
.laundry-footer {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #aaa;
}

.refresh-btn {
    background: var(--main);
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 16px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(136, 216, 176, 0.3);
    transition: 0.2s;
}

.refresh-btn:active {
    transform: scale(0.95);
}