/* =====================================================
 * 掲示板スタイル
 * design-tokens.css のCSS変数を使用
 * ===================================================== */

/* --- コントロールバー --- */
.bbs-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.bbs-category-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.bbs-tab {
    padding: 6px 14px;
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 6px;
    background: #fff;
    color: var(--c-text-secondary, #6b7280);
    font-size: 13px;
    cursor: pointer;
    transition: background-color 200ms ease, color 200ms ease;
}

.bbs-tab:hover {
    background: #f3f4f6;
}

.bbs-tab.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

.bbs-create-btn {
    padding: 8px 16px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 200ms ease;
    white-space: nowrap;
}

.bbs-create-btn:hover {
    opacity: 0.85;
}

/* --- スレッド一覧 --- */
.bbs-thread-list {
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 8px;
    overflow: hidden;
}

.bbs-thread-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--c-border, #e5e7eb);
    text-decoration: none;
    color: inherit;
    transition: background-color 200ms ease;
}

.bbs-thread-item:last-child {
    border-bottom: none;
}

.bbs-thread-item:hover {
    background: #f9fafb;
}

.bbs-thread-item.pinned {
    background: #fffbeb;
}

.bbs-category-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
}

.bbs-thread-info {
    flex: 1;
    min-width: 0;
}

.bbs-thread-title {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    margin: 0 0 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bbs-thread-meta {
    font-size: 12px;
    color: #9ca3af;
}

.bbs-thread-stats {
    text-align: right;
    flex-shrink: 0;
    font-size: 12px;
    color: #6b7280;
}

.bbs-thread-stats .post-count {
    font-weight: 600;
    color: #1f2937;
}

.bbs-pin-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    color: #f59e0b;
}

.bbs-lock-icon {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    color: #ef4444;
}

/* --- 投稿 --- */
.bbs-posts {
    margin-bottom: 24px;
}

.bbs-post {
    padding: 12px 16px;
    border-bottom: 1px solid var(--c-border, #e5e7eb);
}

.bbs-post.deleted {
    opacity: 0.5;
}

.bbs-post-header {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 6px;
    line-height: 1.5;
}

.bbs-post-number {
    font-weight: 600;
    color: #1d4ed8;
}

.bbs-post-name {
    font-weight: 600;
    color: #059669;
}

.bbs-post-trip {
    color: #9333ea;
}

.bbs-post-id {
    color: #9ca3af;
}

.bbs-post-date {
    color: #9ca3af;
}

.bbs-post-content {
    font-size: 14px;
    line-height: 1.7;
    color: #1f2937;
    white-space: pre-wrap;
    word-break: break-word;
}

.bbs-post-content .anchor-link {
    color: #1d4ed8;
    text-decoration: none;
    cursor: pointer;
}

.bbs-post-content .anchor-link:hover {
    text-decoration: underline;
}

/* --- 返信フォーム --- */
.bbs-reply-form {
    border: 1px solid var(--c-border, #e5e7eb);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.bbs-reply-title {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 12px;
}

.bbs-reply-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

/* --- フィールド共通 --- */
.bbs-field {
    margin-bottom: 12px;
}

.bbs-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.bbs-field input,
.bbs-field select,
.bbs-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.bbs-field textarea {
    resize: none;
}

.required {
    color: #ef4444;
}

.optional {
    color: #9ca3af;
    font-weight: 400;
}

.bbs-note {
    font-size: 12px;
    color: #9ca3af;
}

.bbs-submit-btn {
    padding: 8px 20px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 200ms ease;
}

.bbs-submit-btn:hover {
    opacity: 0.85;
}

.bbs-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- モーダル --- */
.bbs-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}

.bbs-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: min(809px, 90vh);
    overflow: auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.bbs-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.bbs-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.bbs-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #9ca3af;
    line-height: 1;
}

.bbs-modal-body {
    padding: 20px;
}

.bbs-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

/* --- ハニーポット（非表示） --- */
.bbs-honeypot {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
}

/* --- パンくず --- */
.bbs-breadcrumb {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}

.bbs-breadcrumb a {
    color: #1d4ed8;
    text-decoration: none;
}

.bbs-breadcrumb a:hover {
    text-decoration: underline;
}

/* --- スレッドヘッダー --- */
.bbs-thread-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--c-border, #e5e7eb);
}

.bbs-thread-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 4px;
}

.bbs-thread-header-meta {
    font-size: 12px;
    color: #9ca3af;
}

/* --- ロックメッセージ --- */
.bbs-locked-message {
    padding: 16px;
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    margin-bottom: 24px;
}

/* --- ページネーション --- */
.bbs-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 16px;
    padding: 12px 0;
}

.bbs-page-btn {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    cursor: pointer;
    transition: background-color 200ms ease;
}

.bbs-page-btn:hover {
    background: #f3f4f6;
}

.bbs-page-btn.active {
    background: #000;
    color: #fff;
    border-color: #000;
}

/* --- ローディング --- */
.bbs-loading {
    padding: 24px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* --- 空状態 --- */
.bbs-empty {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
    font-size: 14px;
}

/* --- レスポンシブ --- */
@media (max-width: 640px) {
    .bbs-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .bbs-category-tabs {
        justify-content: center;
    }

    .bbs-create-btn {
        width: 100%;
    }

    .bbs-thread-item {
        flex-wrap: wrap;
        gap: 6px;
    }

    .bbs-thread-stats {
        width: 100%;
        text-align: left;
    }
}
