/* ============================================================
   Форум: /forum, страница раздела, тема и формы.

   Оформление общее с главной и банлистом: карточка на --card-color, рамка
   в 7% белого, радиус 20px, приглушённый текст #8f8f9c, акцент
   var(--accent). Приставка fm-. Старые .card-forum, .block_forum_item,
   .flex_forum_* в style.css не трогаем: на них могут держаться другие
   страницы, а этим шаблонам они больше не нужны.
   ============================================================ */

.fm-page { color: #fff; }

.fm-page .ic {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ---------- шапка страницы ---------- */
.fm-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 20px;
    background: linear-gradient(110deg, rgba(55, 69, 237, .22), rgba(55, 69, 237, 0) 55%), var(--card-color);
}

.fm-head__title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.fm-head__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: linear-gradient(135deg, #7178ff, #4a51d6);
    color: #fff;
    box-shadow: 0 4px 16px rgba(95, 101, 220, .5);
}

.fm-head__name {
    font-family: Oswald, sans-serif;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-back {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 12px;
    background: rgba(255, 255, 255, .03);
    color: #b5b5c0;
    transition: all 140ms ease;
}

.fm-back:hover { color: #fff; border-color: rgba(255, 255, 255, .16); text-decoration: none; }

.fm-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: 0;
    border-radius: 14px;
    background: var(--btn-wallet-color);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background 140ms ease;
}

.fm-btn:hover { background: var(--btn-wallet-color-hover); color: #fff; text-decoration: none; }

/* ---------- раздел (карточка со списком форумов или тем) ---------- */
.fm-section {
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 20px;
    background: var(--card-color);
    overflow: hidden;
}

.fm-section__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.fm-section__head .ic { color: var(--a-href-color); }

.fm-list { display: flex; flex-direction: column; }

/* ---------- строка форума / темы ---------- */
.fm-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(190px, 280px);
    align-items: center;
    gap: 18px;
    padding: 14px 20px;
    border-top: 1px solid rgba(255, 255, 255, .05);
    transition: background 140ms ease;
}

.fm-list > .fm-row:first-child { border-top: 0; }

.fm-row:hover { background: rgba(255, 255, 255, .025); }

.fm-row--forum { grid-template-columns: 56px minmax(0, 1fr) minmax(190px, 280px); }

.fm-row__cover {
    font-size: 0;
    color: transparent;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .04);
    object-fit: cover;
}

.fm-row__main { min-width: 0; }

.fm-row__title {
    display: block;
    overflow: hidden;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-row__title:hover { color: var(--a-href-color); text-decoration: none; }

.fm-row__desc {
    display: block;
    margin-top: 3px;
    overflow: hidden;
    color: #8f8f9c;
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-row__desc a { color: inherit; }

/* Значки темы: закрыта, закреплена, ответы, просмотры */
.fm-marks {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.fm-mark {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .05);
    color: #b5b5c0;
    font-size: 12px;
}

.fm-mark .ic { width: 14px; height: 14px; }
.fm-mark--closed { background: rgba(255, 92, 92, .12); color: #ff8b8b; }
.fm-mark--fixed { background: rgba(255, 194, 102, .12); color: #ffc266; }

/* Последнее сообщение справа */
.fm-last {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
}

.fm-last:hover { text-decoration: none; }

.fm-last__ava {
    position: relative;
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
}

.fm-last__ava > img {
    font-size: 0;
    color: transparent;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, .06);
}

.fm-last__ava svg {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 50px;
    height: 50px;
    pointer-events: none;
}

.fm-last__text { min-width: 0; }

.fm-last__topic {
    display: block;
    overflow: hidden;
    color: #e6e6ee;
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-last:hover .fm-last__topic { color: var(--a-href-color); }

.fm-last__meta {
    display: block;
    color: #8f8f9c;
    font-size: 12px;
}

.fm-empty {
    color: #6f6f7c;
    font-size: 13px;
}

.fm-nothing {
    padding: 30px 20px;
    color: #8f8f9c;
    text-align: center;
}

@media (max-width: 767px) {
    .fm-row,
    .fm-row--forum { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .fm-row--forum { grid-template-columns: 56px minmax(0, 1fr); }
    .fm-row--forum .fm-last { grid-column: 1 / -1; }
    .fm-head { flex-wrap: wrap; }
}

/* ============================================================
   Тема: сообщение автора, ответы, поле ответа
   ============================================================ */
.fm-post,
.fm-msg > div,
.fm-reply {
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 20px;
    background: var(--card-color);
}

.fm-post { margin-bottom: 22px; }

.fm-section-title {
    margin: 0 0 12px 4px;
    font-family: Oswald, sans-serif;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: .02em;
    text-transform: uppercase;
    color: #fff;
}

.fm-comments {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 0 16px;
    padding: 0;
    list-style: none;
}

/* Автор: аватар, имя, группа и дата, справа три показателя */
.fm-post__author {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.fm-ava {
    position: relative;
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
}

.fm-ava--sm { width: 42px; height: 42px; }

.fm-ava > img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, .06);
    font-size: 0;
    color: transparent;
}

.fm-ava svg {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 64px;
    height: 64px;
    pointer-events: none;
}

.fm-author__text { min-width: 0; margin-right: auto; }

.fm-author__name {
    display: block;
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-author__name:hover { text-decoration: none; opacity: .85; }

.fm-author__meta {
    display: block;
    color: #8f8f9c;
    font-size: 12px;
}

.fm-stats { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

.fm-stat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .05);
    color: #b5b5c0;
    font-size: 12px;
}

.fm-stat .ic { width: 14px; height: 14px; }

/* Текст сообщения — разметка приходит из редактора, приводим к общему виду */
.fm-body {
    color: #d5d5de;
    font-size: 14px;
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.fm-body img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.fm-body a { color: var(--a-href-color); }
.fm-body a:hover { color: #fff; }

.fm-body blockquote {
    margin: 10px 0;
    padding: 10px 14px;
    border-left: 3px solid var(--accent);
    border-radius: 0 12px 12px 0;
    background: rgba(255, 255, 255, .04);
    color: #b5b5c0;
}

.fm-body pre,
.fm-body code {
    border-radius: 10px;
    background: rgba(255, 255, 255, .05);
    color: #e6e6ee;
}

.fm-body pre { padding: 12px 14px; overflow-x: auto; }

/* Спасибо: «Спасибо сказали: …» (наполняет скрипт, disp-n/disp-b — его) */
.fm-page .thank_str {
    margin-top: 14px;
    color: #8f8f9c;
    font-size: 13px;
}

.fm-page .thank_str a { color: var(--a-href-color); }

/* Кнопки под сообщением */
.fm-post__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, .06);
}

.fm-acts { display: flex; gap: 8px; flex-wrap: wrap; }

.fm-act {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 13px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    color: #cfcfd8;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 140ms ease;
}

.fm-act:hover { background: rgba(255, 255, 255, .09); color: #fff; text-decoration: none; }

.fm-act--danger { color: #ff8b8b; border-color: rgba(255, 92, 92, .25); }
.fm-act--danger:hover { background: rgba(255, 92, 92, .14); color: #ff8b8b; }

.fm-edited { color: #6f6f7c; font-size: 12px; }
.fm-edited a { color: var(--a-href-color); }

.fm-signature {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed rgba(255, 255, 255, .08);
    color: #8f8f9c;
    font-size: 13px;
}

/* Поле ответа: сам редактор рисует tinymce, здесь только рамка и низ */
.fm-reply { margin-bottom: 16px; }

.fm-reply textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 14px;
    background: rgba(255, 255, 255, .03);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    outline: 0;
}

.fm-reply__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.fm-pages { margin-top: 8px; }

@media (max-width: 767px) {
    .fm-post__author { flex-wrap: wrap; }
    .fm-stats { justify-content: flex-start; width: 100%; }
}

/* ============================================================
   Формы: создание/правка темы и сообщения
   ============================================================ */
.fm-card {
    padding: 22px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 20px;
    background: var(--card-color);
}

.fm-field { margin-bottom: 18px; }

.fm-label {
    display: block;
    margin-bottom: 7px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: #8f8f9c;
}

.fm-input,
.fm-page #forums_list select,
.fm-page #sections_list select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 14px;
    background: rgba(255, 255, 255, .03);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    outline: 0;
    transition: border-color 140ms ease;
}

.fm-input:focus,
.fm-page #forums_list select:focus,
.fm-page #sections_list select:focus { border-color: rgba(95, 101, 220, .55); }

.fm-input::placeholder { color: #6f6f7c; }

.fm-input option,
.fm-page #forums_list option,
.fm-page #sections_list option { background: #15151c; }

.fm-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.fm-grow { flex: 1; min-width: 200px; }

/* Картинка темы: превью, выбор файла, «Загрузить» */
.fm-upload {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0;
}

.fm-upload__pic {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .04);
    object-fit: cover;
    font-size: 0;
    color: transparent;
}

.fm-file {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    margin: 0;
    border: 1px dashed rgba(255, 255, 255, .16);
    border-radius: 14px;
    background: rgba(255, 255, 255, .02);
    color: #8f8f9c;
    font-size: 14px;
    cursor: pointer;
    transition: all 140ms ease;
}

.fm-file:hover { color: #fff; border-color: rgba(95, 101, 220, .55); }

.fm-form__bottom {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 16px;
}

#img_result,
#topic_result { margin-top: 8px; }

/* ============================================================
   Настройки форума (/forum/edit_forum): разделы и их форумы
   ============================================================ */
.fm-adm {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.fm-adm__side,
.fm-adm__main {
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 20px;
    background: var(--card-color);
}

.fm-adm__title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.fm-adm__title .ic { color: var(--a-href-color); }

.fm-adm__side .groups-body {
    margin-top: 14px;
    max-height: 200px;
    overflow-y: auto;
}

.fm-adm__btns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 14px;
}

.fm-adm__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Строка форума в настройках: картинка, название, описание, порядок, действия */
.fm-adm-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1.2fr) auto auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 14px;
    background: rgba(255, 255, 255, .03);
}

.fm-adm-row__pic { display: flex; flex-direction: column; gap: 6px; }

.fm-adm-row__pic img {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
    background: rgba(255, 255, 255, .04);
    font-size: 0;
    color: transparent;
}

.fm-adm-row__pic input[type="file"] { max-width: 96px; font-size: 11px; color: #8f8f9c; }

.fm-adm-row__btns { display: flex; gap: 6px; }

.fm-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 10px;
    background: rgba(255, 255, 255, .04);
    color: #cfcfd8;
    cursor: pointer;
    transition: all 140ms ease;
}

.fm-icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.fm-icon-btn--danger { color: #ff8b8b; }
.fm-icon-btn--danger:hover { background: rgba(255, 92, 92, .14); color: #ff8b8b; }

@media (max-width: 991px) {
    .fm-adm { grid-template-columns: minmax(0, 1fr); }
    .fm-adm-row { grid-template-columns: 96px minmax(0, 1fr); }
    .fm-adm-row > .fm-input,
    .fm-adm-row > .fm-adm-row__btns { grid-column: span 1; }
}

/* Группы доступа (переключатели bootstrap) и выбор файла в настройках */
.fm-page .groups-body label,
.fm-page .groups-body .btn {
    display: block;
    width: 100%;
    padding: 10px 14px;
    margin: 0 0 6px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    background: rgba(255, 255, 255, .04);
    box-shadow: none;
    color: #cfcfd8;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
    transition: all 140ms ease;
}

.fm-page .groups-body label:hover,
.fm-page .groups-body .btn:hover { background: rgba(255, 255, 255, .09); color: #fff; }

.fm-page .groups-body label.active,
.fm-page .groups-body .btn.active {
    border-color: rgba(95, 101, 220, .55);
    background: rgba(95, 101, 220, .22);
    color: #fff;
}

.fm-adm-row__pic input[type="file"] { width: 96px; font-size: 0; }

.fm-adm-row__pic input[type="file"]::file-selector-button {
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 8px;
    background: rgba(255, 255, 255, .06);
    color: #cfcfd8;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
}
