/* ==============================================
   FAQ 操作性向上（UX）スタイル
   Version 1.0.0 - 2026-11-24 - Design System v9.0

   目的:
   「すべて」選択時に76問が縦一列に並び、下部へ到達しづらい問題の解消。
   1. スクロール追従の絞り込みバー（カテゴリ＋キーワード検索）
   2. 段階表示（もっと見る / すべて表示）
   3. 表示件数の可視化

   配色: Deep Teal #0A3D3D / Sage Green #4A6B5B / Gold #C9A961
   ============================================== */

/* ========================================
   1. スクロール追従ツールバー
======================================== */
/* アンカー：固定表示中に高さを確保するラッパー */
.faq-ux-anchor {
    position: relative;
    z-index: 900;
}

.faq-ux-toolbar {
    position: relative;
    top: auto;
    z-index: 900;
    margin: 0 0 1.75rem;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.96);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(10, 61, 61, 0.10);
    border-radius: 14px;
    box-shadow: 0 6px 22px rgba(10, 61, 61, 0.10);
    transition: box-shadow 0.3s ease;
}

/* 追従中（JSで固定）は影を強めて「操作パネル」であることを示す */
.faq-ux-toolbar.is-pinned {
    position: fixed;
    margin: 0;
    box-shadow: 0 10px 28px rgba(10, 61, 61, 0.18);
    border-color: rgba(201, 169, 97, 0.5);
}

/* キーワード検索 */
.faq-ux-search {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 0.75rem;
}

.faq-ux-search > .fa-search {
    position: absolute;
    left: 1rem;
    color: #4A6B5B;
    font-size: 0.95rem;
    pointer-events: none;
}

.faq-ux-search input {
    width: 100%;
    padding: 0.8rem 3rem 0.8rem 2.7rem;
    border: 1.5px solid #E2E8F0;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.95rem;
    color: #2D3748;
    background: #FFFFFF;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.faq-ux-search input::placeholder {
    color: #A0AEC0;
}

.faq-ux-search input:focus {
    outline: none;
    border-color: #C9A961;
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.18);
}

/* クリアボタン */
.faq-ux-clear {
    position: absolute;
    right: 0.55rem;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: #EDF2F7;
    color: #4A5568;
    font-size: 0.8rem;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
}

.faq-ux-clear.on {
    display: flex;
}

.faq-ux-clear:hover {
    background: #0A3D3D;
    color: #FFFFFF;
}

/* カテゴリーチップ（横スクロール） */
.faq-ux-chips {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.15rem 0 0.4rem;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}

.faq-ux-chips::-webkit-scrollbar {
    height: 4px;
}

.faq-ux-chips::-webkit-scrollbar-thumb {
    background: rgba(10, 61, 61, 0.2);
    border-radius: 2px;
}

.faq-ux-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.95rem;
    border: 1.5px solid #E2E8F0;
    border-radius: 999px;
    background: #FFFFFF;
    color: #4A5568;
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.faq-ux-chip:hover {
    border-color: #C9A961;
    color: #0A3D3D;
    transform: translateY(-1px);
}

.faq-ux-chip[aria-pressed="true"] {
    background: linear-gradient(135deg, #0A3D3D 0%, #1A4D4D 100%);
    border-color: #0A3D3D;
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(10, 61, 61, 0.22);
}

.faq-ux-chip .n {
    font-size: 0.76rem;
    font-weight: 600;
    opacity: 0.6;
}

.faq-ux-chip[aria-pressed="true"] .n {
    color: #FFD700;
    opacity: 1;
}

/* 表示件数ステータス */
.faq-ux-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.55rem;
    padding-top: 0.6rem;
    border-top: 1px dashed rgba(10, 61, 61, 0.14);
    font-size: 0.85rem;
    color: #4A5568;
}

.faq-ux-status strong {
    color: #0A3D3D;
    font-size: 1rem;
}

.faq-ux-status .faq-ux-jump {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid rgba(10, 61, 61, 0.18);
    border-radius: 999px;
    background: #F7FAFC;
    color: #0A3D3D;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.faq-ux-status .faq-ux-jump:hover {
    background: #0A3D3D;
    color: #FFFFFF;
    border-color: #0A3D3D;
}

/* ========================================
   2. 段階表示の制御
======================================== */
/* JSが付与する data-faq-hidden を最優先で非表示にする
   （既存スクリプトのインライン display 指定より優先させるため !important） */
#faq-container .faq-item[data-faq-hidden="true"] {
    display: none !important;
}

#faq-container {
    scroll-margin-top: calc(var(--faq-sticky-top, 80px) + 120px);
}

/* もっと見る */
.faq-ux-more {
    display: none;
    margin: 1.75rem 0 0.5rem;
    text-align: center;
}

.faq-ux-more.on {
    display: block;
}

.faq-ux-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.95rem 2.2rem;
    border: 2px solid #0A3D3D;
    border-radius: 999px;
    background: #FFFFFF;
    color: #0A3D3D;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-ux-more-btn:hover {
    background: linear-gradient(135deg, #0A3D3D 0%, #4A6B5B 100%);
    border-color: #0A3D3D;
    color: #FFFFFF;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(10, 61, 61, 0.22);
}

.faq-ux-more-btn i {
    font-size: 0.85rem;
}

.faq-ux-more-count {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0.7;
}

.faq-ux-more-btn:hover .faq-ux-more-count {
    opacity: 0.9;
}

/* すべて表示（テキストリンク） */
.faq-ux-showall {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.9rem;
    padding: 0.35rem 0.6rem;
    border: none;
    background: none;
    color: #4A6B5B;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.faq-ux-showall:hover {
    color: #C9A961;
}

/* 全件表示完了のメッセージ */
.faq-ux-end {
    display: none;
    margin: 1.5rem 0 0.5rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    background: #F0F9F4;
    border-left: 4px solid #C9A961;
    color: #4A5568;
    font-size: 0.88rem;
    line-height: 1.7;
    text-align: center;
}

.faq-ux-end.on {
    display: block;
}

.faq-ux-end strong {
    color: #0A3D3D;
}

/* 該当なし */
.faq-ux-empty {
    display: none;
    margin: 1.5rem 0;
    padding: 2.5rem 1.25rem;
    border: 1px dashed #CBD5E0;
    border-radius: 14px;
    background: #F7FAFC;
    text-align: center;
    color: #4A5568;
}

.faq-ux-empty.on {
    display: block;
}

.faq-ux-empty > i {
    display: block;
    font-size: 1.8rem;
    color: #C9A961;
    margin-bottom: 0.75rem;
}

.faq-ux-empty p {
    margin: 0 0 1rem;
    font-size: 0.95rem;
    line-height: 1.8;
}

.faq-ux-empty .faq-ux-reset {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.7rem 1.6rem;
    border: 2px solid #0A3D3D;
    border-radius: 999px;
    background: #FFFFFF;
    color: #0A3D3D;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.faq-ux-empty .faq-ux-reset:hover {
    background: #0A3D3D;
    color: #FFFFFF;
}

/* ========================================
   3. レスポンシブ
======================================== */
@media (max-width: 768px) {
    .faq-ux-toolbar {
        padding: 0.75rem 0.8rem;
        border-radius: 12px;
        margin-bottom: 1.25rem;
    }

    .faq-ux-search input {
        font-size: 0.9rem;
        padding: 0.72rem 2.8rem 0.72rem 2.5rem;
    }

    .faq-ux-chip {
        padding: 0.45rem 0.8rem;
        font-size: 0.8rem;
    }

    .faq-ux-status {
        font-size: 0.8rem;
    }

    .faq-ux-more {
        /* モバイル固定CTAに隠れないよう余白を確保 */
        padding-bottom: 82px;
    }

    .faq-ux-more-btn {
        width: 100%;
        max-width: 340px;
        padding: 0.9rem 1.2rem;
        font-size: 0.95rem;
    }

    .faq-ux-end {
        margin-bottom: 82px;
    }
}

@media (max-width: 480px) {
    .faq-ux-toolbar {
        padding: 0.7rem 0.7rem;
    }

    .faq-ux-status .faq-ux-jump span {
        display: none;
    }
}

/* モーション軽減 */
@media (prefers-reduced-motion: reduce) {
    .faq-ux-toolbar,
    .faq-ux-chip,
    .faq-ux-more-btn,
    .faq-ux-search input,
    .faq-ux-clear,
    .faq-ux-showall,
    .faq-ux-empty .faq-ux-reset {
        transition: none;
    }

    .faq-ux-chip:hover,
    .faq-ux-more-btn:hover {
        transform: none;
    }
}

/* 印刷時は操作系を非表示 */
@media print {
    .faq-ux-toolbar,
    .faq-ux-more,
    .faq-ux-showall,
    .faq-ux-empty {
        display: none !important;
    }

    #faq-container .faq-item[data-faq-hidden="true"] {
        display: block !important;
    }
}
