/* ポップアップオーバーレイ */
#filterOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.15); /* 最も薄い黒の透明度 */
    backdrop-filter: blur(2px); /* 軽いぼかし効果を追加 */
    z-index: 999;
    display: none;
}

/* フィルターエリアポップアップ */
#filterArea.popup-active {
    position: fixed;
    top: 20px; /* 固定値で上部に余白を確保 */
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff; /* 明確に白を指定 */
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08); /* さらに薄い影 */
    z-index: 1000;
    width: 90vw;
    max-width: 1200px;
    height: calc(100vh - 40px); /* 画面高さから上下の余白を引く */
    max-height: calc(100vh - 40px);
    overflow-y: auto; /* スクロール可能に */
    overflow-x: hidden;
    padding: 20px;
    display: flex !important;
    flex-direction: column;
}

/* フィルターエリア内のコンテナ */
#filterArea.popup-active .container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow-y: auto; /* 内部コンテンツもスクロール可能に */
    padding-right: 10px; /* スクロールバー分の余白 */
    background: #ffffff; /* 明確に白を指定 */
}

/* セクション背景を明るく */
#filterArea.popup-active section {
    background: #ffffff;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 6px;
    border: none !important; /* ボーダーを削除 */
    border-bottom: none !important; /* 下部ボーダーを明示的に削除 */
}

/* 既存のボーダースタイルを上書き */
#filterArea.popup-active section.spN,
#filterArea.popup-active section.rangeBar,
#filterArea.popup-active section.acodian-group {
    border: none !important;
    border-bottom: none !important;
}

#filterArea.popup-active .sectionT {
    background: #e9ecef; /* 少し濃いグレー */
    padding: 10px 15px;
    margin: -15px -15px 15px -15px;
    border-radius: 6px 6px 0 0;
    border: none;
    border-bottom: none;
}

/* チェックボックスグループの背景 */
#filterArea.popup-active .checkbox-group {
    background: #ffffff;
}

/* 検索ボックスエリア */
#filterArea.popup-active .search-container {
    background: #ffffff;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 6px;
    border: 1px solid #e0e0e0;
}

#filterArea.popup-active .search-box {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px;
}

/* 閉じるボタン */
.popup-close-btn {
    position: sticky; /* absoluteからstickyに変更 */
    top: 0;
    float: right;
    background: white;
    border: 1px solid #ddd;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
    margin-bottom: 10px;
    z-index: 10;
}

.popup-close-btn:hover {
    background-color: #f0f0f0;
}

/* ボディのスクロール無効化 */
body.popup-open {
    overflow: hidden;
}

/* スクロールバーのスタイル（オプション） */
#filterArea.popup-active::-webkit-scrollbar,
#filterArea.popup-active .container::-webkit-scrollbar {
    width: 8px;
}

#filterArea.popup-active::-webkit-scrollbar-track,
#filterArea.popup-active .container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#filterArea.popup-active::-webkit-scrollbar-thumb,
#filterArea.popup-active .container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

#filterArea.popup-active::-webkit-scrollbar-thumb:hover,
#filterArea.popup-active .container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    #filterArea.popup-active {
        top: 10px;
        width: 95vw;
        height: calc(100vh - 20px);
        max-height: calc(100vh - 20px);
        padding: 15px;
    }

    .popup-close-btn {
        position: fixed; /* モバイルでは固定位置 */
        top: 20px;
        right: 20px;
        z-index: 1001;
    }
}
