/* 絞り込みボタンのスタイル */
.filter-button-container {
    margin: 20px 0;
    text-align: center;
}

.filter-popup-button {
    background-color: var(--cocoon-main-color, #4CAF50);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    transition: background-color 0.3s;
}

.filter-popup-button:hover {
    background-color: var(--cocoon-main-color-hover, #45a049);
    opacity: 0.8;
}

.filter-popup-button i {
    margin-right: 8px;
}

/* ポップアップのスタイル */
.filter-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7); /* 背景をより暗くして視認性アップ */
    
    overflow: auto;
}

.filter-popup-content {
    background-color: white;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3); /* 影を濃くして浮き出させる */
    position: relative;
    max-height: 60vh;
    overflow-y: auto;
}

/* ポップアップ表示時のボディスタイル */
body.popup-open {
    overflow: hidden; /* スクロール防止 */
}

/* グローバルポップアップのスタイル */
#global-filter-popup {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: rgba(0, 0, 0, 0.8) !important;
    z-index: 9999999999 !important;
    display: none;
    overflow: auto !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: inherit !important;
    line-height: normal !important;
}

#global-filter-popup * {
    z-index: 9999999999 !important;
    font-family: inherit !important;
    line-height: normal !important;
    box-sizing: border-box !important;
}

/* ポップアップ内のスタイル */
#global-filter-popup .filter-popup-content {
    background-color: white !important;
    margin: 5% auto !important;
    padding: 20px !important;
    border-radius: 8px !important;
    width: 90% !important;
    max-width: 600px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
    position: relative !important;
}

/* スクロール防止 */
body.popup-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}
.filter-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.filter-popup-header h3 {
    margin: 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    color: var(--cocoon-text-color, #333);
}

.filter-popup-header h3 i {
    margin-right: 8px;
    color: var(--cocoon-main-color, #4CAF50);
}

.close-popup:hover {
    color: #333;
}

/* フィルターオプションのスタイル */
.filter-group {
    margin-bottom: 20px;
}

.filter-label {
    font-weight: bold;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    color: var(--cocoon-text-color, #333);
}

.filter-label i {
    margin-right: 8px;
    color: var(--cocoon-main-color, #4CAF50);
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.filter-button {
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 30px;
    padding: 5px 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-button:hover {
    background-color: #e9e9e9;
}

.filter-button.selected {
    background-color: var(--cocoon-main-color, #4CAF50);
    color: white;
    border-color: var(--cocoon-main-color, #4CAF50);
}

.no-filters-message {
    color: #777;
    font-style: italic;
    margin: 5px 0;
    font-size: 13px;
}

/* 絞り込みアクションボタン */
.filter-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.apply-filter-button {
    background-color: var(--cocoon-main-color, #4CAF50);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
}

.apply-filter-button:hover {
    background-color: var(--cocoon-main-color-hover, #45a049);
    opacity: 0.8;
}

.reset-filter-button {
    background-color: #f44336;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
}

.reset-filter-button:hover {
    background-color: #d32f2f;
    opacity: 0.8;
}

.apply-filter-button i,
.reset-filter-button i {
    margin-right: 8px;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .filter-popup-content {
        width: 95%;
        margin: 5% auto;
        padding: 15px;
    }
    
    .filter-popup-header h3 {
        font-size: 16px;
    }
    
    .filter-button {
        font-size: 12px;
        padding: 4px 8px;
    }
    
    .filter-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .apply-filter-button,
    .reset-filter-button {
        width: 100%;
        justify-content: center;
    }
}

/* ダークモード対応 (オプション) */
.body.darkmode .filter-popup-content {
    background-color: #333;
    color: #f5f5f5;
}

.body.darkmode .filter-popup-header h3,
.body.darkmode .filter-label {
    color: #f5f5f5;
}

.body.darkmode .filter-button:not(.selected) {
    background-color: #444;
    border-color: #555;
    color: #f5f5f5;
}

.body.darkmode .close-popup {
    color: #ccc;
}

.body.darkmode .close-popup:hover {
    color: #fff;
}

.body.darkmode .no-filters-message {
    color: #ccc;
}

.body.darkmode .filter-popup-header,
.body.darkmode .filter-actions {
    border-color: #555;
}

/* Font Awesomeアイコンの表示を保証 */
#global-filter-popup .fas,
#global-filter-popup .fa,
#global-filter-popup .far,
#global-filter-popup .fab {
    font-family: "Font Awesome 5 Free", "Font Awesome 5 Brands", FontAwesome !important;
    font-style: normal !important;
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#global-filter-popup .fas:before,
#global-filter-popup .fa:before,
#global-filter-popup .far:before,
#global-filter-popup .fab:before {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* 検索ボックスのスタイル */
.search-filter-group {
    margin-bottom: 20px;
}

.search-box-container {
    margin-bottom: 15px;
}

.filter-popup .search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

.filter-popup .search-input:focus {
    border-color: var(--cocoon-main-color, #4CAF50);
    outline: none;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

/* 検索アイコンの表示を確保 */
.search-filter-group .filter-label i {
    color: var(--cocoon-main-color, #4CAF50);
}

/* ポップアップ内のUI改善 */
.filter-popup {
    z-index: 2147483647 !important; /* 最大可能なz-index値 */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.7) !important;
}

.filter-popup-content {
    z-index: 2147483647 !important;
    position: relative !important;
    margin: 5% auto !important;
    width: 90% !important;
    max-width: 600px !important;
    background: white !important;
    padding: 20px !important;
    border-radius: 8px !important;
    max-height: 60vh !important;
    overflow-y: auto !important;
}

/* 検索ボックスのデザイン改善 */
.search-filter-group {
    margin-bottom: 20px !important;
}

.search-box-container {
    margin-bottom: 15px !important;
    width: 100% !important;
}

.search-input {
    width: 100% !important;
    padding: 10px !important;
    font-size: 16px !important;
    border: 1px solid #ddd !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
}

/* フィルターオプションの表示改善 */
.filter-options {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.filter-button {
    position: relative !important;
    z-index: 2147483647 !important;
}

/* 絞り込みボタンを確実に表示 */
.filter-actions {
    display: flex !important;
    justify-content: space-between !important;
    margin-top: 20px !important;
    position: relative !important;
    z-index: 2147483647 !important;
}

.apply-filter-button,
.reset-filter-button {
    position: relative !important;
    z-index: 2147483647 !important;
}

/* 絞り込みボタンを100%幅に設定 */
.filter-button-container {
    width: 95%;
    margin: 20px 0;
    text-align: center;
}

.filter-popup-button {
    width: 95%;
	margin-top:10px !important;
    background-color: var(--cocoon-main-color, #4CAF50);
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.filter-popup-button:hover {
    background-color: var(--cocoon-main-color-hover, #45a049);
    opacity: 0.9;
}

.filter-popup-button i {
    margin-right: 8px;
}

/* 絞り込みボタンの上下の間隔を調整 */
.filter-button-container {
    width: 100%;
    margin: 30px 0; /* 上下のマージンを増やす（20pxから30pxに変更） */
    text-align: center;
}

/* モバイル端末では少し小さめのマージンにする（オプション） */
@media (max-width: 768px) {
    .filter-button-container {
        margin: 25px 0;
    }
}

/* 検索結果が0件の場合のスタイル */
.filter-message {
    text-align: center;
    padding: 15px;
    margin: 10px 0;
    background-color: #f8f9fa;
    border-radius: 5px;
    color: #6c757d;
    font-weight: normal;
}

/* フィルターボタンコンテナのレスポンシブ対応 */
.filter-button-container {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

/* ポップアップが正しく表示されるようにする */
.filter-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

/* フィルター表示がない場合でもポップアップのサイズを維持 */
.filter-popup-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 600px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 20px;
}

/* リアルタイム検索用スタイル */
.loading-indicator {
    text-align: center;
    padding: 10px;
    color: #6c757d;
    font-style: italic;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin: 5px 0;
}

.filter-message {
    text-align: center;
    padding: 10px;
    margin: 5px 0;
    background-color: #f8f9fa;
    border-radius: 5px;
    color: #6c757d;
    font-weight: normal;
}

.filter-message.error {
    background-color: #f8d7da;
    color: #721c24;
}

/* フィルターグループの最小高さ設定 */
.filter-options {
    min-height: 50px;
}