
body, html {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

* {
            box-sizing: inherit;
        }

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden; /* スクロールを適切に処理 */
}

header {
    position: fixed; /* 画面の上部に固定 */
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1100; /* 他の要素より前面に表示 */
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background-color: #f4f4f4;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    line-height: normal; /* 不要な高さを削除 */
}

.group-selector label {
    font-weight: bold;
    margin-right: 5px;
}

.total-counter {
   font-size: 1.5rem;
    font-weight: bold;
    white-space: nowrap; /* テキストの改行を防止 */
    overflow: visible; /* テキストが表示されるように */
    text-overflow: ellipsis; /* テキストが長すぎる場合に省略記号を表示 */
    max-width: 100%; /* 親要素の幅に収まる */
    margin-left: auto; /* 右寄せを確保 */
    margin-right: 30px; /* 余白を追加して切れを防止 */
}

main {
    flex: 1;
    padding: 80px 20px; /* ヘッダーとフッターを避けるために上部と下部にスペースを確保 */
    overflow-y: auto; /* コンテンツがあふれた場合にスクロール可能にする */
    background-color: #fff;
    padding-top: 35px; /* ヘッダーの高さ分 */
    padding-bottom: 60px; /* フッターの高さ分 */
}

.counter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
    background-color: #fafafa;
}

.counter-info {
    flex: 1;
    font-size: 1rem;
    margin-right: 10px;
    
}

.counter-value {
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 80px;
}

c-button {
    font-size: 1rem;
    padding: 5px 10px;
    margin: 0 5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    background-color: #aaaaaa;
    color: white;
}

#c-button {
    background-color: #477f50; /* 緑色 */
}

button {
    font-size: 1rem;
    padding: 5px 10px;
    margin: 0 5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

d-button {
    font-size: 0.5rem;
    padding: 2.5px 5px;
    margin: 0 5px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    
}

button:hover {
    opacity: 0.8;
}

button:active {
    transform: scale(0.98);
}

.delete-button {
    background-color: #ff6b6b;
    color: white;
}

function_btn{
    display: flex;
    justify-content: flex-start;
    padding: 10px 20px;
    background-color: #4caf50;
    border-top: 1px solid #ddd;
}

footer {
    position: fixed; /* 画面の下部に固定 */
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1100; /* 他の要素より前面に表示 */
    display: flex;
    justify-content: flex-start;
    padding: 10px 20px;
    background-color: #f4f4f4;
    border-top: 1px solid #ddd;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

footer button {
    font-size: 1.5rem;
    background-color: #4caf50;
    color: white;
}

footer button:nth-child(2) {
    background-color: #2196f3;
}

#modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    z-index: 1200; /* フローティングボタンやヘッダー、フッターより前面に表示 */
    transition: visibility 0.3s, opacity 0.3s;
}

#modal .modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 400px;
}

#modal .modal-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
}

#modal .modal-buttons button {
    flex: 1;
    margin: 0 5px;
}

#modal.hidden {
    visibility: hidden;
    opacity: 0;
}

#modal:not(.hidden) {
    visibility: visible;
    opacity: 1;
}

/* 新規履歴モーダル */
#history-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    padding: 20px;
    display: none; /* 初期状態は非表示 */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#history-modal:not(.hidden) {
    display: block; /* 表示状態に切り替え */
}
/* 履歴リストのスタイル */
#history-list {
    list-style-type: none;
    padding: 0;
    margin: 10px 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

#history-list li {
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

#history-list li:last-child {
    border-bottom: none;
}

/* モーダルの閉じるボタン */
#close-history {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 1rem;
    color: #fff;
    background-color: #ff6b6b;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: block;
    width: 100%;
}

#close-history:hover {
    background-color: #e54e4e;
}

#close-history:active {
    transform: scale(0.98);
}

/* フローティングボタンのスタイル */
.floating-btn {
    position: fixed;
    bottom: 80px; /* フッターの高さを考慮 */
    width: 60px;
    height: 60px;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 900; /* ヘッダー・フッターより背面だがモーダルより前面 */
    transition: background-color 0.3s ease, transform 0.2s ease;
}

#addCounter {
    left: 20px; /* 横並びで少し右に移動 */
    background-color: #2196f3; /* 青色 */
}

#addCounter:hover {
    background-color: #1976d2; /* 濃い青色 */
}

#resetCounters {
    left: 100px; /* 横並びでさらに右に移動 */
    background-color: #ff9800; /* オレンジ色 */
}

#resetCounters:hover {
    background-color: #e65100; /* 濃いオレンジ色 */
}

#memo-btn {
    left: 180px; /* 左からの位置 */
    background-color: #477f50; /* 緑色 */
}

#memo-btn:hover {
    background-color: #45a049; /* 濃い緑色 */
}

#view-history {
    left: 260px; /* 左からの位置 */
    background-color: #4caf50; /* 緑色 */
}

#view-history:hover {
    background-color: #45a049; /* 濃い緑色 */
}



.floating-btn:hover {
    background-color: #45a049;
}

.floating-btn:active {
    transform: scale(0.9);
}

.hidden_memo {
    display: none;
}

/* メモ全体のコンテナ */
#groupMemo {
    position: fixed;
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    height: auto;
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

/* メモの入力エリア */
#groupMemoText {
    width: 100%;
    height: 65vh;
    font-size: 18px;
    padding: 10px;
    border: 2px solid #ccc;
    border-radius: 8px;
    resize: none; /* リサイズ無効化 */
    outline: none;
}

/* ボタンの配置 */
.memo-buttons {
    position: fixed;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1001; /* メモより前面に配置 */
}

/* ボタンのデザイン */
#saveMemo, #closeMemo {
    padding: 10px 20px;
    font-size: 16px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin: 5px;
    transition: background 0.3s ease;
}

#saveMemo {
    background: #007bff;
    color: white;
}

#closeMemo {
    background: #dc3545;
    color: white;
}

#saveMemo:hover {
    background: #0056b3;
}

#closeMemo:hover {
    background: #b02a37;
}

#segment-container {
            flex: 1;
            overflow: auto; /* 必要に応じてスクロール可能にする */
        }

.segment-content {
            display: none;
        }
.segment-content.active {
            display: block;
        }

.counter {
    display: flex;
    flex-direction: column; /* 要素を縦に並べる */
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
    background-color: #fafafa;
    width: 100%; /* 幅を親要素に合わせる */
    box-sizing: border-box;
}

.counter-info {
    text-align: center;
    font-size: 1rem;
    margin-bottom: 10px;
}

.counter-value {
    font-size: 2rem; /* カウント値を強調 */
    font-weight: bold;
    margin: 5px 0;
}

.counter-last-updated {
    font-size: 0.8rem;
    color: #888;
}

.counter-buttons {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 300px; /* ボタン部分の最大幅を設定 */
    margin-top: 10px;
}

.counter-buttons button {
    flex: 1; /* ボタンを均等に並べる */
    margin: 0 5px;
    padding: 10px;
    font-size: 1.2rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.counter-buttons button:hover {
    opacity: 0.9;
}

.counter-buttons button:active {
    transform: scale(0.95);
}

.increment-button {
    background-color: #4caf50;
    color: white;
}

.decrement-button {
    background-color: #2196f3;
    color: white;
}

.delete-button {
    background-color: #ff6b6b;
    color: white;
}

/* 小さい画面向け調整 */
@media screen and (max-width: 480px) {
    .counter {
        padding: 8px;
    }

    .counter-info {
        font-size: 0.9rem;
    }

    .counter-value {
        font-size: 1.8rem;
    }

    .counter-buttons button {
        font-size: 1rem;
        padding: 8px;
    }
}

.segment-content {
    display: none;
}
.segment-content.active {
    display: block;
}
.tab-buttons button.active {
    background-color: #007bff;
    color: white;
    font-weight: bold;
}

/* 📌 スマホ向け調整 */
@media screen and (max-device-width: 480px) {
    /* 📌 テーブル全体を画面幅いっぱいに調整 */
    #counter-info-table-container {
        width: 100%;
        max-width: 100vw;
        overflow-x: auto; /* スクロールできるように */
        display: block;
        box-sizing: border-box;
    }

    /* 📌 テーブルの見た目調整 */
    #counter-info-table {
        table-layout: auto; /* 自動調整 */
        width: 100%;
        max-width: none; /* 画面幅を超えない */
        min-width: 100%; /* 画面いっぱいに広げる */
        border-collapse: collapse;
        display: table; /* 正常にレイアウトする */
        font-size: 0.9rem; /* スマホでは少し小さめのフォント */
        word-break: break-word; /* セル内の長いテキストを折り返す */
    }

    /* 📌 ヘッダー固定 */
    #counter-info-table thead {
        position: sticky;
        top: 0;
        background: #4CAF50; /* 緑色 */
        color: white;
        z-index: 1000;
    }

    /* 📌 テーブルのセルデザイン */
    #counter-info-table th, #counter-info-table td {
        font-size: 0.9rem;
        padding: 12px;
        text-align: center;
        word-break: keep-all;
        white-space: nowrap; /* 折り返し防止 */
    }
    
    #counter-info-table th, #user-info-table th {
        min-width: 70px;
        font-size: 0.9rem;
    }
    
    /* 📌 非表示行のスタイル */
    .hidden-row {
        display: none !important;
    }
    
    /* 曜日タブのデザイン */
    .day-tab {
        padding: 8px 12px;
        margin: 0 5px;
        border: none;
        border-radius: 50px;
        background-color: #ddd;
        cursor: pointer;
        transition: background 0.3s;
        font-size: 0.8rem;
    }

    .day-tab.active {
        background-color: #4CAF50; /* 緑色 */
        color: white;
        font-weight: bold;
    }

    .day-tab:hover {
        background-color: #bbb;
    }

}

/* ======== スマホ向けレスポンシブ（横スクロールを確実にする） ======== */
@media screen and (max-width: 768px) {
    #user-info-table-container {
        overflow-x: auto;
        display: block;
        width: 100%;
    }
    
    #user-info-table, #counter-info-table {
        display: block;
        min-width: 600px; /* スマホでも横スクロールできるように */
    }
}

/* ======== テーブル本体のデザイン（統一） ======== */
#counter-info-table {
    width: 100%;
    max-width: none; /* 画面幅を超えない */
    min-width: 100%; /* 画面いっぱいに広げる */
    border-collapse: collapse;
    table-layout: auto; /* セル幅を自動調整 */
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
}

#user-info-table {
    min-width: 800px; /* 最小幅を設定（適宜調整） */
    border-collapse: collapse;
    width: 100%;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
}

/* ======== テーブルコンテナ（スクロール可能にする） ======== */
#user-info-table-container{
    overflow-x: auto;
    width: 100%;
    max-width: 100vw; /* ビューポート幅を超えないように */
    min-width: 100%; /* 画面いっぱいに広げる */
    white-space: nowrap; /* 折り返しを防ぐ */
    display: block; /* 確実に横スクロールできるように */
}

#counter-info-table-container {
    overflow-x: auto;
    width: 100%;
    max-width: 100vw; /* ビューポート幅を超えないように */
    white-space: nowrap; /* 折り返しを防ぐ */
    display: block; /* 確実に横スクロールできるように */
}


/* ======== ヘッダーとセルデザイン（統一） ======== */
#user-info-table th, #user-info-table td,
#counter-info-table th, #counter-info-table td {
    border: 1px solid #ccc;
    padding: 12px;
    text-align: center;
    font-size: 14px;
    white-space: nowrap; /* 折り返し防止 */
}

/* ヘッダー（共通） */
#user-info-table th, #counter-info-table th {
    background: #4CAF50; /* 緑色で統一 */
    font-weight: bold;
    color: white;
    width: auto; /* セルの幅を自動調整 */
    min-width: 80px; /* ある程度の最小幅を確保 */
    max-width: 200px; /* 長すぎる場合の制限 */
    white-space: nowrap; /* 折り返しを防止 */
    text-align: center;
}

/* ヘッダーとセルデザイン */
#counter-info-table th, #counter-info-table td {
    border: 1px solid #ccc;
    font-size: 10.5px;
}

#counter-info-table th {
    font-weight: bold;
    color: white;
    background-color: #4CAF50; /* 背景色を白以外にしてスクロール時も見やすく */
}

/* 偶数行（共通） */
#user-info-table tr:nth-child(even),
#counter-info-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* ホバー時のデザイン（共通） */
#user-info-table tr:hover,
#counter-info-table tr:hover {
    background-color: #f0f0f0;
    transition: 0.3s;
}

/* ======== スクロールバーのカスタマイズ（iPhone対応） ======== */
#user-info-table-container::-webkit-scrollbar,
#counter-info-table-container::-webkit-scrollbar {
    height: 8px;
}

#user-info-table-container::-webkit-scrollbar-thumb,
#counter-info-table-container::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.hidden-counter {
    display: none !important;
}



#counter-date-picker {
    font-size: 16px;
    padding: 5px;
    border-radius: 5px;
    border: 1px solid #ccc;
}

/* 📌 偶数行の背景色 */
#counter-info-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* 📌 ホバー時の背景 */
#counter-info-table tr:hover {
    background-color: #f0f0f0;
    transition: 0.3s;
}

/* 📌 テーブルヘッダーを固定 */
#counter-info-table thead tr {
    position: sticky;
    top: 0;
    background-color: #4CAF50;
    color: white;
    z-index: 100;
}

/* 📌 スクロール時にヘッダーを固定 */
#counter-info-table thead {
    position: sticky;
    top: 0;
    background: #4CAF50; /* 緑色 */
    z-index: 1000; /* 他の要素より前面に */
}

/* 📌 非表示行のスタイル */
.hidden-row {
    display: none !important;
}

/* 曜日タブのデザイン */
.day-tab {
    padding: 8px 12px;
    margin: 0 5px;
    border: none;
    border-radius: 50px;
    background-color: #ddd;
    cursor: pointer;
    transition: background 0.3s;
    font-size: 0.8rem;
}

.day-tab.active {
    background-color: #4CAF50; /* 緑色 */
    color: white;
    font-weight: bold;
}

.day-tab:hover {
    background-color: #bbb;
}



