/**
 * 掲示板一覧 (Issue #153 PR5)
 *
 * - カード/バッジ/ページネーションは kk- コンポーネント（components.css）
 * - 旧ミント直書き（#5fd4cd / #8eeee7）・#2c3e50 見出しを撲滅
 * - ヒーローの白箱を平坦化（kk-page-title＋リード文）
 * - 色はすべてトークン＝ライト/ダーク自動追従（旧ダークブロックは削除）
 */

.bbs-page-container {
    padding-top: var(--space-2);
    padding-bottom: var(--space-4);
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================================
   リード文
   ================================ */

.bbs-page-container .page-lead {
    text-align: center;
    color: var(--accent-strong);
    font-size: 1.05rem;
    margin: calc(-1 * var(--space-3)) 0 6px;
}

.bbs-page-container .page-description {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: var(--space-3);
}

/* ================================
   検索＋新規投稿
   ================================ */

.bbs-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}

.search-container {
    flex: 1;
    max-width: 450px;
}

.search-form {
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 2px solid var(--border-mid);
    border-radius: var(--radius-pill);
    padding: 0 20px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-input-wrapper:focus-within {
    border-color: var(--accent);
    background: var(--bg-input-focus);
    box-shadow: var(--focus-ring);
}

.search-icon {
    width: 20px;
    height: 20px;
    color: var(--accent);
    margin-right: 12px;
    flex-shrink: 0;
}

/* global §6 の input 汎用スタイルを打ち消してピル内に収める */
.search-input-wrapper .search-input {
    flex: 1;
    padding: 12px 0;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
    box-shadow: none;
}

.search-input-wrapper .search-input:focus {
    border: none;
    background: transparent;
    box-shadow: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-clear {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, opacity 0.2s ease;
    opacity: 0.6;
}

.search-clear:hover {
    background: var(--bg-inset);
    opacity: 1;
}

.search-clear svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.bbs-new-post {
    flex-shrink: 0;
}

/* ================================
   投稿グリッド
   ================================ */

.bbs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-3);
}

.bbs-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.bbs-grid .kk-card {
    height: 100%;
    animation: cardFadeIn 0.5s ease-out both;
    animation-delay: calc(var(--card-index, 0) * 0.05s);
}

@keyframes cardFadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.bbs-grid .kk-card__image.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-placeholder {
    width: 72px;
    height: 72px;
    color: var(--accent);
    opacity: 0.5;
}

.bbs-meta {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bbs-grid .kk-card__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bbs-author {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.92rem;
}

.author-icon {
    width: 16px;
    height: 16px;
    color: var(--accent);
    flex-shrink: 0;
}

/* 本人認証バッジ（公式の橙は両モード共通のシグナルカラー） */
.official-badge {
    display: inline-block;
    background: linear-gradient(135deg, #ffb347, #ff8c42);
    color: #ffffff;
    padding: 2px 8px;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 700;
    margin-left: 6px;
}

/* フッター（返信数＋続きを読む） */
.bbs-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comment-count {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
}

.comment-count svg {
    width: 16px;
    height: 16px;
    color: var(--accent);
}

.bbs-read-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-strong);
    font-weight: 600;
    font-size: 0.92rem;
    transition: gap 0.3s ease;
}

.bbs-grid .kk-card:hover .bbs-read-more {
    gap: 12px;
}

.bbs-read-more .arrow {
    transition: transform 0.3s ease;
}

.bbs-grid .kk-card:hover .bbs-read-more .arrow {
    transform: translateX(4px);
}

/* ================================
   空状態
   ================================ */

.no-posts {
    text-align: center;
    padding: var(--space-5) var(--space-3);
    color: var(--text-muted);
}

.no-posts-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto var(--space-2);
    color: var(--accent);
    opacity: 0.35;
}

.no-posts h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--heading);
    margin-bottom: 10px;
}

.no-posts p {
    margin-bottom: var(--space-3);
}

/* ================================
   レスポンシブ
   ================================ */

@media (max-width: 768px) {
    .bbs-grid {
        grid-template-columns: 1fr;
        gap: var(--space-2);
    }

    .bbs-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container {
        max-width: none;
    }

    .bbs-new-post {
        justify-content: center;
    }
}

/* ================================
   アクセシビリティ
   ================================ */

@media (prefers-reduced-motion: reduce) {
    .bbs-page-container,
    .bbs-grid .kk-card {
        animation: none;
    }
}
