@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Unbounded:wght@400;600;700;800;900&display=swap');

:root {
    --bg-color: #111111;
    --panel-bg: rgba(25, 25, 25, 0.6);
    --border-color: rgba(255, 255, 255, 0.08);
    --primary-color: #ffa500; 
    --primary-gradient: linear-gradient(135deg, #ffa500 0%, #ff6a00 100%);
    --text-main: #e2e2e5;
    --text-muted: #8a8a93;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: 'Manrope', sans-serif;
    line-height: 1.6;
    animation: fadeIn 0.5s ease forwards;
}

@keyframes fadeIn { 
    from { opacity: 0; } 
    to { opacity: 1; } 
}

a { text-decoration: none; color: inherit; transition: color 0.2s; }
.topic-link:hover { color: var(--primary-color); }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

h1, h2, h3, .btn-primary { 
    font-family: 'Unbounded', sans-serif; 
}

/* Кастомный лоадер при загрузке страниц */
#page-loader {
    position: fixed; 
    top: 0; 
    left: 0; 
    height: 3px;
    background: var(--primary-gradient);
    z-index: 9999; 
    width: 0%;
    transition: width 0.3s ease, opacity 0.3s ease;
    box-shadow: 0 0 10px var(--primary-color);
}

/* --- ШАПКА ФОРУМА (HEADER) --- */
.header {
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 40px; 
    height: 70px;
    display: flex; 
    align-items: center; 
    justify-content: space-between;
    position: sticky; 
    top: 0; 
    z-index: 1000;
}
.nav-logo { 
    font-family: 'Unbounded', sans-serif; 
    font-size: 20px; 
    font-weight: 900; 
    letter-spacing: 1px; 
    color: #fff; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
}
.nav-logo span { color: var(--primary-color); }
.nav-logo img { height: 35px; }

.user-menu { 
    display: flex; 
    align-items: center; 
    gap: 15px; 
    font-size: 14px; 
}
.user-menu strong { color: #fff; }

/* --- КНОПКИ --- */
button, .btn-secondary, .btn-primary, .btn-warning {
    cursor: pointer; 
    border: none; 
    padding: 12px 20px;
    border-radius: 8px; 
    font-weight: 700; 
    font-size: 13px;
    text-transform: uppercase; 
    transition: 0.3s;
    display: inline-flex; 
    align-items: center; 
    gap: 8px;
}
.btn-primary { 
    background: var(--primary-gradient); 
    color: #fff; 
    box-shadow: 0 5px 15px rgba(77, 166, 255, 0.2); 
}
.btn-primary:hover { 
    transform: translateY(-2px); 
    box-shadow: 0 8px 25px rgba(77, 166, 255, 0.4); 
}
.btn-secondary { 
    background-color: rgba(255,255,255,0.05); 
    color: #fff; 
    border: 1px solid var(--border-color); 
}
.btn-secondary:hover { 
    background-color: rgba(255,255,255,0.1); 
}
.btn-warning { 
    background-color: rgba(217, 61, 61, 0.1); 
    color: #ff4d4d; 
    border: 1px solid rgba(217, 61, 61, 0.3); 
}

/* --- СТИЛИ МОДЕРАТОРА --- */
.username-mod {
    color: #2ecc71; 
    font-weight: 700;
    display: inline-flex; 
    align-items: center; 
    gap: 6px;
    text-shadow: 0 0 10px rgba(46, 204, 113, 0.3);
}
.mod-badge-new {
    display: inline-block;
    background: rgba(46, 204, 113, 0.15);
    border: 1px solid rgba(46, 204, 113, 0.3);
    color: #2ecc71;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
    box-shadow: 0 2px 10px rgba(46, 204, 113, 0.1);
    backdrop-filter: blur(4px);
}

/* --- МАКЕТ (LAYOUT) --- */
.main-layout { 
    display: flex; 
    gap: 30px; 
    margin-top: 40px; 
    margin-bottom: 50px; 
}
.forum-list { flex: 1; }
.sidebar { width: 300px; }

/* --- КАТЕГОРИИ И ТЕМЫ --- */
.category-block {
    background-color: var(--panel-bg); 
    backdrop-filter: blur(10px);
    border-radius: 14px; 
    margin-bottom: 25px; 
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.category-header {
    background: rgba(0,0,0,0.3); 
    padding: 18px 25px;
    border-bottom: 1px solid var(--border-color);
    display: flex; 
    justify-content: space-between; 
    align-items: center;
}
.category-header h2 { 
    font-size: 15px; 
    color: #fff; 
    letter-spacing: 0.5px; 
}
.cat-actions { 
    display: flex; 
    gap: 10px; 
    align-items: center; 
}
.forum-row {
    display: flex; 
    align-items: center; 
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color); 
    transition: background 0.2s;
}
.forum-row:hover { background-color: rgba(255,255,255,0.02); }
.forum-row:last-child { border-bottom: none; }
.forum-icon {
    width: 50px; 
    height: 50px; 
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-color); 
    border-radius: 12px;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 20px; 
    color: var(--primary-color); 
    margin-right: 20px;
}
.forum-info { flex: 1; }
.forum-info h3 { font-size: 16px; margin-bottom: 5px; color: #fff; }
.forum-info p { font-size: 13px; color: var(--text-muted); }

/* --- САЙДБАР (СТАТИСТИКА) --- */
.widget {
    background-color: var(--panel-bg); 
    backdrop-filter: blur(10px);
    border-radius: 14px; 
    padding: 25px; 
    border: 1px solid var(--border-color);
}
.widget h3 { font-size: 15px; margin-bottom: 20px; color: #fff; display: flex; align-items: center; gap: 8px; }
.icon-orange { color: var(--primary-color); }
.widget ul { list-style: none; }
.widget li {
    display: flex; 
    justify-content: space-between; 
    font-size: 14px;
    margin-bottom: 15px; 
    color: var(--text-muted); 
    border-bottom: 1px dashed var(--border-color); 
    padding-bottom: 5px;
}
.widget li:last-child { border: none; margin-bottom: 0; padding-bottom: 0; }
.widget li strong, .widget li a { color: #fff; font-family: 'Unbounded', sans-serif; font-size: 13px; }
.widget li a:hover { color: var(--primary-color); }

.empty-state {
    text-align: center;
    padding: 50px 20px;
    background-color: var(--panel-bg);
    border-radius: 10px;
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
}
.empty-state i { font-size: 40px; color: #333; margin-bottom: 15px; }

/* --- МОДАЛЬНОЕ ОКНО И ФОРМЫ (АВТОРИЗАЦИЯ) --- */
.modal {
    display: none; 
    position: fixed; 
    z-index: 2000;
    left: 0; 
    top: 0; 
    width: 100%; 
    height: 100%;
    background-color: rgba(0,0,0,0.8); 
    backdrop-filter: blur(15px);
    opacity: 0; 
    transition: opacity 0.4s ease;
}
.modal.show { display: flex; align-items: center; justify-content: center; opacity: 1; }
.modal-content {
    background: linear-gradient(180deg, rgba(25,25,25,0.95) 0%, rgba(15,15,15,0.98) 100%);
    padding: 40px; 
    border-radius: 20px; 
    width: 400px; 
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    transform: translateY(30px) scale(0.95); 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.modal.show .modal-content { transform: translateY(0) scale(1); }
.close {
    position: absolute; 
    right: 20px; 
    top: 20px; 
    font-size: 20px;
    color: var(--text-muted); 
    cursor: pointer; 
    transition: 0.3s;
}
.close:hover { color: #fff; transform: rotate(90deg); }

.modal h2 { margin-bottom: 5px; color: #fff; display: flex; align-items: center; gap: 10px; }
.modal-subtitle { color: var(--text-muted); font-size: 13px; margin-bottom: 25px; }

.auth-tabs { display: flex; margin-bottom: 25px; gap: 10px; }
.tab-btn { 
    flex: 1; 
    background: rgba(255,255,255,0.05); 
    border: 1px solid transparent; 
    border-radius: 8px; 
    color: var(--text-muted); 
    padding: 12px; 
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 15px; 
    letter-spacing: 0.5px;
}
.tab-btn:hover { color: #fff; }
.tab-btn.active { 
    background: rgba(77, 166, 255, 0.1); 
    border-color: var(--primary-color); 
    color: var(--primary-color); 
}

.input-group { position: relative; margin-bottom: 15px; }
.input-group i { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.auth-form input {
    width: 100%; 
    padding: 16px 16px 16px 48px; 
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border-color); 
    color: #fff; 
    border-radius: 12px; 
    font-size: 15px; 
    transition: 0.3s;
    outline: none;
}
.auth-form input:focus { border-color: var(--primary-color); box-shadow: 0 0 15px rgba(77, 166, 255, 0.1); }
.auth-submit-btn {
    width: 100%;
    justify-content: center;
    margin-top: 20px;
    padding: 16px;
    font-size: 15px;
    border-radius: 12px;
}

/* --- РЕДАКТОР ТЕКСТА (WYSIWYG) --- */
.editor-container { 
    border: 1px solid var(--border-color); 
    border-radius: 10px; 
    overflow: hidden; 
    margin-bottom: 20px; 
    background-color: #0f0f13;
}
.editor-toolbar { 
    background: rgba(0,0,0,0.3); 
    padding: 10px; 
    display: flex; 
    gap: 5px; 
    flex-wrap: wrap; 
    border-bottom: 1px solid var(--border-color); 
}
.editor-btn { 
    background: transparent; 
    border: none; 
    color: var(--text-muted); 
    padding: 8px 12px; 
    border-radius: 6px; 
    cursor: pointer;
    transition: 0.2s;
}
.editor-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.editor-content { 
    min-height: 200px; 
    padding: 20px; 
    color: #fff; 
    outline: none; 
    background: rgba(25,25,25,0.4); 
    font-size: 15px; 
}
.editor-content:empty:before { content: attr(data-placeholder); color: var(--text-muted); }

/* --- СТИЛИ ДЛЯ ПРОСМОТРА ТЕМЫ (topic.php) --- */
.topic-header {
    background-color: var(--panel-bg);
    padding: 25px; 
    border-radius: 14px; 
    margin-bottom: 25px;
    border: 1px solid var(--border-color);
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    flex-wrap: wrap;
    backdrop-filter: blur(10px);
}
.topic-title { 
    font-size: 22px; 
    color: #fff; 
    display: flex; 
    align-items: center; 
    gap: 12px; 
}
.topic-actions {
    display: flex; 
    gap: 10px; 
    margin-top: 10px;
}
.status-closed-tag {
    background: rgba(255,99,71,0.1); 
    color:#ff6347; 
    border: 1px solid rgba(255,99,71,0.3); 
    border-radius: 8px; 
    padding: 4px 10px; 
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.post-block {
    display: flex; 
    background-color: var(--panel-bg);
    border: 1px solid var(--border-color); 
    border-radius: 14px;
    margin-bottom: 20px; 
    overflow: hidden;
    backdrop-filter: blur(10px);
}
.post-sidebar {
    width: 220px; 
    background-color: rgba(0,0,0,0.2);
    padding: 25px 20px; 
    border-right: 1px solid var(--border-color); 
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.avatar-placeholder {
    width: 80px; 
    height: 80px; 
    background-color: #2a2a30;
    border-radius: 50%; 
    margin: 0 auto 15px auto;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-size: 30px; 
    color: var(--text-muted); 
    border: 2px solid var(--border-color);
}
.post-main { 
    flex: 1; 
    padding: 25px; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between;
}
.post-meta {
    font-size: 12px; 
    color: var(--text-muted); 
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color); 
    padding-bottom: 10px;
    display: flex; 
    justify-content: space-between;
}
.post-text { color: #e2e2e5; flex: 1; line-height: 1.7; font-size: 15px; }
.post-text b, .post-text strong { color: #fff; font-weight: bold; }
.post-text i, .post-text em { font-style: italic; }

.msg-actions {
    display: flex; 
    gap: 5px; 
    justify-content: flex-end; 
    margin-top: 15px; 
    border-top: 1px solid rgba(255,255,255,0.05); 
    padding-top: 15px;
}
.msg-actions a, .msg-actions button {
    color: var(--text-muted);
    font-size: 12px;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 8px;
    transition: 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.msg-actions a:hover { background: rgba(255,255,255,0.05); color: #fff; }
.msg-actions button:hover { background: rgba(255, 107, 107, 0.1); color: #ff6b6b; }

.closed-banner-new {
    background: rgba(255, 99, 71, 0.08);
    border: 1px solid rgba(255, 99, 71, 0.2);
    border-left: 4px solid #ff6347;
    border-radius: 14px;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    color: #ffb3a7;
    margin-top: 30px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.closed-notice {
    background-color: var(--panel-bg); 
    color: var(--text-muted);
    padding: 25px; 
    border-radius: 14px; 
    text-align: center;
    border: 1px dashed var(--border-color); 
    margin-top: 30px; 
    font-size: 15px;
    backdrop-filter: blur(10px);
}

.fa-spin {
    animation: fa-spin 1s infinite linear;
}
@keyframes fa-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========================================= */
/* --- АДАПТИВНОСТЬ ДЛЯ МОБИЛЬНЫХ УСТРОЙСТВ --- */
/* ========================================= */
@media (max-width: 768px) {
    .header {
        padding: 15px;
        flex-direction: column;
        height: auto;
        gap: 15px;
    }
    .user-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    .main-layout {
        flex-direction: column;
        margin-top: 20px;
    }
    .sidebar {
        width: 100%;
    }
    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .forum-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 15px;
    }
    .forum-icon {
        margin-right: 0;
    }
    .forum-info {
        width: 100%;
    }
    .forum-row > div:last-child {
        text-align: left !important;
        width: 100%;
    }
    .modal-content {
        padding: 30px 20px;
        width: 95%;
    }
    .topic-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .topic-actions {
        flex-wrap: wrap;
    }
    .post-block {
        flex-direction: column;
    }
    .post-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        display: flex;
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
        gap: 15px;
        padding: 15px;
        text-align: left;
    }
    .avatar-placeholder {
        margin: 0;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    .post-sidebar > div:not(.avatar-placeholder) {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }
    .editor-toolbar {
        justify-content: center;
    }
}
/* ========================================= */
/* --- СТИЛИ ДЛЯ РЕДАКТОРА ТЕМ (ОБНОВЛЕННЫЕ) --- */
/* ========================================= */

.toolbar-divider {
    width: 1px;
    background: var(--border-color);
    margin: 0 8px;
    height: 24px;
    align-self: center;
}

/* Выпадающие меню (скрыты до клика) */
.dropdown-wrapper {
    position: relative;
    display: inline-block;
}
.editor-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 10px;
    background: #1b1b1f;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.8);
    z-index: 1000;
}
.editor-dropdown.show {
    display: block;
    animation: fadeInDown 0.2s ease;
}

/* Сплошная палитра цветов */
.custom-color-palette {
    width: 260px; /* Увеличено для ровного поля HEX */
}
.color-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0px; 
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
}
.color-square {
    width: 100%;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}
.color-square:hover {
    transform: scale(1.15);
    z-index: 2;
    position: relative;
    box-shadow: 0 0 5px rgba(0,0,0,1);
    border-radius: 2px;
}

/* Кнопка "Свой HEX код" */
.custom-color-toggle {
    margin-top: 15px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    text-align: center;
    padding: 8px;
    border-radius: 6px;
    transition: 0.2s;
    background: rgba(255,255,255,0.03);
    font-weight: 600;
}
.custom-color-toggle:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* Строка ввода HEX */
.hex-input-row {
    margin-top: 12px;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}
#custom-hex {
    flex: 1;
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    width: 100%;
}
#custom-hex:focus { border-color: var(--primary-color); }
.btn-hex-ok {
    background: #2D9CFF; 
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: 0.2s;
}
.btn-hex-ok:hover { background: #1e85e5; transform: scale(1.05); }

/* Элементы внутри текста (Картинки, ссылки, цитаты) */
.forum-mini-image {
    max-width: 280px;
    max-height: 280px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    display: block;
    margin: 12px 0;
}
.forum-inline-link {
    color: var(--primary-color);
    text-decoration: underline;
    font-weight: 500;
}
.forum-inline-link:hover { color: #ffc247; }

blockquote {
    border-left: 4px solid var(--primary-color);
    background: rgba(255, 165, 0, 0.05);
    padding: 15px 20px;
    margin: 12px 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #ddd;
}