/* ==========================================================================
   CORE.CSS - FULL UNABRIDGED VERSION
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* --- 1. ANTI-FLASH --- */
html { background-color: #ffffff; }
html[data-theme='dark'] { background-color: #0f172a !important; color: #eeeeee; }
html[data-theme='dark'] body { visibility: visible; }

/* --- 2. VARIABLES --- */
:root {
    --primary-color: #3b82f6;       
    --primary-hover: #2563eb;
    --success-color: #10b981;       
    --danger-color: #ef4444;        
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --bg-hover: #f8fafc;
    --bg-input: #ffffff;
    --text-main: #1e293b;
    --text-muted: #475569;
    --border-color: #e2e8f0;
    --radius: 8px;
    --container-width: 95%; 
    --avatar-radius: 50%;
}

[data-theme="dark"] {
    --bg-body: #0a0f1d;
    --bg-card: #161f32;
    --bg-hover: #212d45;
    --bg-input: #0a0f1d;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #26334d;
}

/* --- 3. BASE SETTINGS --- */
* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    margin: 0; padding: 0; line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: var(--primary-color); transition: 0.2s; }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; display: block; }

/* --- 4. HEADER (ШАПКА) --- */
.top-container {
    background-color: var(--bg-card); 
    border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0; z-index: 1000; width: 100%;
}

.header-content {
    max-width: var(--container-width);
    margin: 0 auto; height: 60px;
    display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
}

/* ТАЙТЛ ФОРУМА */
.logo-text {
    font-weight: 800 !important;
    font-size: 20px !important;
    letter-spacing: -0.5px;
    color: var(--primary-color) !important;
    text-transform: uppercase;
}

/* --- 5. NAVIGATION (МЕНЮ) --- */
.nav-menu { display: flex; align-items: center; gap: 10px; }
.nav-link {
    color: var(--text-main); font-weight: 600 !important; font-size: 14px;
    display: inline-flex; align-items: center; padding: 8px 12px;
}
.nav-link:hover, .nav-link:hover i { color: var(--primary-color) !important; }
.nav-link i { margin-right: 6px; color: var(--text-muted); transition: 0.2s; }

/* ЮЗЕР-МЕНЮ */
.nav-user-link {
    display: flex; align-items: center; gap: 10px;
    padding: 5px 12px; background-color: var(--bg-hover);
    border: 1px solid var(--border-color); border-radius: var(--radius);
}
.user-name { font-weight: 700 !important; color: var(--text-main); transition: 0.2s; }
.nav-user-link:hover .user-name { color: var(--primary-color) !important; }

.user-avatar-small img { 
    width: 30px; height: 30px; 
    border-radius: var(--avatar-radius); object-fit: cover; 
}

/* --- 6. FORUM CONTENT (БОЙ С "ЖИДКОСТЬЮ") --- */
.middle-container {
    max-width: var(--container-width);
    margin: 30px auto; padding: 0 20px;
}

.welcome-title {
    font-weight: 800 !important;
    font-size: 28px !important;
    letter-spacing: -0.8px;
    margin-bottom: 5px;
}

.section-title {
    font-weight: 700 !important;
    font-size: 16px !important;
    margin-bottom: 10px;
}

.forum-name a {
    font-weight: 600 !important;
    font-size: 15px !important;
    color: var(--text-main);
}
.forum-name a:hover { color: var(--primary-color); }

/* --- 7. STATISTICS (ИСПРАВЛЕННАЯ СТАТИСТИКА) --- */
.forum-stats { font-size: 13px; line-height: 1.4; }

/* Текстовые метки (Тем, Сообщений) */
.stats-item {
    font-weight: 500 !important;
    color: var(--text-muted) !important;
}

/* Числа статистики */
.stats-count, .stats-item b, .stats-item span {
    font-weight: 700 !important;
    color: var(--text-main) !important; /* Яркие на темном фоне */
}

/* Последнее сообщение (справа) */
.last-post-title {
    font-weight: 700 !important;
    font-size: 13px !important;
    color: var(--primary-color) !important;
}

.last-post-info {
    font-weight: 500 !important;
    font-size: 12px !important;
    color: var(--text-muted) !important;
}

/* --- 8. UI ELEMENTS --- */
.button {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 8px 18px; font-weight: 700 !important; font-size: 14px;
    border: none; cursor: pointer; border-radius: var(--radius);
    background-color: var(--primary-color); color: #fff !important;
}
.button:hover { opacity: 0.9; transform: translateY(-1px); }

/* ==========================================================================
   AUTH STYLES - ФИКС СТРАНИЦЫ ВХОДА И РЕГИСТРАЦИИ
   ========================================================================== */

/* Центрируем контейнер на странице */
.auth-page-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.auth-card h2 {
    text-align: center;
    font-weight: 900;
    font-size: 32px;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: -1px;
}

/* Поля ввода */
.auth-form-group {
    margin-bottom: 20px;
}

.auth-form-group label {
    display: block;
    font-weight: 800;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.auth-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    padding: 14px 18px !important;
    color: #fff !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    transition: 0.3s;
}

.auth-input:focus {
    border-color: var(--primary-color) !important;
    background: rgba(59, 130, 246, 0.05) !important;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1) !important;
    outline: none;
}

/* Кнопка войти */
.auth-btn {
    width: 100%;
    background: #d97706 !important; /* Твой оранжевый */
    color: #fff !important;
    padding: 16px !important;
    border-radius: 8px !important;
    font-weight: 900 !important;
    font-size: 16px !important;
    text-transform: uppercase;
    border: none !important;
    cursor: pointer;
    margin-top: 10px;
    transition: 0.2s;
}

.auth-btn:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
}

/* Ссылки под формой */
.auth-links {
    margin-top: 20px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
}

.auth-links a {
    color: var(--primary-color);
    text-decoration: none;
}

.auth-links a:hover {
    text-decoration: underline;
}

/* --- ПОИСК (ФИКС) --- */
.search-bar {
    position: relative;
    max-width: 350px; /* Ограничиваем ширину, чтобы не распирало хедер */
    width: 100%;
    margin: 0 20px;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    height: 38px;
    padding: 0 15px 0 40px !important; /* Отступ слева под иконку */
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 20px !important;
    color: var(--text-main) !important;
    font-size: 14px;
    transition: all 0.2s;
}

/* Иконка внутри поиска */
.search-bar i.fa-search, 
.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    z-index: 5;
}

/* Фикс автозаполнения браузером (Chrome, Safari, Edge) */
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus, 
input:-webkit-autofill:active {
    /* Меняем цвет текста на белый */
    -webkit-text-fill-color: #fff !important;
    /* Убираем стандартный голубой фон, заменяя его на твой темный */
    -webkit-box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.2) inset !important;
    /* Плавный переход, чтобы фон не моргал */
    transition: background-color 5000s ease-in-out 0s;
}

/* Дополнительный фикс для конкретно твоих полей входа */
.auth-input:-webkit-autofill {
    border: 1px solid var(--border-color) !important;
    caret-color: white; /* Цвет курсора */
}

/* --- ШЕСТЕРЕНКА И ПРОФИЛЬ (ФИКС) --- */
.nav-user-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    color: var(--text-main) !important;
    text-decoration: none;
}

/* Шестеренка по умолчанию — спокойного цвета */
.nav-user-link i.fa-cog, 
.settings-icon {
    color: var(--text-muted) !important; 
    transition: color 0.2s ease;
}

/* Загорается ТОЛЬКО при наведении на весь блок профиля */
.nav-user-link:hover i.fa-cog,
.nav-user-link:hover .settings-icon {
    color: var(--primary-color) !important;
}

/* Если шестеренка внутри кнопки в админке — она белая */
.btn-save i, .admin-save-btn i {
    color: #fff !important;
}

/* Анимация пульсации для красного кружка */
@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 5px rgba(239, 68, 68, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Анимация покачивания конверта */
@keyframes bell-ring {
    0%, 100% { transform: rotate(0); }
    10%, 30%, 50% { transform: rotate(3deg); }
    20%, 40%, 60% { transform: rotate(-3deg); }
    70% { transform: rotate(0); }
}

/* Применяем к баджу */
.nav-badge {
    animation: pulse-red 2s infinite;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    border-radius: 10px;
    position: absolute;
    top: -5px;
    right: -8px;
    border: 2px solid var(--bg-card); /* Отделяем от иконки */
}

/* Применяем к иконке при наличии новых сообщений */
.msg-unread-active i {
    animation: bell-ring 4s ease-in-out infinite;
    transform-origin: top center;
}

/* Пагинация */
.pagination { display: flex; gap: 6px; list-style: none; padding: 0; }
.pagination a, .pagination span {
    min-width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius); font-weight: 700; color: var(--text-main);
}
.pagination a.active { background: var(--primary-color) !important; color: #fff !important; }

/* Бейджи */
.nav-badge {
    background: var(--danger-color); color: #fff;
    font-size: 10px; font-weight: 700; padding: 2px 6px;
    border-radius: 10px; position: absolute; top: -5px; right: -5px;
}

/* --- 9. АДАПТИВ --- */
@media (max-width: 768px) {
    .header-content { padding: 0 10px; }
    .search-bar { display: none; }
    .logo-text { font-size: 18px !important; }
}

html { scroll-behavior: smooth; }

