.member-list-main-body {
    width: 100%;
    height: calc(100vh - 120px); /* 高さを調整して画面下まで表示されるようにする */
    background: #fff;
    border-radius: 0 0 10px 10px;
    padding: 5px 10px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.main-area {
    display: flex;
    flex-direction: column;
}

/* テーブルコンテナ */
.member-table-container {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* テーブルのスタイル */
.member-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* 固定レイアウトを追加 */
}

/* テーブルヘッダーを固定 */
.member-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: #333333;
    width: 100%; /* 幅を100%に設定 */
}

/* テーブルボディをスクロール可能に */
.member-table-body-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%; /* 幅を100%に設定 */
}

.member-table-body-container .member-table {
    width: 100%;
}

/* ページネーションを下部に固定 */
.pagination {
    margin-top: 10px;
    padding: 10px 0;
    background-color: #fff;
    position: sticky;
    bottom: 0;
    z-index: 1;
}

/* テーブルのスタイル */
.member-table th, 
.member-table td {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    text-align: left;
    overflow: hidden;
    vertical-align: middle;
    white-space: nowrap; /* テキストの折り返しを防ぐ */
    text-overflow: ellipsis; /* 長いテキストを省略記号で表示 */
}

.member-table th {
    background-color: #333333;
    color: white;
    cursor: default;
    position: relative;
}

/* カラム幅の設定 */
.member-table th:nth-child(1),
.member-table td:nth-child(1) { width: 10%; } /* ID */

.member-table th:nth-child(2) { width: 25%; } /* 名前 */

.member-table th:nth-child(3),
.member-table td:nth-child(3) { width: 35%; } /* メールアドレス */

.member-table th:nth-child(4),
.member-table td:nth-child(4) { width: 30%; } /* 電話番号 */

.member-table tr:hover {
    background-color: #f1f1f1;
    cursor: pointer;
}

/* ソート可能なテーブルヘッダを指定するスタイル */
.member-table th.sortable {
    cursor: pointer;
    position: relative;
}

.member-table th.sortable .sort-icon {
    color: #999;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

/* ソート可能なヘッダーのホバー時のスタイル */
.member-table th.sortable:hover {
    background-color: #444; /* ホバー時の背景色 */
}

/* テーブル行のホバー時のスタイル */
.member-table tbody tr:hover {
    background-color: #f9f9f9; /* ホバー時の行の背景色 */
    color: #333; /* ホバー時の行の文字色 */
}

/* デスクトップ・モバイル表示切り替え */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

/* ヘッダーアクション */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 20px;
    padding: 20px 10px 5px;
    background-color: #fff;
    z-index: 5;
}

.search-forms-container {
    flex: 1;
    max-width: 800px;
    margin-bottom: 15px;
}

.search-first-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 入力フィールド共通スタイル */
.search-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    width: 100%;
}

/* 検索ボタン */
.search-button {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    background-color: #d9d8d8;
    color: #333;
    cursor: pointer;
}

.search-button:hover {
    background-color: #0AA273;
    color: white;
}

/* クリアボタンのスタイル */
.clear-button {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    background-color: #f0f0f0;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.clear-button:hover {
    background-color: #ff6b6b;
    color: white;
}

.clear-button i {
    font-size: 14px;
}

/* ページネーションのスタイル */
.pagination button {
    padding: 5px 10px;
    margin: 0 5px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 5px;
    background-color: #d9d8d8;
    color: #333333;
    border: none;
}

.pagination button:hover {
    color: #fff;
    background-color: #0AA273;
}

.pagination button:active {
    color: #fff;
    background-color: #0AA273;
}

.pagination button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#pageIndicator {
    font-size: 14px;
    color: #333;
}

/* レスポンシブ対応 */
@media screen and (max-width: 1000px) {
    .member-table th,
    .member-table td,
    .pagination button,
    #pageIndicator {
        font-size: 14px;
    }
}

@media screen and (max-width: 768px) {
    .member-table th,
    .member-table td {
        font-size: 13px;
        padding: 6px;
    }
    
    /* 特定のカラムのみ表示 */
    .member-table th:nth-child(3),
    .member-table td:nth-child(3) {
        display: none;
    }
    
    /* カラム幅の再調整 */
    .member-table th:nth-child(1),
    .member-table td:nth-child(1) { width: 15%; } /* ID */
    .member-table th:nth-child(2) { width: 35%; } /* 名前 */
    .member-table th:nth-child(3),
    .member-table td:nth-child(3) { width: 50%; } /* 電話番号 */

    .member-table td:nth-child(2) { width: 100%; } /* 名前 */
    
    /* 名前のアイコンを非表示 */
    .user-icon {
        display: none;
    }
    
    /* テーブルのレイアウト調整 */
    .member-table {
        width: 100%;
        table-layout: fixed;
    }
    
    /* テキストを複数行で表示 */
    .member-table td {
        white-space: normal;
        word-break: break-word;
    }
    
    .search-form {
        max-width: 100%;
    }
}

@media screen and (max-width: 739px) {
    .member-table th,
    .member-table td,
    .pagination button,
    #pageIndicator {
        font-size: 12px;
    }
    
    .search-form {
        max-width: 100%;
    }
    
    .member-table th,
    .member-table td {
        padding: 8px;
    }
}

/* 画面幅480px以下での表示調整 */
@media screen and (max-width: 480px) {
    .header-actions {
        display: flex;
        flex-direction: column;
        padding: 10px;
        gap: 10px;
    }
    
    .search-forms-container {
        width: 100%;
        margin-bottom: 0;
    }
    
    .search-first-row {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 8px;
    }
    
    .search-form {
        flex: 1;
        min-width: 0;
    }
    
    .search-input {
        width: 100%;
        min-width: 0;
    }
    
    .clear-button {
        flex-shrink: 0;
        white-space: nowrap;
        height: 32px;
        font-size: 12px;
        padding: 6px 8px;
    }
    
    /* デスクトップ・モバイル表示切り替え */
    .mobile-only {
        display: block;
    }
    
    .desktop-only {
        display: none;
    }
    
    /* 3行目：新規作成ボタンのみ（右寄せ） */
    .search-third-row {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        width: 100%;
        margin-top: 0;
    }
    
    .search-third-row .new-member-button {
        font-size: 12px;
        padding: 5px 20px;
        white-space: nowrap;
        width: auto;
    }
    /* ソートアイコンを非表示にする */
    .member-table th.sortable .sort-icon {
        display: none;
    }
    
    /* ソートアイコンを非表示にした際のパディング調整 */
    .member-table th.sortable {
        padding-right: 8px;
    }
    
    /* テーブル文字サイズをさらに小さく */
    .member-table th,
    .member-table td,
    .pagination button,
    #pageIndicator {
        font-size: 11px;
    }
    
    /* セルのパディングを減らして表示スペースを確保 */
    .member-table th,
    .member-table td {
        padding: 6px 4px;
    }
    
    /* 検索ボタンのパディング調整 */
    .search-button,
    .clear-button {
        padding: 6px 8px;
        font-size: 12px;
    }

    .member-list-main-body {
        height: 90%;
    }

    .pagination {
        margin-top: 0;
    }
    /* カラム幅の再調整 */
    .member-table th:nth-child(1),
    .member-table td:nth-child(1) { width: 15%; } /* ID */
    .member-table th:nth-child(2) { width: 55%; } /* 名前 */
    .member-table th:nth-child(3),
    .member-table td:nth-child(3) { width: 30%; } /* 電話番号 */

    .member-table td:nth-child(2) { width: 100%; } /* 名前 */
    
    /* 新規作成ボタンをモバイルで調整 */
    .new-member-button {
        font-size: 14px;
        padding: 8px 15px;
    }
    
    /* 検索フォームのレイアウト調整 */
    .search-first-row {
        gap: 10px;
        margin-bottom: 5px;
    }
    
    .search-input {
        width: 200px;
    }
    
    /* モーダルをモバイル対応 */
    .modal-content {
        width: 95%;
        margin: 2% auto;
        padding: 20px;
    }
    
    .modal-content h3 {
        font-size: 20px;
    }
    
    .form-buttons {
        flex-direction: column;
        gap: 10px;
    }
    
    .cancel-btn,
    .save-btn {
        width: 100%;
        padding: 12px;
    }
}

.sort-icon {
    margin-left: 5px;
    display: inline-block;
}

th.sortable {
    cursor: pointer;
    position: relative;
}

th.sortable .sort-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
}

th.sortable:hover {
    background-color: #444;
}

.username-cell {
    display: flex;
    align-items: center; /* アイコンとテキストを中央揃え */
}

.user-icon {
    width: 30px; /* アイコンの幅 */
    height: 30px; /* アイコンの高さ */
    border-radius: 50%; /* 丸型にする */
    margin-right: 8px; /* テキストとの間隔 */
}

/* 新規作成ボタン */
.new-member-button {
    padding: 10px 20px;
    background-color: #0AA273 !important;
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: none;
    outline: none;
}

.new-member-button:hover,
.new-member-button:focus {
    background-color: #035c38 !important;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border: none;
    border-radius: 8px;
    width: 90%;
    max-width: 600px !important;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
}

.modal-content h3 {
    margin-top: 20px;
    margin-bottom: 20px;
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
    box-sizing: border-box;
}

.form-textarea {
    min-height: 80px;
    resize: vertical;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: #0AA273;
    box-shadow: 0 0 0 2px rgba(10, 162, 115, 0.2);
}

.form-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.cancel-btn,
.save-btn {
    padding: 10px 25px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cancel-btn {
    background-color: #6c757d;
    color: white;
}

.cancel-btn:hover {
    background-color: #5a6268;
}

.save-btn {
    background-color: #0AA273;
    color: white;
}

.save-btn:hover {
    background-color: #035c38;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    position: absolute;
    top: 15px;
    right: 20px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
}

.close:hover,
.close:focus {
    color: #000;
    background-color: #f0f0f0;
    text-decoration: none;
}

/* アイコンアップロード用スタイル */
.member-icon-container {
    display: flex;
    justify-content: center;
    margin: 10px 0;
}

.member-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid #ddd;
    transition: all 0.3s ease;
}

.member-icon-wrapper:hover {
    border-color: #0AA273;
}

.member-icon-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.icon-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    text-align: center;
    padding: 5px;
    font-size: 10px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.member-icon-wrapper:hover .icon-overlay {
    transform: translateY(0);
}
