/* =========================================
   FORUM & COMMUNITY DESIGN SYSTEM
   Version 3.0 - Full Light/Dark Adaptive
   ========================================= */

/* ─── Variables locales adaptatives ─────── */
:root {
    /* Surfaces */
    --forum-surface:        var(--card);
    --forum-surface-hover:  rgba(0, 0, 0, 0.03);
    --forum-border:         var(--border-color);
    --forum-border-hover:   rgba(30, 136, 229, 0.4);

    /* Textes */
    --forum-heading:        var(--text);
    --forum-body:           var(--text);
    --forum-muted:          var(--muted);

    /* Accent glow (lumineux en light, discret en dark) */
    --forum-glow:           rgba(30, 136, 229, 0.18);
    --forum-accent-bg:      rgba(30, 136, 229, 0.08);
    --forum-accent-border:  rgba(30, 136, 229, 0.22);

    /* Header Community */
    --forum-header-bg:      linear-gradient(135deg, #0f172a 0%, #1e2f45 100%);
    --forum-header-text:    #ffffff;
    --forum-header-muted:   rgba(255,255,255,0.65);
}

body.dark-mode {
    --forum-surface:        rgba(30, 41, 59, 0.7);
    --forum-surface-hover:  rgba(30, 41, 59, 0.95);
    --forum-border:         rgba(255, 255, 255, 0.09);
    --forum-border-hover:   rgba(30, 136, 229, 0.45);
    --forum-heading:        #f1f5f9;
    --forum-body:           #cbd5e1;
    --forum-muted:          rgba(255,255,255,0.45);
    --forum-glow:           rgba(30, 136, 229, 0.35);
    --forum-accent-bg:      rgba(30, 136, 229, 0.12);
    --forum-accent-border:  rgba(30, 136, 229, 0.28);
}

/* ─── 1. Community Header ───────────────── */
.community-header {
    background: var(--forum-header-bg);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding: 4rem 0 0 0;
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.community-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 30% 25%, rgba(30, 136, 229, 0.18) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 75%, rgba(139, 92, 246, 0.12) 0%, transparent 50%);
    animation: headerGlow 18s ease-in-out infinite;
    z-index: 0;
    pointer-events: none;
}

@keyframes headerGlow {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33%       { transform: translate(2%, 1%) rotate(2deg); }
    66%       { transform: translate(-1%, 2%) rotate(-1deg); }
}

.community-header .container {
    position: relative;
    z-index: 1;
}

.community-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    margin-bottom: 0.75rem;
    color: var(--forum-header-text);
    letter-spacing: -0.02em;
}

.community-header p {
    color: var(--forum-header-muted);
    font-size: 1.05rem;
    max-width: 580px;
    margin-bottom: 2.5rem;
    line-height: 1.65;
}

/* ─── Tabs ──────────────────────────────── */
.community-tabs {
    display: flex;
    gap: 0.25rem;
    position: relative;
    z-index: 10;
}

.tab-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.9rem 1.4rem;
    cursor: pointer;
    position: relative;
    transition: color 0.25s ease, background 0.25s ease;
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.07);
}

.tab-btn.active {
    color: #fff;
    background: rgba(30, 136, 229, 0.18);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), #60a5fa);
    border-radius: 3px 3px 0 0;
    box-shadow: 0 0 16px var(--forum-glow);
}

/* ─── 2. Forum Grid (Topics) ────────────── */
.forum-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.topic-card {
    background: var(--forum-surface);
    border: 1px solid var(--forum-border);
    border-radius: 18px;
    padding: 1.75rem;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: var(--forum-heading);
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* Accent bar on the left */
.topic-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--accent), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 18px 0 0 18px;
}

.topic-card:hover {
    border-color: var(--forum-border-hover);
    transform: translateY(-6px);
    box-shadow:
        0 16px 36px -12px rgba(30, 136, 229, 0.2),
        0 4px 12px rgba(0,0,0,0.08);
    color: var(--forum-heading);
}

.topic-card:hover::before {
    opacity: 1;
}

.topic-icon-placeholder {
    width: 54px;
    height: 54px;
    background: var(--forum-accent-bg);
    border: 1px solid var(--forum-accent-border);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    color: var(--accent);
    font-size: 1.6rem;
    font-weight: 800;
    transition: all 0.3s ease;
}

.topic-card:hover .topic-icon-placeholder {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    transform: scale(1.08);
    box-shadow: 0 6px 18px var(--forum-glow);
}

.topic-card h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.65rem;
    color: var(--forum-heading);
    transition: color 0.25s ease;
    line-height: 1.35;
}

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

.topic-card .description {
    color: var(--forum-muted);
    font-size: 0.92rem;
    line-height: 1.65;
    margin-bottom: 1.75rem;
    flex-grow: 1;
}

.topic-stats {
    display: flex;
    gap: 1.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--forum-border);
    font-size: 0.83rem;
    color: var(--forum-muted);
}

.topic-stats span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.topic-stats span strong {
    color: var(--accent);
    font-weight: 700;
    font-size: 1rem;
}

/* ─── 3. Thread List (Detail) ───────────── */
.thread-list-container {
    background: var(--forum-surface);
    border: 1px solid var(--forum-border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.thread-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.25rem;
    padding: 1.5rem 1.75rem;
    border-bottom: 1px solid var(--forum-border);
    align-items: center;
    transition: background 0.2s ease;
    text-decoration: none;
    color: var(--forum-heading);
}

.thread-item:last-child {
    border-bottom: none;
}

.thread-item:hover {
    background: var(--forum-surface-hover);
}

.thread-avatar {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid var(--forum-border);
    transition: all 0.25s ease;
}

.thread-item:hover .thread-avatar {
    border-color: var(--accent);
    transform: scale(1.05);
}

.thread-main {
    min-width: 0;
}

.thread-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--forum-heading);
    margin-bottom: 0.4rem;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.25s ease;
}

.thread-item:hover .thread-title {
    color: var(--accent);
}

.thread-meta {
    font-size: 0.82rem;
    color: var(--forum-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.thread-meta .author {
    color: var(--accent);
    font-weight: 600;
}

.thread-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    min-width: 90px;
}

.stat-badge {
    background: var(--forum-accent-bg);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 700;
    border: 1px solid var(--forum-accent-border);
}

.thread-item.pinned {
    background: var(--forum-accent-bg);
    border-left: 4px solid var(--accent);
}

/* ─── 4. Actualités Tab ─────────────────── */
.actu-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.news-card {
    background: var(--forum-surface);
    border: 1px solid var(--forum-border);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1.5rem;
    transition: all 0.35s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.news-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.15);
    border-color: var(--forum-border-hover);
}

.news-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.news-content {
    padding: 1.5rem;
}

.news-tag {
    display: inline-block;
    background: var(--forum-accent-bg);
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    margin-bottom: 0.85rem;
    border: 1px solid var(--forum-accent-border);
}

.news-content h3 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.35;
    color: var(--forum-heading);
}

.news-content p {
    color: var(--forum-muted);
    line-height: 1.7;
    font-size: 0.93rem;
    margin-bottom: 1.25rem;
}

/* ─── Trending Sidebar ──────────────────── */
.trending-sidebar {
    background: var(--forum-surface);
    border: 1px solid var(--forum-border);
    border-radius: 16px;
    padding: 1.6rem;
    height: fit-content;
    position: sticky;
    top: 120px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.trending-sidebar h4 {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--forum-muted);
    margin-bottom: 1.25rem;
    padding-bottom: 0.7rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

.trending-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--forum-border);
    transition: padding-left 0.25s ease;
}

.trending-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.trending-item:hover {
    padding-left: 0.4rem;
}

.trending-item small {
    color: var(--accent);
    font-weight: 700;
    font-size: 0.78rem;
}

.trending-item p {
    color: var(--forum-heading);
    font-size: 0.92rem;
    margin: 0.3rem 0 0 0;
    line-height: 1.45;
}

/* ─── 5. Live Tab ───────────────────────── */
.live-player {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0f1e2e 100%);
    border-radius: 20px;
    aspect-ratio: 16/9;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2.5rem;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow:
        0 24px 60px -20px rgba(0, 0, 0, 0.55),
        inset 0 0 80px rgba(30, 136, 229, 0.05);
}

.live-player::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 30%, rgba(30, 136, 229, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
    animation: playerGlow 8s ease-in-out infinite;
}

@keyframes playerGlow {
    0%, 100% { opacity: 0.5; }
    50%       { opacity: 1; }
}

.offline-state {
    text-align: center;
    color: rgba(255,255,255,0.75);
    position: relative;
    z-index: 1;
    padding: 2rem;
}

.offline-icon {
    font-size: 3.5rem;
    margin-bottom: 1.25rem;
    opacity: 0.65;
    animation: iconPulse 2.5s ease-in-out infinite;
    display: block;
}

@keyframes iconPulse {
    0%, 100% { transform: scale(1); opacity: 0.65; }
    50%       { transform: scale(1.08); opacity: 0.85; }
}

.offline-state h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f1f5f9;
    margin-bottom: 0.6rem;
}

.offline-state p {
    color: rgba(255,255,255,0.55);
    font-size: 0.98rem;
    margin-bottom: 0;
}

.offline-state .cta {
    background: linear-gradient(135deg, var(--accent), #60a5fa);
    border: none;
    padding: 0.85rem 2rem;
    border-radius: 10px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(30, 136, 229, 0.3);
}

.offline-state .cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(30, 136, 229, 0.45);
}

.offline-state .cta.secondary {
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.22);
    box-shadow: none;
}

.offline-state .cta.secondary:hover {
    background: rgba(255,255,255,0.2);
}

/* ─── Replays Section ───────────────────── */
.replays-section h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--forum-heading);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.replay-card {
    min-width: 265px;
    background: var(--forum-surface);
    border: 1px solid var(--forum-border);
    border-radius: 14px;
    padding: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.replay-card:hover {
    transform: translateY(-4px);
    border-color: var(--forum-border-hover);
    box-shadow: 0 12px 28px -8px rgba(30,136,229,0.18);
}

.replay-thumbnail {
    height: 150px;
    border-radius: 10px;
    margin-bottom: 0.9rem;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.replay-thumbnail::after {
    content: '▶';
    position: absolute;
    width: 44px;
    height: 44px;
    background: rgba(30, 136, 229, 0.92);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: white;
    opacity: 0;
    transition: opacity 0.28s ease;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.replay-card:hover .replay-thumbnail::after {
    opacity: 1;
}

.replay-card h4 {
    font-size: 0.97rem;
    font-weight: 600;
    color: var(--forum-heading);
    margin-bottom: 0.3rem;
    line-height: 1.35;
}

.replay-card small {
    color: var(--forum-muted);
    font-size: 0.82rem;
}

/* ─── Live Chat Placeholder ─────────────── */
.live-chat-placeholder {
    background: var(--forum-surface);
    border: 2px dashed var(--forum-border);
    border-radius: 14px;
    height: 380px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--forum-muted);
    font-size: 0.92rem;
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
}

/* ─── CTA Override for Forum ────────────── */
.forum-cta,
.cta.small-cta {
    background: linear-gradient(135deg, var(--accent), #60a5fa);
    padding: 0.55rem 1.2rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    border: none;
    transition: all 0.3s ease;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

.forum-cta:hover,
.cta.small-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(30, 136, 229, 0.35);
    color: #fff;
}

/* ─── Live section layout ───────────────── */
.live-bottom-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

/* ─── Responsive ─────────────────────────── */
@media (max-width: 900px) {
    .community-header {
        padding: 2.5rem 0 0 0;
    }

    .community-header h1 {
        font-size: 1.9rem;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.88rem;
    }
}

@media (max-width: 768px) {
    .actu-grid {
        grid-template-columns: 1fr;
    }

    .trending-sidebar {
        position: static;
    }

    .thread-item {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .thread-avatar,
    .thread-stats {
        display: none;
    }

    .forum-grid {
        grid-template-columns: 1fr;
    }

    .topic-card {
        padding: 1.4rem;
    }

    .live-bottom-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .community-header {
        padding: 2rem 0 0 0;
    }

    .community-header p {
        font-size: 0.92rem;
    }

    .tab-btn {
        padding: 0.6rem 0.75rem;
        font-size: 0.8rem;
    }
}