/**
 * Forum Topic List Styles
 * Topic cards, badges, table view, and pagination
 */

/* ============================================
   TOPIC LIST
   ============================================ */

.topic-list {
    display: flex;
    flex-direction: column;
    gap: clamp(0.625rem, 1.25vw, 0.75rem);
}

/* ============================================
   TOPIC CARD - Depth Card Pattern
   ============================================ */

.topic-card {
    display: flex;
    align-items: center;
    gap: clamp(0.75rem, 1.5vw, 1rem);
    padding: clamp(1rem, 2vw, 1.25rem);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.topic-card:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.06),
        0 8px 16px rgba(0, 0, 0, 0.06);
}

.topic-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Dark mode adjustments */
html.dark .topic-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

html.dark .topic-card:hover {
    box-shadow:
        0 4px 8px rgba(0, 0, 0, 0.2),
        0 8px 16px rgba(0, 0, 0, 0.15);
}

/* Solved Topic - Success indicator */
.topic-card--solved {
    border-left: 4px solid var(--success);
    padding-left: calc(clamp(1rem, 2vw, 1.25rem) - 3px);
}

/* Pinned Topic - Highlighted */
.topic-card--pinned {
    background: var(--accent-light);
    border-left: 4px solid var(--accent);
    padding-left: calc(clamp(1rem, 2vw, 1.25rem) - 3px);
}

.topic-card--pinned:hover {
    background: rgba(var(--accent-rgb), 0.15);
}

/* Own Topic - User's own topics */
.topic-card--own {
    border-left: 4px solid var(--accent);
    padding-left: calc(clamp(1rem, 2vw, 1.25rem) - 3px);
    background: var(--accent-light);
}

.topic-card--own:hover {
    background: rgba(var(--accent-rgb), 0.12);
}

/* Replied Topic - Topics where user has commented */
.topic-card--replied {
    border-left: 4px solid var(--text-muted);
    padding-left: calc(clamp(1rem, 2vw, 1.25rem) - 3px);
}

.topic-card--replied:hover {
    border-left-color: var(--text-secondary);
}

/* ============================================
   TOPIC AVATAR
   ============================================ */

.topic-avatar {
    width: clamp(36px, 5vw, 44px);
    height: clamp(36px, 5vw, 44px);
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    flex-shrink: 0;
    object-fit: cover;
    transition: all 0.2s ease;
}

.topic-card:hover .topic-avatar {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* ============================================
   TOPIC MAIN CONTENT
   ============================================ */

.topic-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: clamp(0.375rem, 0.75vw, 0.5rem);
}

.topic-title {
    margin: 0;
    font-size: clamp(0.9375rem, 1.5vw + 0.25rem, 1.0625rem);
    font-weight: 600;
    line-height: 1.4;
}

.topic-title a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.topic-card:hover .topic-title a {
    color: var(--accent);
}

/* ============================================
   TOPIC META
   ============================================ */

.topic-meta {
    font-size: clamp(0.8125rem, 1.25vw + 0.15rem, 0.875rem);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: clamp(0.5rem, 1vw, 0.75rem);
    flex-wrap: wrap;
}

.topic-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.topic-meta svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

/* Pinned/Solved badges in meta */
.topic-meta .badge {
    margin-left: -0.125rem;
}

/* ============================================
   TOPIC STATS - Reply Counter
   ============================================ */

.topic-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: clamp(60px, 8vw, 72px);
    padding: clamp(0.5rem, 1vw, 0.75rem) clamp(0.75rem, 1.25vw, 1rem);
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.topic-card:hover .topic-stats {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.topic-stats .stat-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
}

.topic-stats .replies {
    font-weight: 700;
    color: var(--text-primary);
    font-size: clamp(1rem, 1.5vw + 0.25rem, 1.25rem);
    line-height: 1;
}

.topic-stats .label {
    color: var(--text-muted);
    font-size: clamp(0.625rem, 0.9vw + 0.1rem, 0.6875rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* ============================================
   FOLLOW BUTTON IN TOPIC META
   ============================================ */

.topic-follow-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: clamp(0.8125rem, 1.25vw + 0.1rem, 0.875rem);
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 32px;
}

.topic-follow-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.topic-follow-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.topic-follow-btn--following {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}

.topic-follow-btn--following:hover {
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--accent-hover);
    border-color: var(--accent-hover);
}

.topic-follow-btn svg {
    width: 14px;
    height: 14px;
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: clamp(0.6875rem, 1vw + 0.1rem, 0.75rem);
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge--success {
    background: var(--success-bg);
    color: var(--success);
}

.badge--warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge--pinned {
    background: var(--accent-light);
    color: var(--accent);
}

.badge svg {
    width: 12px;
    height: 12px;
}

/* ============================================
   SSR TOPICS TABLE (Forum Index)
   ============================================ */

.forum-recent-topics {
    margin-top: clamp(2rem, 4vw, 2.5rem);
    margin-bottom: clamp(1.5rem, 3vw, 2rem);
}

.forum-recent-topics .section-title {
    font-size: clamp(1.25rem, 2vw + 0.5rem, 1.5rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: clamp(1rem, 2vw, 1.25rem);
    padding-bottom: clamp(0.5rem, 1vw, 0.75rem);
    border-bottom: 2px solid var(--border);
}

.forum-topics-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

html.dark .forum-topics-table-wrapper {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.forum-topics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(0.875rem, 1.25vw + 0.15rem, 0.9375rem);
}

.forum-topics-table thead {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.forum-topics-table th {
    padding: clamp(0.75rem, 1.5vw, 1rem) clamp(1rem, 2vw, 1.25rem);
    text-align: left;
    font-weight: 600;
    font-size: clamp(0.75rem, 1.1vw + 0.1rem, 0.8125rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    white-space: nowrap;
}

.forum-topics-table th.col-topic {
    width: 50%;
}

.forum-topics-table th.col-category,
.forum-topics-table th.col-replies,
.forum-topics-table th.col-activity {
    text-align: center;
}

.forum-topics-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

.forum-topics-table tbody tr:last-child {
    border-bottom: none;
}

.forum-topics-table tbody tr:hover {
    background: var(--bg-hover);
}

.forum-topics-table tbody tr.is-pinned {
    background: var(--accent-light);
}

.forum-topics-table tbody tr.is-pinned:hover {
    background: rgba(var(--accent-rgb), 0.12);
}

.forum-topics-table tbody tr.is-solved {
    border-left: 3px solid var(--success);
}

.forum-topics-table td {
    padding: clamp(0.75rem, 1.5vw, 1rem) clamp(1rem, 2vw, 1.25rem);
    vertical-align: middle;
}

.forum-topics-table td.col-category,
.forum-topics-table td.col-replies,
.forum-topics-table td.col-activity {
    text-align: center;
}

/* Topic title link in table */
.forum-topics-table .topic-title-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 600;
    line-height: 1.4;
    transition: color 0.15s ease;
}

.forum-topics-table .topic-title-link:hover {
    color: var(--accent);
}

/* Topic badges in table */
.forum-topics-table .topic-badge {
    flex-shrink: 0;
    display: inline-flex;
}

.forum-topics-table .topic-badge svg {
    width: 14px;
    height: 14px;
}

.forum-topics-table .topic-badge--pinned svg {
    color: var(--accent);
}

.forum-topics-table .topic-badge--solved svg {
    color: var(--success);
}

/* Topic meta in table */
.forum-topics-table .topic-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.375rem;
    font-size: clamp(0.75rem, 1.1vw + 0.1rem, 0.8125rem);
    color: var(--text-secondary);
}

.forum-topics-table .topic-author-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    object-fit: cover;
}

.forum-topics-table .topic-meta-separator {
    color: var(--text-muted);
}

/* Category link in table */
.forum-topics-table .topic-category-link {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    font-size: clamp(0.75rem, 1.1vw + 0.1rem, 0.8125rem);
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.15s ease;
}

.forum-topics-table .topic-category-link:hover {
    color: var(--accent);
    background: var(--bg-hover);
}

.forum-topics-table .topic-category-none {
    color: var(--text-muted);
}

/* Reply count badge */
.forum-topics-table .reply-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.25rem 0.5rem;
    font-weight: 600;
    font-size: clamp(0.8125rem, 1.1vw + 0.1rem, 0.875rem);
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

/* Activity date */
.forum-topics-table .activity-date {
    font-size: clamp(0.75rem, 1.1vw + 0.1rem, 0.8125rem);
    color: var(--text-muted);
    white-space: nowrap;
}

/* ============================================
   SSR PAGINATION
   ============================================ */

.forum-recent-topics .forum-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.75rem, 1.5vw, 1rem);
    margin-top: clamp(1.25rem, 2.5vw, 1.5rem);
    padding-top: clamp(0.75rem, 1.5vw, 1rem);
    border-top: 1px solid var(--border);
}

.forum-recent-topics .pagination-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: clamp(0.5rem, 1vw, 0.625rem) clamp(0.875rem, 1.5vw, 1rem);
    font-size: clamp(0.8125rem, 1.25vw + 0.1rem, 0.875rem);
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all 0.15s ease;
    min-height: 40px;
}

.forum-recent-topics .pagination-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--bg-hover);
}

.forum-recent-topics .pagination-link svg {
    width: 16px;
    height: 16px;
}

.forum-recent-topics .pagination-info {
    font-size: clamp(0.8125rem, 1.25vw + 0.1rem, 0.875rem);
    color: var(--text-muted);
}
