/**
 * community-redesign.css — блог книги (/book/<id>/blog), анонсы книги (/book/<id>/announces),
 * блог пользователя (/users/<id>/blog) и «Мои обсуждения» (/my/comments) в стиле /blog.
 * Подключается вместе с blog-redesign.css (карточки постов, пагинация, панель рубрик .blog-side).
 *
 * Скоуп — обёртка .blog-page--community. Остальные панели правой колонки (информация о книге,
 * оценки, модерация) получают только вид карточки через body:has(.blog-page--community):
 * браузер без :has() покажет старый вид, ничего не ломая. Цвета кнопок в них не меняются —
 * красные «Удалить»/«Бан» остаются красными.
 * Откат — убрать подключение файла и обёртки в views/bookBlog, announces/book|post, users/blog, my/comments.
 */

html body:has(.blog-page--community) .sr {
    --brand: #9a4669;
    --brand-strong: #7d3655;
    --brand-hover: #833a59;
    --brand-soft: #f7edf2;
    --brand-soft-hover: #f0dde7;
    --brand-line: #ecd3df;
    --brand-on: #ffffff;
    --card-bg: #ffffff;
    --card-line: #ececec;
    --text: #2b2f33;
    --text-body: #3d4751;
    --muted: #8a9099;
}
html body.dark-theme:has(.blog-page--community) .sr {
    --brand: #e9a6bc;
    --brand-strong: #f0bfd0;
    --brand-hover: #f3c6d5;
    --brand-soft: #362732;
    --brand-soft-hover: #43303d;
    --brand-line: #4a3442;
    --brand-on: #241b23;
    --card-bg: var(--dark-bg-card, #2a2a2a);
    --card-line: var(--dark-border-primary, #404040);
    --text: var(--dark-text-primary, #e8e8e8);
    --text-body: var(--dark-text-secondary, #b0b0b0);
    --muted: var(--dark-text-muted, #888888);
}

/* ===== Прочие панели правой колонки: карточка и заголовок как у «Блог» ===== */
html body:has(.blog-page--community) .sr > .tools:not(.blog-side) {
    margin: 0 0 20px;
    padding: 14px 16px;
    background: var(--card-bg) !important;
    border: 1px solid var(--card-line) !important;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
    color: var(--text) !important;
    font-size: 13px;
}
html body:has(.blog-page--community) .sr > .tools:not(.blog-side) > h5 {
    position: static;
    height: auto;
    margin: 0 0 12px !important;
    padding: 0 0 8px !important;
    background: none !important;
    border: 0 !important;
    border-bottom: 1px solid var(--brand-line) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: var(--text) !important;
    font-family: inherit !important;
    font-size: 16px;
    font-weight: 700 !important;
    line-height: 1.3;
    text-align: left !important;
    text-shadow: none !important;
}
html body:has(.blog-page--community) .sr > .tools:not(.blog-side) a:not(.btn) {
    color: var(--brand) !important;
}
html body:has(.blog-page--community) .sr > .tools:not(.blog-side) a:not(.btn):hover {
    color: var(--brand-hover) !important;
}

/* ===== Панель «Анонсы перевода» и «Мои обсуждения»: текст и кнопки ===== */
html body .sr .tools.blog-side p {
    margin: 0 0 10px;
    color: var(--text-body) !important;
    line-height: 1.5;
}
html body .sr .tools.blog-side p a:not(.btn) {
    color: var(--brand) !important;
}
html body .sr .tools.blog-side.discuss-side label.checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 10px;
    padding: 0;
    color: var(--text) !important;
}
html body .sr .tools.blog-side.discuss-side label.checkbox input {
    float: none;
    margin: 0;
    accent-color: var(--brand) !important;
}
html body .sr .tools.blog-side.discuss-side .btn {
    width: 100%;
    min-height: 32px;
    padding: 5px 12px;
    border: 1px solid var(--brand-line) !important;
    border-radius: 8px !important;
    background: var(--card-bg) !important;
    background-image: none !important;
    box-shadow: none !important;
    color: var(--brand-strong) !important;
    font-weight: 600;
    text-shadow: none !important;
    white-space: normal;
}
html body .sr .tools.blog-side.discuss-side .btn:hover {
    background: var(--brand-soft) !important;
}

/* Картинка поста/анонса — не во всю высоту экрана */
html body .blog-page--community .post .post-image img {
    width: auto;
    max-height: 360px;
}

/* ===== Блог пользователя: строка под постом ===== */
html body .blog-page--user .post .info em {
    color: var(--muted) !important;
    font-style: normal;
}
html body .blog-page--user > .alert-info {
    border: 1px solid var(--brand-line) !important;
    border-radius: 10px;
    background: var(--brand-soft) !important;
    color: var(--text) !important;
    text-shadow: none;
}
html body .blog-page--user > .alert-info a {
    color: var(--brand-strong) !important;
    font-weight: 600;
}
html body .blog-page--community #info_empty {
    border: 1px solid var(--brand-line) !important;
    border-radius: 10px;
    background: var(--brand-soft) !important;
    color: var(--text) !important;
    text-shadow: none;
}
html body .blog-page--community #info_empty a {
    color: var(--brand-strong) !important;
    font-weight: 600;
}

/* ===== «Мои обсуждения»: вкладки как фильтры ленты ===== */
html body .discuss-page #comments-areas .nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 14px;
    padding: 0;
    border: 0 !important;
}
html body .discuss-page #comments-areas .nav-tabs::before,
html body .discuss-page #comments-areas .nav-tabs::after {
    display: none;
}
html body .discuss-page #comments-areas .nav-tabs > li {
    float: none;
    margin: 0;
}
html body .discuss-page #comments-areas .nav-tabs > li > a {
    margin: 0;
    padding: 5px 12px;
    border: 0 !important;
    border-radius: 8px !important;
    background: var(--brand-soft) !important;
    color: var(--brand-strong) !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}
html body .discuss-page #comments-areas .nav-tabs > li > a:hover {
    background: var(--brand-soft-hover) !important;
}
html body .discuss-page #comments-areas .nav-tabs > li.active > a,
html body .discuss-page #comments-areas .nav-tabs > li.active > a:hover {
    background: var(--brand) !important;
    color: var(--brand-on) !important;
}
html body .discuss-page #comments-areas .discussion-watchlist-tabs > li > a {
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 500;
}
html body .discuss-page #comments-areas .nav-tabs .badge {
    margin-left: 4px;
    padding: 1px 6px;
    background: #c0392b !important;
    color: #fff !important;
    font-size: 11px;
    text-shadow: none;
}

/* ===== «Мои обсуждения»: карточки ответов и обсуждений ===== */
html body .discuss-page #comments-areas .discussion-card {
    margin: 0 0 14px;
    padding: 14px 16px 10px;
    background: var(--card-bg) !important;
    border: 1px solid var(--card-line) !important;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
    color: var(--text) !important;
}
html body .discuss-page #comments-areas .discussion-card:hover {
    border-color: var(--brand-line) !important;
}
html body .discuss-page #comments-areas .discussion-card h3 {
    margin: 0 0 6px;
    color: var(--text) !important;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
}
html body .discuss-page #comments-areas .discussion-card h3 a {
    color: var(--brand) !important;
    text-decoration: none;
}
html body .discuss-page #comments-areas .discussion-card h3 a:hover {
    color: var(--brand-hover) !important;
    text-decoration: underline;
    text-underline-offset: 3px;
}
html body .discuss-page #comments-areas .discussion-parent {
    margin: 0 0 8px;
    color: var(--muted) !important;
    font-size: 13px;
}
html body .discuss-page #comments-areas .discussion-parent a {
    color: var(--text-body) !important;
}
html body .discuss-page #comments-areas .discussion-comment {
    margin: 0 0 10px;
    padding: 6px 0 6px 12px;
    border: 0 !important;
    border-left: 2px solid var(--brand-line) !important;
    background: transparent !important;
}
html body .discuss-page #comments-areas .discussion-body {
    color: var(--text-body) !important;
    font-size: 14px;
    line-height: 1.55;
}
html body .discuss-page #comments-areas .discussion-body a {
    color: var(--brand);
}
html body .discuss-page #comments-areas .discussion-comment small {
    display: block;
    margin-top: 4px;
    color: var(--muted) !important;
    font-size: 12px;
}
html body .discuss-page #comments-areas .discussion-comment small a {
    color: var(--brand) !important;
}
html body .discuss-page #comments-areas .discussion-card > .muted {
    margin: 4px 0 0;
    padding: 8px 0 0;
    border-top: 1px solid var(--brand-soft);
    color: var(--muted) !important;
    font-size: 12px;
}
html body .discuss-page #comments-areas .discussion-card > .muted a {
    color: var(--brand) !important;
}
html body .discuss-page #comments-areas .label-info {
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--brand-soft) !important;
    color: var(--brand-strong) !important;
    font-size: 11px;
    text-shadow: none;
}
html body .discuss-page #comments-areas .discussion-unread {
    background: #c0392b !important;
    text-shadow: none;
}

/* Кнопки: мелкие — бледные плашки, главная — заливка цветом логотипа */
html body .discuss-page #comments-areas .btn {
    border: 0 !important;
    border-radius: 8px !important;
    background: var(--brand-soft) !important;
    background-image: none !important;
    box-shadow: none !important;
    color: var(--brand-strong) !important;
    font-weight: 600;
    text-shadow: none !important;
}
html body .discuss-page #comments-areas .btn:hover {
    background: var(--brand-soft-hover) !important;
}
html body .discuss-page #comments-areas .btn-primary {
    background: var(--brand) !important;
    color: var(--brand-on) !important;
}
html body .discuss-page #comments-areas .btn-primary:hover {
    background: var(--brand-hover) !important;
}
html body .discuss-page #comments-areas .btn-mini {
    padding: 2px 10px;
    font-size: 12px;
}
html body .discuss-page #comments-areas .discussion-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
html body .discuss-page #comments-areas .discussion-bulk-confirm {
    border: 1px solid var(--brand-line) !important;
    border-radius: 10px;
    background: var(--brand-soft) !important;
    color: var(--text) !important;
    text-shadow: none;
}
html body .discuss-page #comments-areas .discussion-composer {
    border: 1px solid var(--brand-line) !important;
    border-radius: 10px;
    background: var(--brand-soft) !important;
    color: var(--text) !important;
}
html body .discuss-page #comments-areas .discussion-composer textarea {
    border: 1px solid var(--brand-line) !important;
    border-radius: 8px;
    background: var(--card-bg) !important;
    box-shadow: none;
    color: var(--text) !important;
}
html body .discuss-page #comments-areas .discussion-composer textarea:focus {
    border-color: var(--brand) !important;
    outline: 0;
    box-shadow: 0 0 0 3px var(--brand-soft);
}
html body .discuss-page #comments-areas .discussion-pagination {
    color: var(--muted);
    font-size: 13px;
}
html body .discuss-page #comments-areas > .tab-content > .tab-pane > .alert-info,
html body .discuss-page #comments-areas .tab-pane .alert-info {
    border: 1px solid var(--brand-line) !important;
    border-radius: 10px;
    background: var(--brand-soft) !important;
    color: var(--text) !important;
    text-shadow: none;
}
html body .discuss-page #comments-areas .btn:focus-visible,
html body .discuss-page #comments-areas .nav-tabs a:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

@media (max-width: 480px) {
    html body .discuss-page #comments-areas .discussion-card {
        padding: 12px 12px 8px;
        border-radius: 8px;
    }
    html body .discuss-page #comments-areas .discussion-card h3 {
        font-size: 16px;
    }
}
