/* =============================================
   FORUM — Palette TMC (variables globales)
   ============================================= */

.forum-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 80px;
    width: 100%;
    box-sizing: border-box;
}

/* ── Hero ── */
.forum-hero {
    background: linear-gradient(135deg, var(--tmc-primary), var(--tmc-primary-2));
    border-radius: var(--radius-xl);
    padding: 48px;
    color: #fff;
    margin-bottom: 40px;
    overflow: hidden;
    position: relative;
}

.forum-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(244, 166, 35, .18), transparent 32%),
                radial-gradient(circle at bottom left, rgba(255, 255, 255, .06), transparent 25%);
}

.forum-hero-content {
    position: relative;
    z-index: 2;
    max-width: 760px;
}

.forum-hero h1 {
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.05;
    margin: 0 0 18px;
}

.forum-hero p {
    font-size: 1.08rem;
    line-height: 1.7;
    opacity: .92;
    margin-bottom: 28px;
    color: #fff;
}

/* ── Create button ── */
.forum-create-wrap {
    margin: 0 0 24px;
    display: flex;
    justify-content: flex-end;
}

.forum-hero-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--tmc-accent);
    color: var(--text-main);
    padding: 14px 24px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 800;
    transition: .2s ease;
    min-height: 46px;
}

.forum-hero-btn:hover {
    background: var(--tmc-accent-2);
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(244, 166, 35, .28);
}

/* ── Badges ── */
.forum-badge,
.forum-weekly-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    margin-bottom: 16px;
}

.forum-badge {
    background: rgba(255, 255, 255, .14);
    border: 1px solid rgba(255, 255, 255, .18);
    color: #fff;
}

.forum-weekly-badge {
    background: rgba(244, 166, 35, .12);
    color: #9A6700;
    border: 1px solid rgba(244, 166, 35, .3);
}

/* ── Filters ── */
.forum-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.forum-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--border-soft);
    color: var(--tmc-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    transition: .2s ease;
}

.forum-filter:hover {
    transform: translateY(-1px);
    border-color: var(--tmc-primary);
}

.forum-filter.active {
    background: var(--tmc-primary);
    color: #fff;
    border-color: var(--tmc-primary);
}

/* ── Weekly highlight card ── */
.forum-highlights {
    margin-bottom: 32px;
}

.forum-highlights-card {
    background: linear-gradient(135deg, rgba(244, 166, 35, .08), rgba(255, 188, 66, .04));
    border: 1px solid rgba(244, 166, 35, .35);
    border-radius: var(--radius-xl);
    padding: 32px 36px;
    position: relative;
}

.forum-highlights-card h2 {
    font-size: 1.6rem;
    margin: 12px 0 12px;
    line-height: 1.2;
}

.forum-highlights-card h2 a {
    color: var(--text-main);
    text-decoration: none;
}

.forum-highlights-card h2 a:hover {
    color: var(--tmc-primary);
}

.forum-highlights-card p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

/* ── Category badge ── */
.forum-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 10px;
    background: color-mix(in srgb, var(--category-color, var(--tmc-primary)) 12%, transparent);
    color: var(--category-color, var(--tmc-primary));
    border: 1px solid color-mix(in srgb, var(--category-color, var(--tmc-primary)) 30%, transparent);
}

.forum-category-icon {
    font-size: 14px;
    line-height: 1;
}

/* ── Topic grid ── */
.forum-topics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

/* ── Topic card ── */
.forum-topic-card {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: 26px;
    padding: 24px;
    transition: .25s ease;
    box-shadow: var(--shadow-soft);
    min-height: 260px;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
}

.forum-topic-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
    border-color: color-mix(in srgb, var(--tmc-primary) 15%, transparent);
}

.forum-topic-card h2 {
    margin: 14px 0 12px;
    font-size: 22px;
    line-height: 1.3;
}

.forum-topic-card h2 a {
    color: var(--text-main);
    text-decoration: none;
}

.forum-topic-card p {
    color: var(--text-muted);
    line-height: 1.6;
    flex: 1;
}

/* Card overlay for full-card click */
.forum-card-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.forum-topic-card > *:not(.forum-card-overlay) {
    position: relative;
    z-index: 2;
}

.forum-topic-card a {
    position: relative;
    z-index: 2;
}

/* ── Topic footer ── */
.forum-topic-footer {
    margin-top: auto;
    padding-top: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.forum-read-more {
    color: var(--tmc-accent);
    text-decoration: none;
    font-weight: 800;
    transition: color .2s ease;
}

.forum-read-more:hover {
    color: #9A6700;
}

/* ── Empty state ── */
.forum-empty {
    color: var(--text-muted);
    grid-column: 1 / -1;
    padding: 40px;
    text-align: center;
}

/* ── Back container ── */
.forum-back-container {
    margin-bottom: 16px;
}

/* =============================================
   TOPIC DETAIL PAGE
   ============================================= */

.forum-topic-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px 80px;
    width: 100%;
    box-sizing: border-box;
}

.forum-back-link {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--tmc-primary);
    font-weight: 800;
    text-decoration: none;
}

.forum-topic-main {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-card);
    margin-bottom: 28px;
}

.forum-topic-main h1 {
    margin: 14px 0;
    font-size: 34px;
    line-height: 1.2;
}

.forum-topic-main p {
    color: var(--text-muted);
    line-height: 1.7;
}

.forum-topic-meta {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 18px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
}

/* ── Replies ── */
.forum-replies {
    margin-bottom: 28px;
}

.forum-replies h2,
.forum-reply-form h2 {
    font-size: 24px;
    margin-bottom: 18px;
}

.forum-reply {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-soft);
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 14px;
    align-items: flex-start;
}

.forum-reply-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--tmc-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 18px;
}

.forum-reply-content {
    min-width: 0;
}

.forum-reply-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.forum-reply-header strong {
    font-weight: 900;
    color: var(--text-main);
}

.forum-reply-date {
    color: var(--text-muted);
    font-size: 13px;
}

.forum-reply-content p {
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 0;
}

/* ── Reply actions (like) ── */
.forum-reply-actions {
    margin-top: 12px;
    display: flex;
    align-items: center;
}

.forum-like-form {
    margin: 0;
}

.forum-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border-soft);
    background: #fff;
    color: var(--text-main);
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: .2s ease;
}

.forum-like-btn:hover {
    background: #fff1f2;
    border-color: #fecdd3;
    color: #be123c;
}

/* ── Reply form ── */
.forum-reply-form {
    background: var(--bg-soft);
    border-radius: var(--radius-xl);
    padding: 24px;
    border: 1px solid var(--border-soft);
    margin-top: 24px;
    box-shadow: var(--shadow-soft);
}

.forum-reply-form input,
.forum-reply-form select,
.forum-reply-form textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-soft);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    background: #fff;
    box-sizing: border-box;
}

.forum-reply-form textarea {
    resize: vertical;
}

.forum-reply-form input:focus,
.forum-reply-form select:focus,
.forum-reply-form textarea:focus {
    outline: none;
    border-color: var(--tmc-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tmc-primary) 12%, transparent);
}

.forum-reply-form button {
    margin-top: 14px;
    padding: 12px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--tmc-primary);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    min-height: 46px;
    transition: background .2s ease;
}

.forum-reply-form button:hover {
    background: var(--green-dark, #0A1F29);
}

/* ── Form header ── */
.forum-form-header {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.forum-form-header span {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--tmc-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 44px;
}

.forum-form-header h2 {
    margin: 0 0 4px;
}

.forum-form-header p {
    margin: 0;
    color: var(--text-muted);
}

/* ── Login required block ── */
.forum-login-required {
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-xl);
    padding: 28px;
    box-shadow: var(--shadow-card);
    text-align: center;
}

.forum-login-required h2 {
    margin: 0 0 10px;
    color: var(--text-main);
}

.forum-login-required p {
    color: var(--text-muted);
    max-width: 620px;
    margin: 0 auto 20px;
    line-height: 1.6;
}

.forum-login-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.forum-login-btn,
.forum-register-btn {
    display: inline-flex;
    padding: 12px 18px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 800;
    min-height: 46px;
    align-items: center;
    justify-content: center;
}

.forum-login-btn {
    background: var(--tmc-primary);
    color: #fff;
}

.forum-register-btn {
    background: var(--bg-soft);
    color: var(--tmc-primary);
    border: 1px solid var(--border-soft);
}

/* ── Create card (forum_create page) ── */
.forum-create-card {
    background: #fff;
    border-radius: 28px;
    padding: 34px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-soft);
}

.forum-create-card h1 {
    font-size: 34px;
    margin: 0 0 10px;
    color: var(--text-main);
}

.forum-create-card p {
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* ── Success message ── */
.forum-success-message {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-weight: 700;
    margin-bottom: 22px;
}

/* ── Related topics ── */
.forum-related {
    margin-top: 34px;
}

.forum-related h2 {
    font-size: 24px;
    margin-bottom: 16px;
}

.forum-related-list {
    display: grid;
    gap: 14px;
}

.forum-related-card {
    display: block;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 18px;
    text-decoration: none;
    box-shadow: var(--shadow-soft);
    transition: .2s ease;
}

.forum-related-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.forum-related-card strong {
    display: block;
    color: var(--text-main);
    margin-bottom: 6px;
}

.forum-related-card span {
    color: var(--text-muted);
    font-size: 13px;
}

/* ── Notifications ── */
.account-notifications {
    margin: 32px 0;
    display: grid;
    gap: 14px;
}

.account-notifications h2 {
    font-size: 24px;
    margin-bottom: 6px;
}

.account-notification {
    display: block;
    background: #fff;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 18px;
    text-decoration: none;
    color: var(--text-main);
    box-shadow: var(--shadow-soft);
    transition: .2s ease;
}

.account-notification:hover {
    transform: translateY(-2px);
}

.account-notification.unread {
    border-color: color-mix(in srgb, var(--tmc-primary) 40%, transparent);
    background: color-mix(in srgb, var(--tmc-primary) 4%, #fff);
}

.account-notification strong {
    display: block;
    margin-bottom: 6px;
}

.account-notification p {
    margin: 0 0 10px;
    color: var(--text-muted);
    line-height: 1.5;
}

.account-notification span {
    font-size: 12px;
    color: var(--text-muted);
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 1000px) {
    .forum-topics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .forum-page,
    .forum-topic-page {
        padding: 20px 14px 110px;
    }

    .forum-hero {
        padding: 28px 20px;
        border-radius: var(--radius-xl);
        margin-bottom: 24px;
    }

    .forum-hero h1 {
        font-size: 30px;
    }

    .forum-hero p {
        font-size: 15px;
        line-height: 1.55;
        margin-bottom: 18px;
    }

    .forum-create-wrap {
        justify-content: stretch;
        margin-bottom: 18px;
    }

    .forum-hero-btn {
        width: 100%;
        border-radius: var(--radius-md);
    }

    .forum-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 8px;
        margin-bottom: 22px;
        -webkit-overflow-scrolling: touch;
    }

    .forum-filters::-webkit-scrollbar {
        display: none;
    }

    .forum-filter {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .forum-topics {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .forum-topic-card {
        min-height: auto;
        padding: 20px;
        border-radius: 22px;
    }

    .forum-topic-card h2 {
        font-size: 20px;
    }

    .forum-topic-footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    .forum-highlights-card {
        padding: 24px 20px;
        border-radius: var(--radius-xl);
    }

    .forum-topic-main {
        padding: 22px;
        border-radius: 22px;
        margin-bottom: 22px;
    }

    .forum-topic-main h1 {
        font-size: 26px;
    }

    .forum-topic-meta {
        gap: 10px;
        font-size: 13px;
    }

    .forum-reply {
        grid-template-columns: 40px 1fr;
        padding: 16px;
        border-radius: var(--radius-lg);
    }

    .forum-reply-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .forum-reply-header {
        gap: 4px;
        flex-direction: column;
        align-items: flex-start;
    }

    .forum-reply-form {
        padding: 20px;
        border-radius: 22px;
        margin-bottom: 24px;
    }

    .forum-form-header span {
        width: 38px;
        height: 38px;
        flex: 0 0 38px;
    }

    .forum-form-header h2 {
        font-size: 20px;
    }

    .forum-login-actions {
        flex-direction: column;
    }

    .forum-login-btn,
    .forum-register-btn {
        justify-content: center;
        width: 100%;
    }

    .forum-create-card {
        padding: 24px;
        border-radius: 22px;
    }

    .forum-create-card h1 {
        font-size: 26px;
    }

    .forum-topic-page {
        padding-bottom: 120px;
    }

    .forum-reply-form,
    .forum-reply-box,
    .forum-discussion-box {
        margin-bottom: 40px;
    }
}
