/* ======================= Threads List ======================= */
.thread-list {
    background: var(--card-background);
    border-radius: 12px;
    padding: 0; /* Bootstrap gx-custom уже даст отступы */
}

.threads-section .thread-item {
    display: flex;
    flex-direction: column;
    padding: 24px;
    gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.thread-item:last-child {
    border-bottom: none; /* Убрать границу у последнего элемента */
}

/* .thread-item a {
    display: flex;
    align-items: flex-start; 
    gap: 12px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
} */

.thread-item a:hover {
    background-color: rgba(255, 255, 255, 0.02); /* Легкий ховер-эффект */
    border-radius: 8px; /* Немного скруглить углы при ховере */
}

.thread-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%; 
    background: rgba(255,255,255,0.06); /* Фоновый цвет для аватара */
    flex-shrink: 0; /* Не сжиматься */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.thread-content-wrap {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.thread-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 4px; /* Отступ между мета и текстом */
}

.thread-author {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.thread-time {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap; /* Не переносить на новую строку */
}

.thread-list .thread-text {
    font-size: 16px;
    line-height: 1.4;
    color: var(--text-primary);
    margin: 0;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    white-space: normal;
}

.threads-section .thread-subtext {
    font-size: 12px;
    line-height: 1.4;
    color: #FFFFFF52;
    margin-top: 4px; /* Отступ от основного текста */
    display: -webkit-box;
    -webkit-line-clamp: 2; /* Ограничение до 2 строк */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0;
}

.thread-created-time {
    font-size: 12px;
    color: #FFFFFF52;
    margin-top: 8px; /* Отступ от подтекста */
    display: block; /* Чтобы был на новой строке */
}

/* Responsive adjustments for threads */
@media (max-width: 991.98px) {
    .threads-section {
        margin-top: 1.5rem; /* Отступ, если это главный контент на мобильном */
    }
    .thread-item {
        padding: 12px 16px; /* Меньше отступы на мобильном */
        gap: 6px;
    }
    .thread-item a {
        gap: 8px;
    }
    .thread-avatar {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }
    .thread-author {
        font-size: 12px;
    }
    .thread-time {
        font-size: 10px;
    }
    .thread-text {
        font-size: 14px;
    }
    .thread-subtext {
        font-size: 12px;
        margin-top: 2px;
    }
    .thread-created-time {
        font-size: 10px;
        margin-top: 6px;
    }
}
/* ======================= Thread Detail Page Specific Styles (FOURTH REVISION - NO CHANGES IN CSS FOR THIS ITERATION) ======================= */

/* Main content area layout for the thread page */
@media (min-width: 1200px) {
    .col-xl-6 {
        flex: 0 0 auto;
        width: 50%; /* 6 columns out of 12 */
    }
    .col-xl-3.d-none.d-xl-block {
        display: block !important; /* Ensure it's visible on XL screens */
    }
}

.thread-detail-main-wrapper {
    display: flex;
    flex-direction: column;
    gap: 24px; /* Space between the main post section and the comments section */
}

.background-post {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 24px;
}

/* Main Post Header (Top of the thread) */
.thread-main-post-header {
    /* No specific styles needed here, padding is handled by .background-post */
}

.thread-title-main {
    font-size: 32px;
    font-weight: 600;
    color: white;
    line-height: 1.25;
    margin-bottom: 24px; /* Space between title and author/meta line */
    letter-spacing: -0.02em;
}

.thread-author-meta-main {
    width: 100%;
}

.thread-avatar-main {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.thread-author-name-main {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary); /* @TheArchivist is primary */
}

.thread-subtext-main {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.52);
    margin-top: 0;
}

.thread-replies-time-main {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.52);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Main Post Content (The actual text of the thread's first post) */
.thread-main-post-content {
    /* No background/padding, handled by .thread-detail-main-wrapper and .background-post */
}

.thread-text-block {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 16px;
}
.thread-text-block:last-of-type {
    margin-bottom: 0;
}

/* Comments Section */
.thread-comments-section {
    display: flex;
    flex-direction: column;
    gap: 0; /* Spacing handled by individual item padding/borders */
}

/* Individual Comment Item */
.thread-comment-item {
    display: flex;
    flex-direction: column;
    padding-top: 24px; /* Space between comments */
    padding-bottom: 24px;
    border-top: 1px solid rgba(255,255,255,0.07); /* Border above each comment */
}

.thread-comment-item:first-child {
    border-top: none; /* No top border for the very first comment */
    padding-top: 0; /* No top padding for the very first comment */
}

.thread-comment-item:last-child {
    border-bottom: none; /* No bottom border for the very last comment */
    padding-bottom: 0; /* No bottom padding for the very last comment */
}

.thread-text-comment {
    font-size: 15px;
    line-height: 1.4;
    color: #FFFFFFA3; /* Comment text color is primary */
    margin-bottom: 0;
}

.thread-author-meta-comment {
    width: 100%;
    margin-top: 8px; /* Space between comment text and author info */
}

.thread-avatar-comment {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.thread-author-name-comment {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary); /* Comment author names are secondary */
}

.thread-subtext-comment {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.32); /* Muted color for "Local" */
    margin-top: 0;
}

.thread-time-comment {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.32); /* Muted color for comment time */
    white-space: nowrap;
    flex-shrink: 0;
}

/* "You must be logged in or registered to reply here." message */
.thread-login-prompt {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.32); /* Muted color */
    text-align: center;
    padding-top: 24px; /* Space from last comment */
    border-top: 1px solid rgba(255,255,255,0.07); /* Border above it */
    margin-top: 24px; /* Space from the comments section */
    line-height: 1.4; /* Ensure good line spacing */
}

/* Responsive adjustments for thread detail page */
@media (max-width: 1200px) {
    .thread-title-main {
        font-size: 24px;
        margin-bottom: 16px;
    }
    .thread-author-meta-main {
        margin-bottom: 16px;
    }
    .thread-main-post-header {
        /* No specific styles */
    }
    .thread-text-block {
        font-size: 15px;
        margin-bottom: 12px;
    }
    .thread-detail-main-wrapper {
        gap: 16px;
    }
    .background-post {
        padding: 16px;
    }
    .thread-comment-item {
        padding-top: 16px;
        padding-bottom: 16px;
    }
    .thread-comment-item:first-child {
        padding-top: 0;
    }
    .thread-comment-item:last-child {
        padding-bottom: 0;
    }
    .thread-text-comment {
        font-size: 14px;
    }
    .thread-author-meta-comment {
        margin-top: 6px;
    }
    .thread-avatar-main,
    .thread-avatar-comment {
        width: 28px;
        height: 28px;
        font-size: 13px;
    }
    .thread-author-name-main,
    .thread-author-name-comment {
        font-size: 14px;
    }
    .thread-subtext-main,
    .thread-subtext-comment,
    .thread-replies-time-main,
    .thread-time-comment {
        font-size: 11px;
    }
    .thread-login-prompt {
        font-size: 14px;
        padding-top: 16px;
        margin-top: 16px;
    }
}

@media (max-width: 767.98px) {
    .thread-title-main {
        font-size: 20px;
    }
    .thread-text-block {
        font-size: 14px;
    }
    .thread-text-comment {
        font-size: 13px;
    }
}