/* ============================
   基本スタイル・変数定義
   ============================ */


:root {
    --header-height: 60px;
    --footer-height: 65px;
    --primary-color: #f8f9fa; /* 薄いグレー */
    --accent-color: #007bff;
    --border-color: #ddd;
}

/* ... (bodyなどの設定はそのまま) ... */

/* --- ヘッダー --- */
header {
    background-color: var(--primary-color); /* ★白から薄いグレーに変更 */
    border-bottom: 1px solid #ddd;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    flex-shrink: 0;
    z-index: 10;
    box-sizing: border-box; /* ヘッダー自体の高さズレ防止 */
}

/* --- ヘッダー内のボタン統一スタイル (左右・中央) --- */
.nav-btn,
.header-title-btn,
#app-header-date, 
#day-prev, 
#day-next {
    /* サイズと配置の強制統一 */
    height: 44px !important;
    box-sizing: border-box !important; /* ★最重要: paddingを高さに含める */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;

    /* 見た目の統一 */
    background-color: #fff !important;
    border: 1px solid #ddd !important;
    border-radius: 30px !important; /* 完全なカプセル型 */
    color: #333 !important;
    font-size: 13px !important;
    font-weight: bold !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05) !important;
    
    cursor: pointer;
    transition: all 0.2s ease;
}

/* 左右ボタンの余白 */
.nav-btn, #day-prev, #day-next {
    padding: 0 12px !important;
    width: auto !important;
}

/* 中央ボタンの余白 */
.header-title-btn, #app-header-date {
    padding: 0 20px !important;
    flex-direction: column !important; /* 文字数が増えても崩れにくいように */
}

/* 押した時のリアクション */
.nav-btn:active, .header-title-btn:active,
#day-prev:active, #day-next:active, #app-header-date:active {
    background-color: #f0f0f0 !important;
    transform: translateY(1px);
    box-shadow: none !important;
}

/* 中央のタイトル（日付）ボタン */
.header-title-btn {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;       /* カプセル型 */
    padding: 0 20px;
    
    color: #333;               /* 黒文字 */
    font-size: 14px;
    font-weight: bold;
    
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    
    height: 44px;              /* ★高さ固定 */
    box-sizing: border-box;
}

.header-title-btn:active {
    background-color: #f0f0f0;
    transform: translateY(1px);
    box-shadow: none;
}

/* ★追加: 日付をボタンらしく見せる */
#app-header-date {
    font-weight: bold;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
}
#app-header-date:active {
    background-color: #f0f0f0;
}

/* --- メインコンテンツ --- */
#main-container {
    flex: 1; overflow-y: auto; position: relative; background: #fff;
    -webkit-overflow-scrolling: touch; 
}

/* ディボーション表示エリア */
#devotion-view {
    padding: 20px;
    padding-bottom: 150px; /* ボタンが浮いている分、下を空ける */
    max-width: 800px; margin: 0 auto;
}

@media (max-width: 600px) {
    #devotion-view { padding: 15px; padding-bottom: 160px; }
    .devotion-content { font-size: 1rem; line-height: 1.7; text-align: left; }
}

/* 記事スタイル */
.devotion-title { font-size: 1.5rem; margin-bottom: 15px; color: #2c3e50; line-height: 1.3; font-weight: bold; }
.bible-verse { 
    background-color: #f0f4f8; padding: 15px; border-left: 4px solid #007bff; 
    margin-bottom: 20px; font-style: italic; line-height: 1.6; color: #444; font-size: 0.95rem;
}
.devotion-content { 
    line-height: 1.8; font-size: 1rem; text-align: justify; 
    white-space: pre-wrap; margin-bottom: 30px;
}
.no-data { text-align: center; color: #999; margin-top: 50px; }


/* --- カレンダー画面 --- */
#calendar-view {
    display: none; padding: 10px; padding-bottom: 80px; background: #fff;
    height: 100%; box-sizing: border-box; flex-direction: column;
}
#calendar-view.active { display: flex; }

.calendar-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; margin-bottom: 10px;
}
.calendar-title { font-size: 1.2rem; font-weight: bold; }
.calendar-nav-btn {
    background: none; border: 1px solid #ccc; border-radius: 4px; padding: 5px 15px; cursor: pointer;
}
.calendar-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
    background: #ddd; border: 1px solid #ddd;
}
.cal-cell {
    background: #fff; min-height: 60px; padding: 5px; font-size: 0.9rem;
    display: flex; flex-direction: column; justify-content: flex-start; cursor: pointer; position: relative;
}
.cal-header {
    background: #f0f0f0; text-align: center; font-weight: bold; padding: 5px 0; min-height: auto;
}
.w-sun .day-num { color: red; } .w-sat .day-num { color: blue; }
.is-holiday .day-num { color: red; } .day-num { font-weight: bold; margin-bottom: 2px; }
.holiday-name { font-size: 0.6rem; color: red; line-height: 1; margin-bottom: 2px; }
.has-data-mark {
    width: 6px; height: 6px; background-color: #007bff; border-radius: 50%;
    margin-top: auto; align-self: center;
}
.cal-cell.disabled { background-color: #f9f9f9; color: #ccc; cursor: default; }
.cal-cell.today { background-color: #e6f7ff; border: 2px solid #007bff; }

/* --- フッター (4等分) --- */
#app-footer {
    position: fixed; bottom: 0; left: 0; width: 100%;
    height: var(--footer-height); background-color: var(--primary-color);
    border-top: 1px solid var(--border-color); z-index: 100;
}
.footer-nav {
    display: grid;
    /* grid-template-columns: repeat(4, 1fr);  ← 既存の4分割 */
    grid-template-columns: repeat(5, 1fr);  /* ★これを5に変更 */
    height: 100%;
}
.footer-btn {
    background: none; border: none; display: flex; flex-direction: column;
    align-items: center; justify-content: center; cursor: pointer;
    color: #555; padding: 5px 0; text-decoration: none;
}
.footer-btn:active { background-color: #eee; }
.footer-btn .icon { font-size: 20px; margin-bottom: 4px; }
.footer-btn .label { font-size: 10px; }

/* --- 独立ボタン共通スタイル --- */
/* 左下 (カレンダー) */
.floating-left-btn {
    position: fixed; bottom: 70px; left: 15px; z-index: 75px;
    background: #fff; border: 1px solid #ddd; border-radius: 30px;
    padding: 8px 15px; color: #555; font-size: 0.85rem; font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex; align-items: center; justify-content: center; gap: 6px;
    cursor: pointer; transition: transform 0.1s;
}
.floating-left-btn:active { transform: scale(0.95); background: #f0f0f0; }

/* 右下 (メモ・みんな) */
.floating-right-btn {
    position: fixed; right: 15px; z-index: 75px;
    width: 110px; /* 幅を固定して統一 */
    background: #fff; border: 1px solid #ddd; border-radius: 30px;
    padding: 8px 0; /* 左右paddingは0にして中央寄せ */
    color: #555; font-size: 0.85rem; font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex; align-items: center; justify-content: center; gap: 6px;
    cursor: pointer; transition: transform 0.1s;
}
.floating-right-btn:active { transform: scale(0.95); background: #f0f0f0; }

/* 右上 (文字サイズ変更) */
.font-control-area {
    position: fixed; top: 60px; right: 15px; z-index: 90;
    display: flex; gap: 10px;
}
.font-btn {
    width: 36px; height: 36px;
    border-radius: 50%; /* 丸いボタン */
    background: #fff; border: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    color: #555; font-size: 1.2rem; font-weight: bold;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: transform 0.1s;
}
.font-btn:active { transform: scale(0.95); background: #f0f0f0; }


.icon-lg { font-size: 1.1rem; }

/* --- モーダル --- */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 200;
    display: none; justify-content: center; align-items: flex-end;
}
.modal-overlay.active { display: flex; }

.modal-content {
    background: #fff; width: 100%; max-width: 600px; height: 80vh;
    border-radius: 15px 15px 0 0; display: flex; flex-direction: column;
    padding: 20px; box-sizing: border-box;
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 15px; border-bottom: 1px solid #eee; padding-bottom: 10px;
}
.modal-title { font-weight: bold; font-size: 1.2rem; }
.close-btn { font-size: 1.5rem; cursor: pointer; color: #888; background: none; border: none;}

.list-area {
    flex: 1; overflow-y: auto; margin-bottom: 15px;
    background: #f9f9f9; padding: 10px; border-radius: 8px;
}
.input-area {
    display: flex; gap: 10px; padding-top: 10px; border-top: 1px solid #eee;
}
.text-input {
    flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 4px; resize: none; height: 50px;
}
.send-btn {
    background: #007bff; color: white; border: none; padding: 0 20px;
    border-radius: 4px; font-weight: bold; cursor: pointer;
}
.list-item {
    background: #fff; padding: 10px; margin-bottom: 10px;
    border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    font-size: 0.95rem; line-height: 1.4;
}
.public-item .user-name { font-weight: bold; font-size: 0.8rem; color: #555; margin-bottom: 3px; }

/* メモやコメントの削除ボタン */
.delete-btn {
    font-size: 0.75rem; color: #dc3545; background: none; border: 1px solid #dc3545;
    border-radius: 4px; padding: 2px 8px; cursor: pointer; margin-top: 5px; display: inline-block;
}
.delete-btn:active { background: #dc3545; color: white; }
.memo-text { white-space: pre-wrap; margin-bottom: 5px; }
/* ============================
   ヘッダーボタンの角丸を強制適用
   ============================ */

/* 日付ボタン（中央）と、前へ・次へボタン（左右） */
#app-header-date,
#day-prev,
#day-next {
    border-radius: 30px !important;  /* ★強制的にカプセル型にする */
    
    /* 念のため高さと配置も強制統一 */
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    
    /* 背景と文字色も念押し */
    background-color: #fff !important;
    color: #333 !important;
    border: 1px solid #ddd !important;
}

/* 押した時のへこみ具合 */
#app-header-date:active,
#day-prev:active,
#day-next:active {
    background-color: #f0f0f0 !important;
    transform: translateY(1px);
}

/* 日付ボタン（中央）と、前へ・次へボタン（左右） */
#app-header-date,
#day-prev,
#day-next {
    border-radius: 30px !important;  /* ★強制的にカプセル型にする */
    
    /* 念のため高さと配置も強制統一 */
    height: 44px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    
    /* 背景と文字色も念押し */
    background-color: #fff !important;
    color: #333 !important;
    border: 1px solid #ddd !important;
}

/* 押した時のへこみ具合 */
#app-header-date:active,
#day-prev:active,
#day-next:active {
    background-color: #f0f0f0 !important;
    transform: translateY(1px);
}

/* ============================
   フローティングボタン（横並び修正版）
   ============================ */

/* ★新設: ボタンを横並びにするためのコンテナ */
.floating-btn-container {
    position: fixed;
    bottom: 80px; /* フッター(65px)より少し上 */
    right: 15px;
    z-index: 90;
    
    display: flex;       /* 横並びにする */
    gap: 10px;           /* ボタン同士の間隔 */
    align-items: center; /* 上下中央揃え */
}

/* 既存クラスの修正（右下配置・メモ・みんな共通） */
.floating-right-btn {
    /* position: fixed;  ← 削除（コンテナに任せるため） */
    /* right: 15px;      ← 削除 */
    /* bottom: ...;      ← 削除 */
    
    position: relative;  /* 静的配置に変更 */
    
    /* width: 110px;     ← 固定幅だと横並びできつい場合があるので変更 */
    width: auto;         /* 文字数に合わせる */
    min-width: 90px;     /* 最低限の幅は確保 */
    padding: 8px 15px;   /* 内側の余白を調整 */
    
    background: #fff; 
    border: 1px solid #ddd; 
    border-radius: 30px;
    color: #555; 
    font-size: 0.85rem; 
    font-weight: bold;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    
    display: flex; 
    align-items: center; 
    justify-content: center; 
    gap: 6px;
    cursor: pointer; 
    transition: transform 0.1s;
}

.floating-right-btn:active { 
    transform: scale(0.95); 
    background: #f0f0f0; 
}