/* /custom-assets/blog-pages/search/style.css */

/* --- スクリーンリーダー向けテキストの非表示 --- */
.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    -webkit-clip-path: inset(50%);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute !important;
    width: 1px;
    word-wrap: normal !important;
}

/* --- 検索ページ全体 --- */
#app { /* paddingを削除 */ }
.search-controls {
    display: flex;
    justify-content: space-between;
    align-items: stretch; /* 高さを揃える */
    gap: 10px;
    padding: 15px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}
.search-controls-left, .search-controls-right {
    flex: 0 1 auto;
    display: flex;
}
.search-controls-center {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
}

.settings-btn {
    padding: 8px;
    font-size: 0.9em;
    min-width: auto;
    white-space: nowrap;
}
.settings-btn i {
    font-size: 1.2em;
}
.settings-btn .btn-text {
    display: none;
}

.search-main-btn {
    width: 100%;
    max-width: 300px;
    padding: 12px 20px;
    font-size: 1em;
}

/* ソート順コントロール */
.sort-controls {
    display: flex;
    align-items: stretch;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
}
.sort-controls label {
    position: relative;
    display: flex;
    cursor: pointer;
    transition: background-color 0.2s ease;
    background-color: #fff;
}
.sort-controls label:hover {
    background-color: #f5f5f5;
}
.sort-controls input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.sort-controls label:not(:last-child) {
    border-right: 1px solid #ccc;
}
.sort-controls .short-text, .sort-controls .full-text {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    color: #555;
    font-weight: bold;
    font-size: 0.9em;
    white-space: nowrap;
}
.sort-controls input[type="radio"]:checked + .short-text,
.sort-controls input[type="radio"]:checked ~ .full-text {
    background-color: var(--theme-color);
    color: white;
}
.sort-controls .full-text {
    display: none; /* デフォルトでは非表示 */
}

/* 画面幅が広い場合のスタイル */
@media (min-width: 420px) {
    .settings-btn .btn-text { display: inline; }
    .sort-controls .short-text { display: none; }
    .sort-controls .full-text { display: flex; }
}


/* 絞り込み条件表示 */
.search-active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 15px; padding: 0 15px; align-items: center; }
.filter-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 15px;
    background: #e9e9e9;
    font-size: 0.9em;
    font-weight: 500;
}
.filter-tag strong { color: var(--theme-color); }
.filter-tag-remove {
    background: #aaa;
    color: white;
    border: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    transition: background 0.2s ease;
}
.filter-tag-remove:hover { background: #888; }
.member-filter-tag .filter-tag-remove { background: var(--theme-color); }

.clear-all-filters-btn {
    background: none;
    border: 1px solid #d9534f;
    color: #d9534f;
    font-size: 0.85em;
    font-weight: bold;
    padding: 4px 12px;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.clear-all-filters-btn:hover { background: #d9534f; color: white; }

/* 検索結果件数 */
.search-results-count { font-weight: bold; color: #333; margin-bottom: 20px; padding: 0 15px; }
.search-results-count span { color: var(--theme-color); font-size: 1.2em; }

/* ブログカードの本文スニペット */
.bl-content-snippet {
    font-size: 0.9em;
    color: #555;
    margin-bottom: 10px;
    line-height: 1.5;
    overflow-wrap: break-word;
    word-break: break-word;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ブログカードのハイライト */
.bl-content-snippet .text-highlight,
.blog-text-body .text-highlight {
    background-color: #fff1a7;
    font-weight: bold;
    padding: 0 2px;
    border-radius: 3px;
}

/* ローディングインジケーター */
#loading-indicator { text-align: center; padding: 20px; display: none; }
.loader-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--theme-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }


/* --- 検索ポップアップ --- */
.search-popup-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 10000; display: none; align-items: center; justify-content: center; }
.search-popup-modal.active { display: flex; }
.search-popup-overlay { position: absolute; width: 100%; height: 100%; background: rgba(0,0,0,0.7); cursor: pointer; }
.search-popup-container {
    position: relative;
    width: 95%; max-width: 800px; height: 90vh;
    background: #fff; border-radius: 8px;
    display: flex; flex-direction: column;
}
.search-popup-container.group-nogizaka46 { --theme-color: var(--nogizaka-color); }
.search-popup-container.group-sakurazaka46 { --theme-color: var(--sakurazaka-color); }
.search-popup-container.group-hinatazaka46 { --theme-color: var(--hinatazaka-color); }

.search-popup-header, .search-popup-footer { padding: 15px 20px; border-bottom: 1px solid #eee; flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; }
.search-popup-footer { border-top: 1px solid #eee; border-bottom: none; }
.search-popup-header h2 { margin: 0; font-size: 1.2em; }
.search-popup-close { background: none; border: none; font-size: 24px; cursor: pointer; }
.search-popup-content { padding: 0 20px 20px; overflow-y: auto; flex-grow: 1; touch-action: pan-y; }

.search-group { margin-bottom: 25px; }
.search-group h3 { font-size: 1.1em; margin: 20px 0 10px; padding-bottom: 10px; border-bottom: 2px solid #f0f0f0; }
.search-input-wrapper { position: relative; }
.search-group .search-input, .search-group .date-input { width: 100%; padding: 12px; border: 1px solid #ccc; border-radius: 8px; font-size: 1em; }
.search-input-description { font-size: 0.85em; color: #666; margin: 0 0 10px; padding-left: 5px; }
.search-input[type="search"] { padding-right: 40px; }
.keyword-clear-btn {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #ccc;
    color: white;
    border: none;
    font-size: 16px;
    line-height: 24px;
    cursor: pointer;
    display: none;
    transition: background-color 0.2s;
}
.keyword-clear-btn:hover { background-color: #aaa; }
.keyword-clear-btn.is-visible { display: block; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

.date-range-fields { display: flex; gap: 10px; align-items: center; }
.search-options { display: flex; gap: 15px; flex-wrap: wrap; margin-top: 10px; }
@media (max-width: 480px) {
    .date-range-fields { flex-direction: column; align-items: stretch; }
}

/* メンバー選択タブ */
.member-tabs { display: flex; border-bottom: 2px solid #eee; }
.member-tab-btn {
    padding: 12px 20px;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1em;
    font-weight: bold;
    color: #888;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}
.member-tab-btn.active { color: var(--theme-color); border-color: var(--theme-color); }
.member-tab-content { display: none; }
.member-tab-content.active { display: block; padding-top: 15px; }

/* メンバー検索サジェスト */
.member-search-wrapper { position: relative; }
.member-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #ccc;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 10;
}
.suggestion-item { padding: 10px 15px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; }
.suggestion-item:hover { background: #f5f5f5; }
.suggestion-item .group-name { font-size: 0.8em; color: #fff; padding: 2px 6px; border-radius: 4px; }
.suggestion-item.group-nogizaka46 .group-name { background-color: var(--nogizaka-color); }
.suggestion-item.group-sakurazaka46 .group-name { background-color: var(--sakurazaka-color); }
.suggestion-item.group-hinatazaka46 .group-name { background-color: var(--hinatazaka-color); }


/* メンバーリスト */
.member-selector.is-header[data-level="group"] { margin-bottom: 15px; }
.member-generation { margin-bottom: 15px; }
.generation-header { font-weight: bold; cursor: pointer; user-select: none; }
.member-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; list-style: none; padding: 8px 0; }

/* 新しいメンバー選択UI */
.member-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.member-selector.is-header { font-weight: bold; }
.member-selector-check {
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
}
.member-selector.checked .member-selector-check { background-color: var(--theme-color); border-color: var(--theme-color); }
.member-selector.indeterminate .member-selector-check { border-color: var(--theme-color); }
.member-selector.indeterminate .member-selector-check::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 10px; height: 10px;
    background-color: var(--theme-color);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}
.member-selector:hover { border-color: var(--theme-color); }
.member-selector.checked { border-color: var(--theme-color); background-color: #f0f8ff; }

/* ポップアップ内リセットの視覚効果 */
.search-popup-content.is-resetting { animation: blink-bg 0.4s ease-in-out; }
@keyframes blink-bg {
    0% { background-color: transparent; }
    50% { background-color: #e6f7ff; }
    100% { background-color: transparent; }
}