/**
 * Комментарии (виджет modules/comments, comments_block.php + single_comment.php) в новом дизайне.
 * Действует только внутри обёртки .cmt-brand: коллекция, пост блога, анонс. Читалка и книга v4
 * со своими темами не затронуты. Разметку и классы виджета не меняем — на них опирается js комментариев.
 */

html body .cmt-brand {
    --cmt-brand: var(--ui-accent, #9a4669);
    --cmt-brand-hover: var(--ui-accent-hover, #833a59);
    --cmt-soft: var(--ui-accent-soft, #f7edf2);
    --cmt-line: var(--ui-accent-line, #ecd3df);
    --cmt-on: #fff;
    --cmt-card-line: #ececec;
    --cmt-input: #fff;
    --cmt-text: #2b2f33;
    --cmt-muted: #8a9099;
    color: var(--cmt-text);
}
html body.dark-theme .cmt-brand {
    --cmt-brand: var(--ui-accent, #e9a6bc);
    --cmt-brand-hover: var(--ui-accent-hover, #f3c6d5);
    --cmt-soft: var(--ui-accent-soft, #362732);
    --cmt-line: var(--ui-accent-line, #4a3442);
    --cmt-on: var(--ui-accent-on, #241b23);
    --cmt-card-line: var(--dark-border-primary, #404040);
    --cmt-input: var(--dark-bg-secondary, #1f1f1f);
    --cmt-text: var(--dark-text-primary, #e8e8e8);
    --cmt-muted: var(--dark-text-muted, #888888);
}

html body .cmt-brand .comments-block { margin: 0; width: auto; float: none; }

/* Шапка списка: «Всего комментариев», «Фильтр», «Удалить все» */
html body .cmt-brand .comments-control { background: transparent; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
html body .cmt-brand .comments-control .btn-group { float: none; margin: 0; }
html body .cmt-brand .comments-control .btn-group:first-child { margin-right: auto; }
html body .cmt-brand .comments-control span.btn-link { padding: 0; color: var(--cmt-muted); font-size: 13px; text-decoration: none; cursor: default; }
html body .cmt-brand .comments-control .btn { border: 1px solid var(--cmt-card-line); border-radius: 999px; background: var(--cmt-input); color: var(--cmt-text); box-shadow: none; text-shadow: none; font-size: 13px; }
html body .cmt-brand .comments-control .btn:hover { border-color: var(--cmt-line); color: var(--cmt-brand); }
html body .cmt-brand .comments-load-more { margin: 0 0 10px; }
html body .cmt-brand .comments-load-more a { display: inline-block; padding: 6px 12px; border-radius: 999px; background: var(--cmt-soft); color: var(--cmt-brand); font-size: 13px; font-weight: 600; text-shadow: none; }

/* Пустой список и предупреждения */
html body .cmt-brand .comments-block > .alert:not(.alert-danger):not(.alert-info) { margin: 0 0 12px; padding: 12px 14px; border: 1px dashed var(--cmt-card-line); border-radius: 12px; background: transparent; color: var(--cmt-muted); text-shadow: none; }
html body .cmt-brand .comments-block > .alert { border-radius: 12px; text-shadow: none; }

/* Один комментарий */
html body .cmt-brand .single-comment { margin: 0 0 10px; padding: 12px 14px; border: 1px solid var(--cmt-card-line); border-radius: 12px; background: transparent; box-shadow: none; }
/* Непрочитанный: мягкая подложка и полоска слева (вместо синей тени и синего подвала из v3.1.css) */
html body .cmt-brand .single-comment.new { border: 1px solid var(--cmt-line) !important; border-left: 3px solid var(--cmt-brand) !important; background: var(--cmt-soft); box-shadow: none; }
html body .cmt-brand .single-comment .comment-footer,
html body .cmt-brand .single-comment.new .comment-footer { background: transparent; }
html body .cmt-brand .single-comment div.comment-body { margin: 0 0 8px; padding: 0; border: 0; background: transparent; color: var(--cmt-text); font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
html body .cmt-brand .single-comment .comment_image img { max-width: 100%; height: auto; border-radius: 8px; }
html body .cmt-brand .single-comment .comment-link { color: var(--cmt-muted); text-decoration: none; }
html body .cmt-brand .single-comment .comment-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--cmt-muted); font-size: 12px; }
html body .cmt-brand .single-comment .comment-footer > a:not([class]) { color: var(--cmt-text); font-weight: 600; text-decoration: none; }
html body .cmt-brand .single-comment .comment-footer > a:not([class]):hover { color: var(--cmt-brand); }
html body .cmt-brand .single-comment .comment-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
html body .cmt-brand .single-comment .comment-footer .pull-right { margin-left: auto; float: none; }
html body .cmt-brand .single-comment .comment-footer .pull-right ~ .pull-right { margin-left: 0; }
html body .cmt-brand .single-comment .comment-footer .btn-mini { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; min-height: 28px; border-radius: 8px; }
html body .cmt-brand .single-comment .comment-footer .btn-mini:hover { background: var(--cmt-soft); }

/* Форма: кнопки «spoiler» и эмодзи — строкой над полем, а не поверх него */
html body .cmt-brand .comment-writer { margin-top: 12px; }
html body .cmt-brand .comment-writer .control-buttons { display: flex; justify-content: flex-end; gap: 6px; float: none; margin: 0 0 6px; }
html body .cmt-brand .comment-writer .control-buttons .btn,
html body .cmt-brand .comment-writer .type-buttons .btn { padding: 4px 10px; border: 1px solid var(--cmt-card-line); border-radius: 999px; background: var(--cmt-input); color: var(--cmt-text); box-shadow: none; text-shadow: none; font-size: 12px; line-height: 1.4; }
html body .cmt-brand .comment-writer .control-buttons .btn:hover { border-color: var(--cmt-line); color: var(--cmt-brand); }
html body .cmt-brand .comment-writer textarea.comment-body { display: block; width: 100%; max-width: 100%; box-sizing: border-box; min-height: 110px; margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--cmt-card-line); border-radius: 12px; background: var(--cmt-input); color: var(--cmt-text); box-shadow: none; font-size: 14px; resize: vertical; }
html body .cmt-brand .comment-writer textarea.comment-body:focus { border-color: var(--cmt-brand); outline: 0; box-shadow: 0 0 0 3px var(--cmt-soft); }
html body .cmt-brand .comment-writer .btn-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 6px; }
html body .cmt-brand .comment-writer .btn-toolbar .btn-group { float: none; margin: 0; }
html body .cmt-brand .comment-writer .btn-toolbar .btn-primary { padding: 7px 16px; border: 0; border-radius: 10px; background: var(--cmt-brand); color: var(--cmt-on); box-shadow: none; text-shadow: none; font-weight: 600; }
html body .cmt-brand .comment-writer .btn-toolbar .btn-primary:hover { background: var(--cmt-brand-hover); }
html body .cmt-brand .comment-writer .btn-image,
html body .cmt-brand .comment-writer .btn-cancel { padding: 7px 14px; border: 1px solid var(--cmt-line); border-radius: 10px; background: var(--cmt-soft); color: var(--cmt-brand); box-shadow: none; text-shadow: none; font-weight: 600; }
html body .cmt-brand .comment-writer .btn-image:hover,
html body .cmt-brand .comment-writer .btn-cancel:hover { border-color: var(--cmt-brand); }
html body .cmt-brand .comment-writer .check_file { color: var(--cmt-muted); font-size: 12px; overflow-wrap: anywhere; }
/* «Обычный / Оффтоп / Отзыв» — переключатель справа; на телефоне — отдельной строкой во всю ширину */
html body .cmt-brand .comment-writer .type-buttons { display: inline-flex; gap: 4px; margin-left: auto; }
html body .cmt-brand .comment-writer .type-buttons .btn.active { border-color: var(--cmt-brand); background: var(--cmt-soft); color: var(--cmt-brand); font-weight: 600; }
html body .cmt-brand .comment-writer .type-buttons .btn-danger.active { border-color: #c0392b; background: #fdecea; color: #b03a2e; }
html body .cmt-brand .comment-writer .type-buttons .btn-success.active { border-color: #2e8b57; background: #e8f5ee; color: #23744a; }
html body.dark-theme .cmt-brand .comment-writer .type-buttons .btn-danger.active { background: #3a2222; color: #f1a39b; }
html body.dark-theme .cmt-brand .comment-writer .type-buttons .btn-success.active { background: #1f3428; color: #8fd3a9; }
html body .cmt-brand .comment-writer form small { color: var(--cmt-muted); font-size: 12px; }

/* dark-theme.css красит .btn / .btn-primary / .btn-success / textarea / .comment-footer через !important —
 * внутри .cmt-brand цвета перебиваем тем же способом (только цвета, не размеры). */
html body .cmt-brand .comment-writer .btn-toolbar .btn-primary { background: var(--cmt-brand) !important; border-color: var(--cmt-brand) !important; color: var(--cmt-on) !important; }
html body .cmt-brand .comment-writer .btn-toolbar .btn-primary:hover { background: var(--cmt-brand-hover) !important; border-color: var(--cmt-brand-hover) !important; }
html body .cmt-brand .comment-writer .btn-toolbar .btn-image,
html body .cmt-brand .comment-writer .btn-toolbar .btn-cancel { background: var(--cmt-soft) !important; border-color: var(--cmt-line) !important; color: var(--cmt-brand) !important; }
html body .cmt-brand .comment-writer .control-buttons .btn,
html body .cmt-brand .comment-writer .type-buttons .btn,
html body .cmt-brand .comments-control .btn { background: var(--cmt-input) !important; border-color: var(--cmt-card-line) !important; color: var(--cmt-text) !important; }
html body .cmt-brand .comment-writer .type-buttons .btn.active { background: var(--cmt-soft) !important; border-color: var(--cmt-brand) !important; color: var(--cmt-brand) !important; }
html body .cmt-brand .comment-writer .type-buttons .btn-danger.active { background: #fdecea !important; border-color: #c0392b !important; color: #b03a2e !important; }
html body .cmt-brand .comment-writer .type-buttons .btn-success.active { background: #e8f5ee !important; border-color: #2e8b57 !important; color: #23744a !important; }
html body.dark-theme .cmt-brand .comment-writer .type-buttons .btn-danger.active { background: #3a2222 !important; color: #f1a39b !important; }
html body.dark-theme .cmt-brand .comment-writer .type-buttons .btn-success.active { background: #1f3428 !important; color: #8fd3a9 !important; }
html body .cmt-brand .comment-writer textarea.comment-body { background: var(--cmt-input) !important; border-color: var(--cmt-card-line) !important; color: var(--cmt-text) !important; }
html body .cmt-brand .comment-writer textarea.comment-body:focus { border-color: var(--cmt-brand) !important; }
html body .cmt-brand .single-comment .comment-footer { background: transparent !important; }

@media (max-width: 640px) {
    html body .cmt-brand .comment-writer .type-buttons { margin-left: 0; flex: 1 0 100%; }
    html body .cmt-brand .comment-writer .type-buttons .btn { flex: 1 1 0; }
    html body .cmt-brand .single-comment { padding: 10px 12px; }
}
