/* Переменные для форума */
:root {
    --f-bg: #100b0b;
    --f-card: rgba(20, 20, 20, 0.6);
    --f-accent: #ff8c00;
    --f-border: rgba(255, 140, 0, 0.1);
    --f-text: #e0e0e0;
}

body {
    margin: 0;
    padding: 0;
    /* Основной цвет твоего сайта как база */
    background-color: var(--f-bg);
    
    /* Слоистый фон: свечение сверху + легкий шум + основной цвет */
    background-image: 
        radial-gradient(circle at 50% -10%, rgba(255, 140, 0, 0.12) 0%, transparent 40%), /* Оранжевое пятно сверху */
        radial-gradient(circle at 0% 100%, rgba(255, 140, 0, 0.05) 0%, transparent 25%),  /* Свечение в левом нижнем углу */
        linear-gradient(rgba(16, 11, 11, 0.4), rgba(16, 11, 11, 0.4)), /* Полупрозрачная накладка */
        url('https://www.transparenttextures.com'); /* Очень тонкая текстура, чтобы не было "плоско" */
    
    background-attachment: fixed;
    color: var(--f-text);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
}

/* Настройка прокрутки для всей страницы и всех блоков */
* {
    scrollbar-width: thin; /* Для Firefox */
    scrollbar-color: var(--f-accent) #151010; /* Для Firefox */
}

/* Основной контейнер скроллбара */
::-webkit-scrollbar {
    width: 8px; /* Ширина вертикального скролла */
    height: 8px; /* Высота горизонтального скролла */
}

/* Фон (дорожка) скроллбара */
::-webkit-scrollbar-track {
    background: #100b0b; /* Твой основной цвет сайта */
    border-radius: 0;
}

/* Ползунок (то, за что тянем) */
::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--f-accent) 0%, #ff5500 100%);
    border-radius: 10px;
    border: 2px solid #100b0b; /* Отступ вокруг ползунка, создающий эффект парения */
    transition: all 0.3s ease;
}

/* Эффект при наведении на ползунок */
::-webkit-scrollbar-thumb:hover {
    background: #ffa500;
    box-shadow: 0 0 10px rgba(255, 140, 0, 0.5);
}

/* Плавность прокрутки для всей страницы */
html {
    scroll-behavior: smooth;
}

/* Добавим легкую стеклянную подложку для всего контента форума */
.forum-wrapper {
    background: rgba(255, 255, 255, 0.01);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
}

.forum-wrapper {
    max-width: 1100px;
    margin: 50px auto;
    padding: 20px;
}

/* Сетка категорий */
.f-category {
    background: rgba(20, 16, 16, 0.7); /* Чуть светлее основного фона */
    border: 1px solid rgba(255, 140, 0, 0.15); /* Оранжевая полупрозрачная рамка */
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: 0.3s ease;
}

.f-category:hover {
    border-color: var(--f-accent);
    box-shadow: 0 0 20px rgba(255, 140, 0, 0.05);
}

.f-row {
    display: flex;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.f-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 140, 0, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--f-accent);
    margin-right: 20px;
}

.f-info { flex: 1; }
.f-info h3 { margin: 0; font-size: 1.2rem; }
.f-info h3 a { color: #fff; text-decoration: none; transition: 0.2s; }
.f-info h3 a:hover { color: var(--f-accent); }
.f-info p { margin: 5px 0 0; color: #888; font-size: 0.9rem; }

.f-meta {
    display: flex;
    gap: 30px;
    text-align: center;
    padding: 0 30px;
    color: #555;
    font-size: 0.85rem;
}

.f-meta b { display: block; color: var(--f-accent); font-size: 1.1rem; }

.f-last {
    width: 250px;
    font-size: 0.85rem;
    border-left: 1px solid rgba(255,255,255,0.05);
    padding-left: 20px;
}

.f-last a { color: var(--f-accent); text-decoration: none; font-weight: bold; }
.f-last span { display: block; color: #555; margin-top: 4px; }

/* Навигация (Хлебные крошки) */
.f-breadcrumb {
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: #555;
}
.f-breadcrumb a { color: var(--f-accent); text-decoration: none; }
.f-breadcrumb i { font-size: 0.7rem; margin: 0 10px; }

/* Заголовок с кнопкой */
.f-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center; /* Центрируем по вертикали */
    margin-bottom: 30px;
    background: rgba(255, 255, 255, 0.02); /* Легкая подложка для структуры */
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 140, 0, 0.05);
}

/* Убираем лишние отступы у заголовка, чтобы они не ломали центровку */
.f-header-actions h1 {
    margin: 0;
    font-size: 1.8rem;
    line-height: 1.2;
}

.f-header-actions p {
    margin: 5px 0 0 0; /* Небольшой отступ сверху для описания */
    color: #888;
    font-size: 0.95rem;
}

/* Метка закрепленной темы */
.badge-pinned {
    background: var(--f-accent);
    color: #000;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 800;
    vertical-align: middle;
    margin-right: 8px;
}

/* Стили для иконок в списке тем */
.f-icon i.fa-thumbtack {
    color: var(--f-accent);
    transform: rotate(45deg);
}

/* Основной стиль кнопки создания темы */
.btn-forum {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #ff8c00 0%, #ff5500 100%); /* Насыщенный оранжевый градиент */
    color: #000 !important; /* Черный текст для контраста */
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(255, 140, 0, 0.3);
    cursor: pointer;
}

/* Эффект при наведении */
.btn-forum:hover {
    transform: translateY(-3px) scale(1.02); /* Кнопка приподнимается */
    box-shadow: 0 8px 25px rgba(255, 140, 0, 0.5); /* Свечение усиливается */
    filter: brightness(1.1); /* Становится чуть ярче */
}

/* Эффект при нажатии */
.btn-forum:active {
    transform: translateY(-1px);
}

/* Добавим иконку плюса через псевдоэлемент, если её нет в HTML */
.btn-forum::before {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1rem;
}


.topic-title {
    font-size: 2rem;
    margin: 20px 0 30px;
    color: var(--f-accent);
}

.post-card {
    display: flex;
    background: rgba(20, 16, 16, 0.7);
    border: 1px solid rgba(255, 140, 0, 0.1);
    border-radius: 12px;
    margin-bottom: 20px;
    overflow: hidden;
}

.first-post { border-left: 4px solid var(--f-accent); }

.post-sidebar {
    width: 180px;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid rgba(255, 255, 255, 0.03);
}

.user-avatar{
    transform: scale(2);
    margin: 22px;
}

.user-avatar img {
    width: 80px;
    border-radius: 10px;
    background: #1a1a1a;
    border: 2px solid #222;
}

.user-name {
    color: var(--f-accent);
    text-decoration: none;
    font-weight: 700;
    margin-top: 10px;
}

.user-rank {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #666;
    margin-top: 5px;
}

.post-content {
    flex: 1;
    padding: 25px;
    display: flex;
    flex-direction: column;
}

.post-header {
    font-size: 0.8rem;
    color: #444;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    padding-bottom: 10px;
}

.post-text {
    line-height: 1.6;
    color: #ccc;
    font-size: 1rem;
}

/* Форма */
.reply-form {
    margin-top: 40px;
    background: var(--f-card);
    padding: 25px;
    border-radius: 16px;
    border: 1px solid var(--f-border);
    box-sizing: border-box; /* Важно: отступы не увеличивают ширину */
}




.reply-form textarea {
    width: 100%;
    height: 150px;
    background: #050505;
    border: 1px solid #222;
    border-radius: 8px;
    color: #fff;
    padding: 15px;
    margin: 15px 0;
    resize: vertical;
}


.mc-face-viewer-forum {
    image-rendering: optimizeSpeed;
    image-rendering: -moz-crisp-edges;
    image-rendering: -o-crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    -ms-interpolation-mode: nearest-neighbor;
    background-size: 256px;
    width: 32px;
    height: 32px;
    background-position: -32px -32px;
    overflow: hidden;
    display: inline-block;
}

/* Эффект при наведении на аватар */
.post-sidebar:hover .mc-face-viewer-forum {
    border-color: var(--f-accent);
    transform: scale(1.05);
    transition: 0.3s;
}

.editor-toolbar {
    background: rgba(0, 0, 0, 0.4);
    padding: 10px;
    border-radius: 12px 12px 0 0;
    border: 1px solid rgba(255, 140, 0, 0.1);
    border-bottom: none;
    display: flex;
    gap: 8px;
    box-sizing: border-box;
}

.editor-toolbar button {
    background: transparent;
    border: 1px solid transparent;
    color: #888;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
}

.editor-toolbar button:hover {
    background: rgba(255, 140, 0, 0.1);
    color: var(--f-accent);
    border-color: rgba(255, 140, 0, 0.3);
}

.editor-toolbar .separator {
    width: 1px;
    background: #222;
    margin: 0 5px;
}

#forum-editor {
    width: 100%; /* Теперь будет строго по ширине родителя */
    min-height: 180px;
    background: #151010; /* Чуть светлее основного фона сайта #100b0b */
    border: 1px solid rgba(255, 140, 0, 0.1);
    border-radius: 0 0 12px 12px;
    color: #e0e0e0;
    padding: 15px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical; /* Разрешаем менять высоту, но не ширину */
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box; /* Гарантирует, что padding не расширит textarea */
    display: block;
}

/* Сделаем скроллбар в поле ввода оранжевым под стиль проекта */
#forum-editor::-webkit-scrollbar {
    width: 8px;
}
#forum-editor::-webkit-scrollbar-thumb {
    background: var(--f-accent);
    border-radius: 10px;
}
#forum-editor::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
}

.forum-quote {
    background: rgba(255, 140, 0, 0.05);
    border-left: 3px solid var(--f-accent);
    margin: 15px 0;
    padding: 10px 20px;
    color: #aaa;
    font-style: italic;
    border-radius: 0 8px 8px 0;
}

.editor-toolbar button i {
    font-family: "Font Awesome 6 Free" !important; /* Принудительный шрифт */
    font-style: normal !important;
    font-variant: normal !important;
    text-rendering: auto !important;
    -webkit-font-smoothing: antialiased !important;
    font-weight: 900 !important; /* Обязательно 900 для fa-solid */
    display: inline-block !important;
    color: var(--f-accent) !important; /* Чтобы они были оранжевыми */
}

/* Увеличим кнопки, чтобы по ним было удобно кликать */
.editor-toolbar button {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
}

.size-selector {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 140, 0, 0.1);
    gap: 5px;
    position: relative;
}

.size-selector i {
    font-size: 0.8rem;
    color: var(--f-accent);
}

.size-selector select {
    background: transparent;
    border: none;
    color: #888;
    font-size: 0.8rem;
    outline: none;
    cursor: pointer;
    padding: 5px 0;
    font-family: 'Inter', sans-serif;
}

.size-selector select option {
    background: #151010; /* Под цвет твоего редактора */
    color: #e0e0e0;
}

.custom-select-wrapper {
    position: relative;
    user-select: none;
}

.custom-select {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 140, 0, 0.1);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 110px;
}

.custom-select:hover {
    background: rgba(255, 140, 0, 0.05);
    border-color: rgba(255, 140, 0, 0.3);
}

.custom-select span {
    font-size: 0.85rem;
    color: #aaa;
    flex: 1;
}

.custom-select .arrow {
    font-size: 0.7rem;
    transition: 0.3s;
    color: #555;
}

/* Выпадающее меню */
.custom-options {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 180px;
    background: rgba(16, 11, 11, 0.95);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 140, 0, 0.2);
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8);
    z-index: 100;
    overflow: hidden;
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.custom-options div {
    padding: 12px 15px;
    color: #ccc;
    cursor: pointer;
    transition: 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.custom-options div:last-child { border-bottom: none; }

.custom-options div:hover {
    background: rgba(255, 140, 0, 0.1);
    color: #fff;
    padding-left: 20px; /* Эффект смещения при наведении */
}

/* Сетка для выбора цвета */
.color-grid {
    display: none;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px !important;
    width: 140px !important;
}

.color-grid div {
    width: 25px;
    height: 25px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0 !important;
    transition: transform 0.2s, border-color 0.2s;
}

.color-grid div:hover {
    transform: scale(1.2);
    border-color: #fff;
    background-image: linear-gradient(rgba(255,255,255,0.2), transparent);
}

.arrow-color {
    font-size: 0.7rem;
    transition: 0.3s;
    color: #555;
}

/* --- Адаптивность для мобильных устройств (2026 Mobile Standard) --- */

@media (max-width: 992px) {
    .forum-wrapper {
        padding: 15px;
        margin: 20px auto;
    }

    /* Главная страница: меняем сетку категорий */
    .f-row {
        grid-template-columns: 50px 1fr; /* Убираем мета-данные и последний пост в бок */
        flex-wrap: wrap;
        gap: 10px;
    }

    .f-meta, .f-last {
        display: none; /* Скрываем на мобилках, чтобы не перегружать */
    }

    .f-info h3 {
        font-size: 1.1rem;
    }
}

@media (max-width: 768px) {
    /* Страница темы: Перестраиваем карточку сообщения */
    .post-card {
        flex-direction: column; /* Сайдбар теперь сверху */
    }

    .post-sidebar {
        width: 100%;
        flex-direction: row; /* Игрок и аватар в одну линию */
        padding: 10px 20px;
        justify-content: flex-start;
        gap: 15px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    }

    .user-avatar img {
        width: 40px; /* Уменьшаем аватар на мобилке */
        height: 40px;
    }
    
    .mc-face-viewer-forum {
        width: 45px;
        height: 45px;
    }

    .user-name {
        margin-top: 0;
        font-size: 1rem;
    }

    .user-rank {
        display: none; /* Скрываем ранг на мелких экранах для чистоты */
    }

    .post-content {
        padding: 15px;
    }

    .topic-title {
        font-size: 1.5rem;
    }

    /* Панель редактора: делаем кнопки крупнее для пальцев */
    .editor-toolbar {
        overflow-x: auto; /* Позволяем кнопкам прокручиваться, если не влезают */
        white-space: nowrap;
        padding: 12px 5px;
    }

    .custom-select {
        min-width: 90px;
        padding: 8px;
    }

    .btn-forum {
        width: 100%; /* Кнопка во всю ширину */
        text-align: center;
        justify-content: center;
    }
}

/* Оптимизация для самых маленьких экранов (iPhone SE и др.) */
@media (max-width: 480px) {
    .f-header-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .f-icon {
        display: none; /* Убираем иконки разделов, оставляем только текст */
    }

    .post-text {
        font-size: 0.95rem; /* Чуть уменьшаем шрифт для читабельности */
    }
}


.new-topic-box {
    background: var(--f-card);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--f-border);
}

.input-group-topic {
    margin-bottom: 25px;
}

.input-group-topic label, .editor-container label {
    display: block;
    color: var(--f-accent);
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.input-group-topic input {
    width: 100%;
    background: #050505;
    border: 1px solid #222;
    padding: 15px;
    border-radius: 8px;
    color: #fff;
    font-size: 1.1rem;
    box-sizing: border-box;
}

.form-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 20px;
    margin-top: 25px;
}

.btn-cancel {
    color: #666;
    text-decoration: none;
    transition: 0.3s;
}

.btn-cancel:hover { color: #fff; }

.preview-box {
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 8px;
    border: 1px dashed #333;
}

/* Стили для ссылок в тексте */
.forum-link {
    color: var(--f-accent);
    text-decoration: none;
    border-bottom: 1px dashed rgba(255, 140, 0, 0.4);
    transition: 0.2s;
}

.forum-link:hover {
    border-bottom-style: solid;
    opacity: 0.8;
}

/* Стили для изображений */
.forum-img-wrapper {
    margin: 10px 0;
    display: inline-block;
    max-width: 100%;
}

.forum-img-wrapper img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.forum-search-box {
    margin-bottom: 30px;
    background: var(--f-card);
    padding: 15px;
    border-radius: 16px;
    border: 1px solid var(--f-border);
}

.search-wrapper {
  display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 6px 6px 15px; /* Уменьшаем внутренний отступ для кнопки */
    border-radius: 12px;
    border: 1px solid rgba(255, 140, 0, 0.1);
    height: 45px; /* Фиксированная высота для идеальной симметрии */
    box-sizing: border-box;
    transition: 0.3s;
}

.search-wrapper:focus-within {
    border-color: var(--f-accent);
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.1);
}

.search-wrapper i {
        color: var(--f-accent);
    opacity: 0.6;
    font-size: 0.9rem;
}

.search-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    height: 100%; /* Занимает всю высоту родителя */
}

.search-wrapper .btn-forum {
    height: 100%; /* Кнопка будет точно такой же высоты, как обертка */
    padding: 0 20px;
    border-radius: 8px; /* Чуть меньше скругление, чем у обертки */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    margin: 0; /* Убираем лишние отступы */
}

.search-wrapper:focus-within {
    border-color: var(--f-accent);
    background: rgba(0, 0, 0, 0.6);
}

.search-wrapper input::placeholder {
    color: #444;
}