/**
 * zen-jichi 掲示板共通スタイル
 * bbs/内の各ページ（index.php, board.php, thread.php 等）で使用
 */

/* ============================================================
   板タイトル
   ============================================================ */
.board-title {
    padding: 25px;
    border-bottom: 2px solid var(--primary);
    background-color: var(--surface-2);
}

.board-title h1 {
    font-size: 1.8em;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.01em;
}

.board-title p {
    margin-top: 8px;
    color: var(--muted);
}

/* ============================================================
   板ナビゲーション
   ============================================================ */
.board-nav {
    padding: 12px 20px;
    background-color: var(--res-header-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.board-nav a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.9em;
}

/* ============================================================
   カテゴリセクション（板一覧）
   ============================================================ */
.category-section {
    margin: 20px;
}

.category-header {
    background-color: var(--primary);
    color: #fff;
    padding: 10px 15px;
    font-weight: 700;
    font-size: 1em;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-content {
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 8px 8px;
    padding: 15px;
}

/* ============================================================
   板リスト
   ============================================================ */
.board-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.board-item {
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    transition: all 0.2s ease;
}

.board-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.board-item h3 {
    margin: 0 0 8px 0;
    font-size: 1.1em;
}

.board-item h3 a {
    color: var(--link);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.board-item h3 a:hover {
    color: var(--link-hover);
}

.board-item p {
    font-size: 0.9em;
    color: var(--muted);
    margin-bottom: 10px;
}

.board-stats {
    font-size: 0.8em;
    color: var(--muted);
    display: flex;
    gap: 15px;
}

.board-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================================
   スレッドプレビュー
   ============================================================ */
.thread-preview {
    margin: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.thread-header {
    background-color: var(--res-header-bg);
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.thread-header h2 {
    font-size: 1.1em;
    margin: 0;
}

.thread-header h2 a {
    color: var(--primary);
}

.thread-meta {
    color: var(--muted);
    font-size: 0.85em;
}

/* ============================================================
   レス表示
   ============================================================ */
.res-container {
    padding: 10px 20px;
}

.res {
    padding: 12px 15px;
    border-bottom: 1px dashed var(--border-soft);
}

.res:last-child {
    border-bottom: none;
}

.res-header {
    font-size: 0.85em;
    color: var(--muted);
    margin-bottom: 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.res-number {
    font-weight: bold;
    color: var(--primary);
    font-size: 16px;
}

.res-name {
    color: #006600;
    font-weight: bold;
    font-size: 16px;
}

.res-content {
    line-height: 1.5;
    word-break: break-word;
}

/* ============================================================
   投票ボタン
   ============================================================ */
.vote-buttons {
    display: inline-flex;
    gap: 8px;
    margin-left: 10px;
}

.vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75em;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid;
}

.vote-btn.good {
    background-color: #e8f5e9;
    color: #2e7d32;
    border-color: #2e7d32;
}

.vote-btn.good:hover {
    background-color: #c8e6c9;
}

.vote-btn.bad {
    background-color: #ffebee;
    color: #c62828;
    border-color: #c62828;
}

.vote-btn.bad:hover {
    background-color: #ffcdd2;
}

.vote-btn .count {
    font-weight: bold;
}

.vote-btn.disabled {
    cursor: default;
}

.vote-btn.good.disabled:hover {
    background-color: #e8f5e9;
}

.vote-btn.bad.disabled:hover {
    background-color: #ffebee;
}

/* ============================================================
   スレッド一覧（横並び表示）
   ============================================================ */
.thread-index {
    margin: 20px;
    padding: 15px;
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    line-height: 2;
}

.thread-index-header {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.thread-num {
    color: var(--muted);
    font-size: 0.9em;
}

.thread-count {
    color: var(--muted);
    font-size: 1em;
    margin-left: 1px;
}

.separator {
    color: var(--border);
    margin: 0 5px;
}

.thread-scroll {
    max-height: 150px;
    overflow-y: auto;
    border-top: 1px dashed var(--border);
    margin-top: 10px;
    padding-top: 10px;
}

/* ============================================================
   スレッドブロック（プレビュー表示）
   ============================================================ */
.thread-block {
    margin: 20px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: #eeeeee;
    overflow: hidden;
}

.thread-block .thread-header {
    background-color: #eeeeee;
    padding: 10px 15px;
    border-bottom: 3px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.2em;
}

.thread-block .thread-header h1 {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--primary);
}

.thread-block .thread-header a {
    color: var(--primary);
    font-weight: 700;
}

.thread-footer {
    background-color: #eeeeee;
    padding: 8px 15px;
    border-top: 1px solid var(--border);
    font-size: 1em;
    font-weight: 600;
    display: flex;
    gap: 0;
    align-items: center;
}

.thread-footer a {
    padding: 4px 12px;
    border-right: 1px solid var(--border);
}

.thread-footer a:first-child {
    border-left: 1px solid var(--border);
}

/* ============================================================
   投稿表示
   ============================================================ */
.post {
    padding: 12px 15px;
    border-bottom: 1px dashed var(--border-soft);
}

.post:last-child {
    border-bottom: none;
}

.post-meta {
    font-size: 0.85em;
    color: var(--muted);
    margin-bottom: 8px;
}

.post-num {
    font-weight: bold;
    color: var(--primary);
    margin-right: 8px;
    font-size: 16px;
}

.post-name {
    color: #006600;
    font-weight: bold;
    font-size: 16px;
}

.post-content {
    line-height: 1.5;
    word-break: break-word;
    white-space: normal;
    word-wrap: break-word;
}

.latest-separator {
    padding: 8px 15px;
    background-color: var(--surface-2);
    font-size: 0.85em;
    color: var(--muted);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

/* ============================================================
   スレッド一覧テーブル（旧形式・互換用）
   ============================================================ */
.thread-list {
    margin: 20px;
    padding: 20px;
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.thread-list h2 {
    font-size: 1.1em;
    color: var(--primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.thread-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.thread-table th,
.thread-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.thread-table th {
    background-color: var(--res-header-bg);
    font-weight: 600;
    color: var(--text);
}

.thread-table tr:hover {
    background-color: rgba(0,0,0,0.02);
}

.thread-table .thread-title a {
    font-weight: 500;
}

/* ============================================================
   スレッド作成フォーム
   ============================================================ */
.create-thread-section {
    margin: 20px;
}

.create-thread-section .section-content {
    background: #fff;
}

/* したらば風スレッド作成フォーム */
.create-thread {
    margin: 20px;
    padding: 25px;
    background-color: var(--surface-2);
    border: 2px solid var(--primary);
    border-radius: 12px;
}

.create-thread h3 {
    margin: 0 0 15px 0;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.create-thread .reply-row {
    display: flex;
    margin-bottom: 6px;
    align-items: flex-start;
}

.create-thread .reply-row-label {
    white-space: nowrap;
    min-width: 80px;
    padding-right: 4px;
    font-size: 14px;
    font-weight: bold;
    line-height: 30px;
    text-align: right;
}

.create-thread .reply-row input[type="text"] {
    width: 100%;
    max-width: 500px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

.create-thread .reply-row textarea {
    width: 100%;
    max-width: 500px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
}

/* ============================================================
   スレッドタイトルボックス
   ============================================================ */
.thread-title-box {
    padding: 25px;
    border-bottom: 2px solid var(--primary);
    background-color: var(--surface-2);
}

.thread-title-box h1 {
    font-size: 1.5em;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============================================================
   返信フォーム
   ============================================================ */
.reply-section {
    margin: 20px;
}

.reply-section .section-content {
    background: #fff;
}

.reply-section .reply-row {
    display: flex;
    margin-bottom: 6px;
    align-items: flex-start;
}

.reply-section .reply-row-label {
    white-space: nowrap;
    min-width: 80px;
    padding-right: 4px;
    font-size: 14px;
    font-weight: bold;
    line-height: 30px;
    text-align: right;
}

.reply-section .reply-row input[type="text"] {
    width: 100%;
    max-width: 500px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

.reply-section .reply-row textarea {
    width: 100%;
    max-width: 500px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
}

/* したらば風返信フォーム */
.reply-form {
    margin: 20px;
    padding: 20px;
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.reply-form h3 {
    color: var(--primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================
   スレッドナビゲーション
   ============================================================ */
.thread-nav {
    padding: 12px 20px;
    background-color: var(--res-header-bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}

.thread-nav a {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.9em;
}

.thread-nav a.active {
    background-color: var(--primary);
    color: #fff;
}

.thread-nav a.active:hover {
    text-decoration: none;
}

/* ============================================================
   投稿コンテナ
   ============================================================ */
.posts-container {
    padding: 10px 0;
}

/* ============================================================
   投稿メタ情報
   ============================================================ */
.post-level {
    color: var(--muted);
    font-size: 0.9em;
}

.post-admin {
    color: #c00;
    font-weight: bold;
}

.post-date {
    margin-left: 10px;
}

.vote-info {
    margin-left: 10px;
    font-size: 0.85em;
    color: var(--muted);
}

.quote-btn {
    margin-left: 10px;
    padding: 2px 8px;
    background-color: #f0f0f0;
    border-radius: 4px;
    font-size: 0.8em;
    cursor: pointer;
}

.quote-btn:hover {
    background-color: #e0e0e0;
}

/* ============================================================
   引用リンク
   ============================================================ */
.quote-link {
    color: var(--primary);
    font-weight: bold;
}

.quote-link:hover {
    text-decoration: underline;
}

/* ============================================================
   エラーボックス
   ============================================================ */
.error-box {
    margin: 20px;
    padding: 15px;
    background-color: var(--error-bg);
    border: 1px solid var(--error-border);
    border-radius: 8px;
    color: var(--danger);
}

.error-box ul {
    margin: 10px 0 0 20px;
}

/* ============================================================
   スレッド満杯表示
   ============================================================ */
.thread-full {
    margin: 20px;
    padding: 30px;
    text-align: center;
    background-color: #f5f5f5;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
}

/* ============================================================
   管理者用削除ボタン
   ============================================================ */
.admin-del-btn {
    padding: 2px 8px;
    margin-left: 10px;
    border: 1px solid #fcc;
    border-radius: 4px;
    background-color: #fff8f8;
    color: var(--danger);
    font-size: 0.75em;
    cursor: pointer;
}

.admin-del-btn:hover {
    background-color: #ffe0e0;
}

/* ============================================================
   管理者向け：非表示投稿表示
   ============================================================ */
.post-hidden-admin {
    padding: 10px 15px;
    background-color: #fff0f0;
    border: 1px dashed #c00;
    border-radius: 4px;
    margin: 10px 20px;
}

.post-hidden-content {
    border: 2px solid #c00;
    background-color: #fff8f8;
}

/* ============================================================
   インライン返信フォーム
   ============================================================ */
.reply-form-inline {
    margin-top: 2.5em;
    padding: 10px 15px;
    border-top: 1px solid #cccccc;
    background-color: #eeeeee;
}

.reply-form-inline .reply-row {
    display: flex;
    margin-bottom: 6px;
    align-items: flex-start;
}

.reply-form-inline .reply-row-label {
    white-space: nowrap;
    min-width: 55px;
    padding-right: 4px;
    font-size: 14px;
    font-weight: bold;
    line-height: 30px;
    text-align: right;
}

.reply-form-inline .input-name {
    width: 200px;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

.reply-form-inline textarea {
    width: 100%;
    max-width: 500px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.reply-form-inline textarea#content {
    min-height: 80px;
}

.submit-btn-inline {
    background-color: #fff;
    border: 1px solid #ccc;
    padding: 4px 16px;
    font-size: 14px;
    cursor: pointer;
}

.submit-btn-inline:hover {
    background-color: #f0f0f0;
}

.thread-full-inline {
    padding: 15px;
    text-align: center;
    background-color: #fff;
    border-top: 1px solid #cccccc;
    color: #666;
}

/* ============================================================
   リンク下線
   ============================================================ */
.thread-index a,
.thread-block a,
.thread-footer a,
.post-content a,
.res-content a {
    text-decoration: underline;
}

/* ============================================================
   レスポンシブ対応
   ============================================================ */
@media (max-width: 768px) {
    .board-list {
        grid-template-columns: 1fr;
    }

    .thread-table {
        font-size: 0.85em;
    }

    .thread-table th:nth-child(3),
    .thread-table td:nth-child(3),
    .thread-table th:nth-child(4),
    .thread-table td:nth-child(4) {
        display: none;
    }

    .board-nav {
        gap: 10px;
    }

    .res-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .vote-buttons {
        margin-left: 0;
        margin-top: 0;
    }
}
