/* ==========================================================
   SCOPE: 用語集ページ専用コンポーネント（6ジャンル共用）
     - .gl-filter-bar, .gl-level-btn, .gl-search-input
     - .gl-kana-bar, .gl-kana-btn, .gl-filter-tags
     - .gl-table-wrap, .gl-category-heading, .glossary-row
     - .glossary-term, .glossary-desc, .glossary-expand
     - .gl-level-badge, .gl-cross-link, .gl-related-link
     - .gl-no-results, .gl-result-count
   DEPENDS: base.css
   NOTE: header.phpには追加しない。用語集ページのみで読み込む。
   CREATED: 2026-03-28
   ========================================================== */

/* --- フィルターバー --- */
.gl-filter-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    padding: 12px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.gl-filter-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.gl-level-group {
    display: flex;
    gap: 6px;
}

.gl-level-btn {
    padding: 6px 14px;
    border: 2px solid #ccc;
    border-radius: 20px;
    background: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    white-space: nowrap;
}

.gl-level-btn:hover {
    opacity: 0.8;
}

.gl-level-btn[data-level="beginner"][aria-pressed="true"] {
    background: #2d8a4e;
    color: #fff;
    border-color: #2d8a4e;
}

.gl-level-btn[data-level="intermediate"][aria-pressed="true"] {
    background: #2196F3;
    color: #fff;
    border-color: #2196F3;
}

.gl-level-btn[data-level="advanced"][aria-pressed="true"] {
    background: #7B1FA2;
    color: #fff;
    border-color: #7B1FA2;
}

/* --- 検索入力 --- */
.gl-search-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
}

.gl-search-input {
    width: 100%;
    padding: 8px 32px 8px 12px;
    border: 2px solid #ccc;
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.gl-search-input:focus {
    border-color: #2d8a4e;
    outline: none;
}

.gl-search-clear {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    padding: 4px 6px;
    line-height: 1;
}

.gl-search-clear:hover {
    color: #333;
}

/* --- 五十音バー --- */
.gl-kana-bar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.gl-kana-btn {
    padding: 4px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f8f8;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.gl-kana-btn:hover {
    background: #e8e8e8;
}

.gl-kana-btn.active {
    background: #2d8a4e;
    color: #fff;
    border-color: #2d8a4e;
}

.gl-kana-btn.disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

/* --- フィルター状態タグ --- */
.gl-filter-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    min-height: 0;
}

.gl-filter-tags:empty {
    display: none;
}

.gl-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: #f0f0f0;
    border-radius: 12px;
    font-size: 0.8rem;
    color: #333;
}

.gl-tag-remove {
    background: none;
    border: none;
    font-size: 0.9rem;
    color: #999;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.gl-tag-remove:hover {
    color: #333;
}

/* --- 件数表示 --- */
.gl-result-count {
    font-size: 0.8rem;
    color: #666;
    margin-top: 4px;
}

.gl-result-count:empty {
    display: none;
}

/* --- 0件メッセージ --- */
.gl-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.gl-no-results p {
    font-size: 1.1rem;
    margin-bottom: 16px;
}

.gl-reset-all {
    padding: 8px 20px;
    background: #2d8a4e;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.gl-reset-all:hover {
    opacity: 0.85;
}

/* --- カテゴリ見出し --- */
.gl-category-heading {
    font-size: 1.15rem;
    font-weight: 700;
    padding: 10px 14px;
    margin: 24px 0 12px;
    border-left: 4px solid #2d8a4e;
    background: #f9f9f9;
    color: #333;
}

.gl-category-section:first-child .gl-category-heading {
    margin-top: 0;
}

/* --- 用語行 --- */
.glossary-row {
    border-bottom: 1px solid #eee;
    transition: opacity 0.2s;
}

.glossary-row.gl-hidden {
    display: none;
}

.glossary-row.gl-dimmed {
    opacity: 0.2;
}

.gl-term-header {
    padding: 12px 14px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
    position: relative;
}

.gl-term-header:hover {
    background: #fafafa;
}

.glossary-term {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #222;
    flex-shrink: 0;
}

.glossary-desc {
    font-size: 0.85rem;
    color: #555;
    margin: 0;
    flex: 1;
    line-height: 1.6;
    padding-top: 2px;
}

.gl-expand-icon {
    font-size: 0.65rem;
    color: #999;
    transition: transform 0.2s;
    flex-shrink: 0;
    padding-top: 5px;
}

.glossary-row[aria-expanded="true"] .gl-expand-icon {
    transform: rotate(180deg);
}

/* --- レベルバッジ --- */
.level-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    margin-right: 6px;
    white-space: nowrap;
    vertical-align: middle;
}

.level-beginner {
    background: #e8f5e9;
    color: #2d8a4e;
}

.level-intermediate {
    background: #e3f2fd;
    color: #1976D2;
}

.level-advanced {
    background: #f3e5f5;
    color: #7B1FA2;
}

/* --- 展開エリア --- */
.glossary-expand {
    padding: 12px 14px 16px 30px;
    background: #fafafa;
    border-top: 1px solid #eee;
}

.gl-label {
    font-weight: 700;
    font-size: 0.8rem;
    color: #666;
    margin-right: 4px;
}

.gl-english {
    font-size: 0.85rem;
    color: #555;
    margin: 0 0 8px;
}

.gl-cross-refs {
    font-size: 0.85rem;
    margin: 0 0 8px;
}

.gl-cross-link {
    color: #2d8a4e;
    text-decoration: none;
    border-bottom: 1px dotted #2d8a4e;
}

.gl-cross-link:hover {
    opacity: 0.7;
}

.gl-related-pages {
    font-size: 0.85rem;
    margin: 0 0 4px;
}

.gl-related-link {
    color: #1976D2;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.gl-related-link:hover {
    border-bottom-color: #1976D2;
}

/* --- guideページリンク（教育解説「〇〇とは」）の視覚区別 --- */
.gl-related-link--guide {
    color: #1565C0;
    font-weight: 600;
    border-bottom: 1px dotted #1565C0;
}

.gl-related-link--guide:hover {
    color: #0D47A1;
    border-bottom-style: solid;
}

/* --- 英語マッチ表示 --- */
.en-match {
    display: inline-block;
    font-size: 0.75rem;
    color: #888;
    background: #f5f5f5;
    padding: 0 6px;
    border-radius: 3px;
    margin-left: 6px;
}

/* --- 信頼セクション --- */
.gl-trust {
    margin: 40px 0 20px;
    padding: 16px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #555;
    line-height: 1.7;
}

.gl-trust a {
    color: #1976D2;
}

/* --- レスポンシブ --- */
@media (max-width: 768px) {
    .gl-filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .gl-level-group {
        justify-content: center;
    }

    .gl-search-wrap {
        min-width: auto;
    }

    .gl-kana-bar {
        justify-content: center;
    }

    .gl-term-header {
        flex-direction: column;
        gap: 4px;
    }

    .glossary-desc {
        padding-top: 0;
    }

    .gl-expand-icon {
        position: absolute;
        right: 14px;
        top: 14px;
    }

    .glossary-expand {
        padding-left: 14px;
    }
}
