/**
 * Forum Page Styles
 *
 * ============================================================================
 * FILE LOCATION: /includes/css/pages/forum.css
 * CREATED: January 18, 2026
 * UPDATED: January 18, 2026 - v1: Full modernization with BEM + transparency control
 * ============================================================================
 * 
 * BEM NAMING CONVENTION:
 * - Block: .forum-page, .forum-board, .forum-topic
 * - Element: .forum-page__header, .forum-board__icon
 * - Modifier: .forum-board--featured, .forum-topic--pinned
 * 
 * FEATURES:
 * - Custom background image (forum_background.png)
 * - Admin-controlled transparency via site_settings
 * - Fixed header/footer with scrollable content
 * - Responsive design
 * - Glass-morphism effects
 * 
 * STANDARDS COMPLIANCE:
 * ✅ BEM naming convention
 * ✅ CSS variables for customization
 * ✅ Modular structure
 * ✅ Responsive design
 */

/* =============================================================================
   STICKY HEADER SUPPORT
   ============================================================================= */

.navbar,
header,
.site-header,
nav[role="navigation"] {
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    width: 100%;
}

body {
    padding-top: 56px;
}

/* =============================================================================
   CSS VARIABLES (Admin-controllable via site_settings)
   ============================================================================= */

:root {
    /* Layout constants */
    --tb-header-h: 56px;
    --tb-footer-h: 80px;

    /* Background image settings */
    --tb-forum-bg-position: center top;
    --tb-forum-bg-size: cover;
    --tb-forum-bg-opacity: 1;
    --tb-forum-bg-blur: 3px;

    /* Overlay gradient strength */
    --tb-forum-overlay-strength: 0.12;
    --tb-forum-left-fade: 0.42;

    /* Card transparency system */
    --tb-forum-card-border: rgba(255, 255, 255, 0.70);
    
    /* Header card */
    --tb-forum-header-bg: rgba(102, 126, 234, 1);
    
    /* Board cards */
    --tb-forum-board-bg: rgba(255, 255, 255, 0.88);
    --tb-forum-board-hover-bg: rgba(255, 255, 255, 0.95);
    
    /* Topic cards */
    --tb-forum-topic-bg: rgba(255, 255, 255, 0.85);
    --tb-forum-topic-hover-bg: rgba(255, 255, 255, 0.92);
    
    /* Sidebar widgets */
    --tb-forum-widget-bg: rgba(255, 255, 255, 0.90);
    
    /* Post cards */
    --tb-forum-post-bg: rgba(255, 255, 255, 0.88);
    --tb-forum-post-author-bg: rgba(248, 249, 250, 0.90);
    
    /* Special states */
    --tb-forum-pinned-border: rgba(255, 193, 7, 0.6);
    --tb-forum-locked-bg: rgba(239, 68, 68, 0.1);
}

/* =============================================================================
   FIXED FOOTER + SCROLLABLE CONTENT
   ============================================================================= */

footer,
.site-footer,
.footer {
    position: fixed !important;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1020;
}

body {
    padding-bottom: var(--tb-footer-h);
}

/* =============================================================================
   BACKGROUND IMAGE LAYER (FIXED, BEHIND EVERYTHING)
   ============================================================================= */

.forum-page::before {
    content: "";
    position: fixed;
    top: var(--tb-header-h);
    left: 0;
    right: 0;
    bottom: var(--tb-footer-h);
    z-index: -3;
    
    background-image: url('/assets/images/backgrounds/forum_background.png');
    background-position: var(--tb-forum-bg-position);
    background-size: var(--tb-forum-bg-size);
    background-repeat: no-repeat;
    background-attachment: fixed;
    
    opacity: var(--tb-forum-bg-opacity);
    filter: blur(var(--tb-forum-bg-blur));
    
    pointer-events: none;
}

/* =============================================================================
   OVERLAY GRADIENT LAYER
   ============================================================================= */

.forum-page::after {
    content: "";
    position: fixed;
    top: var(--tb-header-h);
    left: 0;
    right: 0;
    bottom: var(--tb-footer-h);
    z-index: -2;

    background:
        linear-gradient(90deg,
            rgba(246,236,222,var(--tb-forum-left-fade)) 0%,
            rgba(246,236,222,0.22) 22%,
            rgba(246,236,222,0.08) 44%,
            rgba(246,236,222,0.00) 65%),
        linear-gradient(180deg,
            rgba(248,242,234,0.60) 0%,
            rgba(248,242,234,0.20) 40%,
            rgba(248,242,234,0.10) 70%,
            rgba(248,242,234,0.00) 100%),
        rgba(246,236,222,var(--tb-forum-overlay-strength));

    pointer-events: none;
}

.forum-page .container {
    position: relative;
}

/* =============================================================================
   PAGE HEADER (GRADIENT HERO)
   ============================================================================= */

.forum-page__header {
    background: transparent;
    color: #1e293b;
    padding: 3rem 0;
    margin-bottom: 2rem;
    margin-top: calc(var(--tb-header-h) * -1);
    padding-top: calc(3rem + var(--tb-header-h));
    text-shadow: 0 2px 4px rgba(255,255,255,0.8);
}

.forum-page__title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.forum-page__subtitle {
    font-size: 1.125rem;
    opacity: 0.85;
    margin-bottom: 0;
    color: #475569;
}

/* =============================================================================
   FORUM STATS BAR
   ============================================================================= */

.forum-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.forum-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.90);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
    color: #1e293b;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.forum-stat__icon {
    font-size: 1.25rem;
}

.forum-stat__label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.forum-stat__value {
    font-weight: 700;
    font-size: 1.125rem;
}

/* =============================================================================
   BREADCRUMB NAVIGATION
   ============================================================================= */

.forum-breadcrumb {
    background: none;
    padding: 0;
    margin-bottom: 1rem;
}

.forum-breadcrumb__item {
    color: rgba(255,255,255,0.8);
}

.forum-breadcrumb__item--active {
    color: white;
}

.forum-breadcrumb__link {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
}

.forum-breadcrumb__link:hover {
    color: white;
}

/* =============================================================================
   BOARD LIST (MAIN FORUM PAGE)
   ============================================================================= */

.forum-board-list {
    background: var(--tb-forum-board-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.forum-board {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    transition: background 0.2s;
}

.forum-board:last-child {
    border-bottom: none;
}

.forum-board:hover {
    background: var(--tb-forum-board-hover-bg);
}

.forum-board__icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin-right: 1.5rem;
    flex-shrink: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.forum-board__content {
    flex: 1;
    min-width: 0;
}

.forum-board__name {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
    text-decoration: none;
    display: inline-block;
}

.forum-board__name:hover {
    color: #667eea;
}

.forum-board__description {
    font-size: 0.875rem;
    color: #64748b;
    margin: 0;
}

.forum-board__stats {
    display: flex;
    gap: 2rem;
    margin-right: 2rem;
    flex-shrink: 0;
}

.forum-board__stat {
    text-align: center;
    min-width: 80px;
}

.forum-board__stat-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
}

.forum-board__stat-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.forum-board__latest {
    flex-shrink: 0;
    width: 250px;
}

.forum-board__latest-title {
    color: #1e293b;
    font-weight: 500;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
    text-decoration: none;
    display: block;
}

.forum-board__latest-title:hover {
    color: #667eea;
}

.forum-board__latest-meta {
    color: #64748b;
    font-size: 0.8125rem;
}

/* =============================================================================
   TOPIC LIST (BOARD PAGE)
   ============================================================================= */

.forum-topic-list {
    background: var(--tb-forum-topic-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.forum-topic {
    display: flex;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    transition: background 0.2s;
}

.forum-topic:last-child {
    border-bottom: none;
}

.forum-topic:hover {
    background: var(--tb-forum-topic-hover-bg);
}

.forum-topic--pinned {
    background: rgba(255, 193, 7, 0.08);
    border-left: 4px solid var(--tb-forum-pinned-border);
}

.forum-topic--locked {
    background: var(--tb-forum-locked-bg);
    opacity: 0.7;
}

.forum-topic__status {
    margin-right: 1rem;
    flex-shrink: 0;
}

.forum-topic__status-icon {
    font-size: 1.5rem;
    color: #94a3b8;
}

.forum-topic__status-icon--pinned {
    color: #f59e0b;
}

.forum-topic__status-icon--locked {
    color: #ef4444;
}

.forum-topic__content {
    flex: 1;
    min-width: 0;
}

.forum-topic__title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
    text-decoration: none;
    display: inline-block;
}

.forum-topic__title:hover {
    color: #667eea;
}

.forum-topic__meta {
    font-size: 0.875rem;
    color: #64748b;
}

.forum-topic__author {
    color: #64748b;
    text-decoration: none;
}

.forum-topic__author:hover {
    color: #667eea;
}

.forum-topic__stats {
    display: flex;
    gap: 1.5rem;
    margin-right: 1.5rem;
    flex-shrink: 0;
}

.forum-topic__stat {
    text-align: center;
}

.forum-topic__stat-number {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
}

.forum-topic__stat-label {
    font-size: 0.75rem;
    color: #64748b;
}

/* =============================================================================
   POST DISPLAY (TOPIC PAGE)
   ============================================================================= */

.forum-post {
    display: flex;
    gap: 1.5rem;
    background: var(--tb-forum-post-bg);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    backdrop-filter: blur(10px);
}

.forum-post--first {
    border: 2px solid #667eea;
}

.forum-post__author {
    flex-shrink: 0;
    width: 180px;
    text-align: center;
    background: var(--tb-forum-post-author-bg);
    padding: 1rem;
    border-radius: 8px;
}

.forum-post__avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 0.75rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    font-weight: 700;
}

.forum-post__username {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.forum-post__role {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.forum-post__user-stats {
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: #64748b;
}

.forum-post__content-wrapper {
    flex: 1;
    min-width: 0;
}

.forum-post__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.forum-post__date {
    font-size: 0.875rem;
    color: #64748b;
}

.forum-post__actions {
    display: flex;
    gap: 0.5rem;
}

.forum-post__action-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
    border: none;
    background: rgba(0,0,0,0.05);
    color: #64748b;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.forum-post__action-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.forum-post__body {
    color: #334155;
    line-height: 1.7;
    font-size: 0.9375rem;
}

.forum-post__body p:last-child {
    margin-bottom: 0;
}

.forum-post__footer {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(0,0,0,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.forum-post__edited {
    font-size: 0.8125rem;
    color: #94a3b8;
    font-style: italic;
}

/* =============================================================================
   SIDEBAR WIDGETS
   ============================================================================= */

.forum-widget {
    background: var(--tb-forum-widget-bg);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
}

.forum-widget__title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.forum-widget__title-icon {
    color: #667eea;
}

.forum-widget__list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.forum-widget__list-item {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

.forum-widget__list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.forum-widget__link {
    font-size: 0.875rem;
    color: #1e293b;
    font-weight: 500;
    text-decoration: none;
    display: block;
    margin-bottom: 0.25rem;
}

.forum-widget__link:hover {
    color: #667eea;
}

.forum-widget__meta {
    font-size: 0.75rem;
    color: #64748b;
}

/* =============================================================================
   GUEST NOTICE
   ============================================================================= */

.forum-notice {
    background: rgba(219, 234, 254, 0.9);
    border-left: 4px solid #3b82f6;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    backdrop-filter: blur(10px);
}

.forum-notice__icon {
    color: #3b82f6;
    margin-right: 0.5rem;
}

.forum-notice__text {
    color: #1e3a8a;
    margin: 0;
}

.forum-notice__link {
    color: #1e40af;
    font-weight: 600;
    text-decoration: none;
}

.forum-notice__link:hover {
    text-decoration: underline;
}

/* =============================================================================
   ACTION BUTTONS
   ============================================================================= */

.forum-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.forum-btn--primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.forum-btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: white;
}

.forum-btn--secondary {
    background: rgba(255,255,255,0.9);
    color: #667eea;
    border: 2px solid #667eea;
}

.forum-btn--secondary:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 992px) {
    .forum-board__latest,
    .forum-topic__stats {
        display: none;
    }
}

@media (max-width: 768px) {
    .forum-board__stats {
        display: none;
    }
    
    .forum-board,
    .forum-topic {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .forum-board__icon {
        margin-bottom: 1rem;
    }
    
    .forum-post {
        flex-direction: column;
    }
    
    .forum-post__author {
        width: 100%;
    }
    
    .forum-stats {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (max-width: 576px) {
    .forum-page__header {
        padding: 2rem 0;
        margin-bottom: 1rem;
    }
    
    .forum-page__title {
        font-size: 1.75rem;
    }
    
    .forum-board,
    .forum-topic,
    .forum-post {
        padding: 1rem;
    }
}