/* ==========================================================================
   FORUM_LAYOUT.CSS - Базовая сетка, разделы и общая структура
   ========================================================================== */

/* --- 1. ОСНОВНЫЕ БЛОКИ РАЗДЕЛОВ --- */
.section-block {
    background: var(--bg-card); 
    box-shadow: var(--shadow-sm); 
    margin-bottom: 20px;
    border: 1px solid var(--border-color); 
    overflow: hidden; 
    border-radius: var(--radius);
    border-top: 4px solid var(--primary-color);
}

.section-header {
    background: linear-gradient(to right, var(--bg-card), var(--bg-hover));
    padding: 12px 20px; 
    font-size: 16px; 
    font-weight: 700;
    border-bottom: 1px solid var(--border-color); 
    display: flex; 
    align-items: center;
}

/* --- 2. УНИФИЦИРОВАННАЯ СЕТКА СТРОК (Форумы и Темы) --- */
.subsection-row, .topic-list-header {
    display: grid;
    /* Иконка | Название | Статистика | Последнее инфо */
    grid-template-columns: 60px 1fr 180px 220px; 
    align-items: center; 
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color); 
    transition: background 0.1s;
    position: relative;
    /* ВАЖНО: transparent позволяет видеть фон вложенных подразделов в темной теме */
    background: transparent; 
}

.subsection-row:last-child { 
    border-bottom: none; 
}

/* Эффект наведения с учетом прозрачности */
.subsection-row:hover { 
    background-color: rgba(0, 0, 0, 0.02); 
}

/* Состояния строк (Важные, закрытые, непрочитанные) */
.subsection-row.sticky { background-color: #fffbeb; border-left: 3px solid #f59e0b; padding-left: 17px; }
.subsection-row.locked { background-color: #fef2f2; border-left: 3px solid #ef4444; padding-left: 17px; }
.subsection-row.unread { font-weight: 600; background-color: #f0f9ff; }

/* Шапка таблицы (заголовки колонок) */
.topic-list-header {
    background: var(--bg-hover);
    font-size: 11px; 
    font-weight: 700; 
    text-transform: uppercase; 
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 20px;
}

/* --- 3. ИКОНКИ И ИНФОРМАЦИЯ --- */
.icon-wrapper { 
    font-size: 24px; 
    text-align: center; 
    display: flex; 
    justify-content: center; 
    align-items: center;
}

/* Анимация пульсации для непрочитанных */
.icon-pulse { 
    animation: pulse-fade 2s infinite ease-in-out; 
}

.subsection-info { 
    padding-right: 15px; 
    overflow: hidden; 
}

.subsection-info h3 { 
    margin: 0 0 4px 0; 
    font-size: 15px; 
    line-height: 1.3; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.subsection-info h3 a { 
    color: var(--text-main); 
    font-weight: 600; 
    text-decoration: none; 
}

.subsection-info h3 a:hover { 
    color: var(--primary-color); 
}

.topic-meta-line { 
    font-size: 12px; 
    color: var(--text-muted); 
}

.subsection-meta { 
    font-size: 12px; 
    color: var(--text-muted); 
    text-align: right; 
    border-right: 1px solid var(--border-color);
    padding-right: 15px; 
    margin-right: 15px;
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    gap: 2px;
}

.subsection-last-post {
    font-size: 12px; 
    line-height: 1.4;
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis;
    position: relative; 
    z-index: 2; 
    text-align: right;
}

/* --- 4. СТАТУСЫ И СКРОЛЛБАРЫ --- */
.user-status-dot { 
    display: inline-block; 
    width: 10px; 
    height: 10px; 
    border-radius: 50%; 
    margin-left: 8px; 
    vertical-align: middle; 
}

.user-status-dot.online { 
    background-color: var(--success-color); 
    animation: pulse-green 2s infinite; 
}

.user-status-dot.offline { 
    background-color: var(--danger-color); 
    opacity: 0.7; 
}

/* Кастомные скроллбары (Общие настройки) */
::-webkit-scrollbar { 
    width: 8px; 
    height: 8px; 
}

::-webkit-scrollbar-track { 
    background: #f1f5f9; 
}

::-webkit-scrollbar-thumb { 
    background: #cbd5e1; 
    border-radius: 4px; 
}

::-webkit-scrollbar-thumb:hover { 
    background: #94a3b8; 
}

/* Поддержка Firefox */
* { 
    scrollbar-width: thin; 
    scrollbar-color: #cbd5e1 #f1f5f9; 
}

/* --- 5. АНИМАЦИИ --- */
@keyframes pulse-fade { 
    0%, 100% { opacity: 1; transform: scale(1); } 
    50% { opacity: 0.5; transform: scale(1.05); } 
}

@keyframes pulse-green { 
    0%, 100% { opacity: 1; } 
    50% { opacity: 0.5; } 
}

/* --- 6. АДАПТИВНОСТЬ БАЗОВОЙ СЕТКИ --- */
@media (max-width: 768px) {
    .subsection-row {
        grid-template-columns: 40px 1fr;
        grid-template-areas: "icon main" "stats stats" "last last";
        gap: 10px;
    }
    .topic-list-header { 
        display: none; 
    }
    
    .icon-wrapper { 
        grid-area: icon; 
        align-self: start; 
        padding-top: 5px; 
    }
    .subsection-info { 
        grid-area: main; 
    }
    .subsection-meta { 
        grid-area: stats; 
        text-align: left; 
        border-right: none; 
        padding-right: 0; 
        margin-right: 0;
        flex-direction: row; 
        gap: 15px; 
        background: var(--bg-hover); 
        padding: 5px 10px; 
        border-radius: 6px;
    }
    .subsection-last-post { 
        grid-area: last; 
        border-top: 1px dashed var(--border-color); 
        padding-top: 8px; 
        text-align: left;
    }
}