/* ============================================
   Flavor Forum — Modern Forum Theme
   Main Stylesheet
   ============================================ */

/* --- CSS Custom Properties (Dark-first) --- */
:root {
    /* Brand */
    --ff-primary: #6366f1;
    --ff-primary-hover: #5558e6;
    --ff-primary-light: rgba(99, 102, 241, 0.12);
    --ff-primary-ghost: rgba(99, 102, 241, 0.06);

    /* Grays (dark mode default) */
    --ff-bg: #0f0f10;
    --ff-bg-raised: #18181b;
    --ff-bg-overlay: #1e1e22;
    --ff-bg-hover: #24242a;
    --ff-bg-active: #2a2a32;
    --ff-border: #27272a;
    --ff-border-light: #1e1e22;
    --ff-text: #fafafa;
    --ff-text-secondary: #a1a1aa;
    --ff-text-muted: #71717a;
    --ff-text-inverse: #09090b;

    /* Accents */
    --ff-success: #22c55e;
    --ff-warning: #f59e0b;
    --ff-danger: #ef4444;
    --ff-info: #3b82f6;

    /* Vote colors */
    --ff-upvote: #f97316;
    --ff-downvote: #8b5cf6;

    /* Sizing */
    --ff-header-h: 56px;
    --ff-sidebar-w: 260px;
    --ff-sidebar-right-w: 320px;
    --ff-radius: 10px;
    --ff-radius-sm: 6px;
    --ff-radius-lg: 14px;
    --ff-radius-full: 9999px;

    /* Typography */
    --ff-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --ff-font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Transitions */
    --ff-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --ff-transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Shadows */
    --ff-shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --ff-shadow: 0 2px 8px rgba(0,0,0,0.3);
    --ff-shadow-lg: 0 8px 30px rgba(0,0,0,0.4);
    --ff-shadow-xl: 0 20px 60px rgba(0,0,0,0.5);
}

/* Light mode */
.ff-body--light {
    --ff-bg: #f8f9fa;
    --ff-bg-raised: #ffffff;
    --ff-bg-overlay: #ffffff;
    --ff-bg-hover: #f1f3f5;
    --ff-bg-active: #e9ecef;
    --ff-border: #e2e2e5;
    --ff-border-light: #f0f0f2;
    --ff-text: #111113;
    --ff-text-secondary: #555560;
    --ff-text-muted: #888893;
    --ff-text-inverse: #fafafa;
    --ff-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --ff-shadow: 0 2px 8px rgba(0,0,0,0.08);
    --ff-shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --ff-shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body.ff-body {
    font-family: var(--ff-font);
    background: var(--ff-bg);
    color: var(--ff-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

a {
    color: var(--ff-primary);
    text-decoration: none;
    transition: color var(--ff-transition);
}
a:hover {
    color: var(--ff-primary-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    font-size: inherit;
}

input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* --- Header --- */
.ff-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--ff-header-h);
    background: var(--ff-bg-raised);
    border-bottom: 1px solid var(--ff-border);
    z-index: 1000;
    backdrop-filter: blur(12px);
    background: rgba(24, 24, 27, 0.85);
}
.ff-body--light .ff-header {
    background: rgba(255, 255, 255, 0.85);
}

.ff-header__inner {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 20px;
    gap: 16px;
    max-width: 100%;
}

.ff-header__left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.ff-header__menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--ff-radius-sm);
    color: var(--ff-text-secondary);
    transition: all var(--ff-transition);
}
.ff-header__menu-toggle:hover {
    background: var(--ff-bg-hover);
    color: var(--ff-text);
}

.ff-header__logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.ff-header__logo-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ff-text);
    letter-spacing: -0.02em;
}

.ff-header__logo img {
    height: 28px;
    width: auto;
}

.ff-header__center {
    flex: 1;
    max-width: 540px;
    margin: 0 auto;
}

.ff-header__right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* --- Search --- */
.ff-search {
    position: relative;
    width: 100%;
}

.ff-search__icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ff-text-muted);
    pointer-events: none;
}

.ff-search__input {
    width: 100%;
    height: 40px;
    background: var(--ff-bg);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius-full);
    padding: 0 40px 0 40px;
    color: var(--ff-text);
    font-size: 0.9rem;
    transition: all var(--ff-transition);
    outline: none;
}
.ff-search__input:focus {
    border-color: var(--ff-primary);
    background: var(--ff-bg-raised);
    box-shadow: 0 0 0 3px var(--ff-primary-light);
}
.ff-search__input::placeholder {
    color: var(--ff-text-muted);
}

.ff-search__shortcut {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    font-family: var(--ff-font-mono);
    background: var(--ff-bg-hover);
    color: var(--ff-text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--ff-border);
}

/* --- Buttons --- */
.ff-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--ff-radius-sm);
    font-weight: 500;
    font-size: 0.875rem;
    transition: all var(--ff-transition);
    white-space: nowrap;
    border: none;
    cursor: pointer;
    line-height: 1.4;
}

.ff-btn--primary {
    background: var(--ff-primary);
    color: #fff;
}
.ff-btn--primary:hover {
    background: var(--ff-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ff-btn--ghost {
    background: transparent;
    color: var(--ff-text-secondary);
    border: 1px solid var(--ff-border);
}
.ff-btn--ghost:hover {
    background: var(--ff-bg-hover);
    color: var(--ff-text);
    border-color: var(--ff-text-muted);
}

.ff-btn--sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.ff-btn--lg {
    padding: 12px 24px;
    font-size: 1rem;
}

.ff-btn--full {
    width: 100%;
}

.ff-btn--danger {
    background: var(--ff-danger);
    color: #fff;
}

/* --- Notifications --- */
.ff-notifications__trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--ff-radius-sm);
    color: var(--ff-text-secondary);
    transition: all var(--ff-transition);
}
.ff-notifications__trigger:hover {
    background: var(--ff-bg-hover);
    color: var(--ff-text);
}

.ff-notifications__badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: var(--ff-danger);
    border-radius: 50%;
}

/* --- User Menu --- */
.ff-user-menu {
    position: relative;
}

.ff-user-menu__trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: var(--ff-radius-sm);
    transition: all var(--ff-transition);
    color: var(--ff-text);
}
.ff-user-menu__trigger:hover {
    background: var(--ff-bg-hover);
}

.ff-user-menu__name {
    font-size: 0.85rem;
    font-weight: 500;
}

.ff-user-menu__dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--ff-bg-overlay);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    padding: 6px;
    box-shadow: var(--ff-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px) scale(0.97);
    transition: all var(--ff-transition);
    z-index: 100;
}

.ff-user-menu--open .ff-user-menu__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.ff-user-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--ff-radius-sm);
    color: var(--ff-text-secondary);
    font-size: 0.875rem;
    transition: all var(--ff-transition);
}
.ff-user-menu__item:hover {
    background: var(--ff-bg-hover);
    color: var(--ff-text);
}

.ff-user-menu__item--danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--ff-danger);
}

.ff-user-menu__divider {
    border: none;
    height: 1px;
    background: var(--ff-border);
    margin: 4px 0;
}

/* --- Layout --- */
.ff-layout {
    display: flex;
    min-height: 100vh;
    padding-top: var(--ff-header-h);
}

/* --- Left Sidebar --- */
.ff-sidebar {
    position: fixed;
    top: var(--ff-header-h);
    left: 0;
    bottom: 0;
    width: var(--ff-sidebar-w);
    background: var(--ff-bg-raised);
    border-right: 1px solid var(--ff-border);
    overflow-y: auto;
    padding: 12px 10px;
    z-index: 100;
    transition: transform var(--ff-transition-slow);
    scrollbar-width: thin;
    scrollbar-color: var(--ff-border) transparent;
}
.ff-sidebar::-webkit-scrollbar {
    width: 4px;
}
.ff-sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.ff-sidebar::-webkit-scrollbar-thumb {
    background: var(--ff-border);
    border-radius: 4px;
}

.ff-sidebar__group {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ff-border-light);
}
.ff-sidebar__group:last-child {
    border-bottom: none;
}

.ff-sidebar__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ff-text-muted);
}

.ff-sidebar__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--ff-radius-sm);
    color: var(--ff-text-secondary);
    font-size: 0.875rem;
    font-weight: 450;
    transition: all var(--ff-transition);
    text-decoration: none;
}
.ff-sidebar__link:hover {
    background: var(--ff-bg-hover);
    color: var(--ff-text);
}
.ff-sidebar__link--active {
    background: var(--ff-primary-light);
    color: var(--ff-primary);
    font-weight: 500;
}
.ff-sidebar__link--active:hover {
    background: var(--ff-primary-light);
    color: var(--ff-primary);
}

.ff-sidebar__link svg {
    flex-shrink: 0;
    opacity: 0.7;
}
.ff-sidebar__link:hover svg,
.ff-sidebar__link--active svg {
    opacity: 1;
}

.ff-sidebar__section-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* Circular community icons in sidebar */
.ff-sidebar__link .ff-community-icon {
    width: 24px !important;
    height: 24px !important;
    font-size: 12px !important;
    flex-shrink: 0;
}

.ff-sidebar__count {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--ff-text-muted);
    background: var(--ff-bg);
    padding: 1px 7px;
    border-radius: var(--ff-radius-full);
    font-weight: 500;
}

/* --- Main Content --- */
.ff-main {
    flex: 1;
    margin-left: var(--ff-sidebar-w);
    margin-right: var(--ff-sidebar-right-w);
    min-width: 0;
}

.ff-content-wrapper {
    max-width: 780px;
    margin: 0 auto;
    padding: 20px 24px;
}

/* --- Right Sidebar --- */
.ff-sidebar-right {
    position: fixed;
    top: var(--ff-header-h);
    right: 0;
    bottom: 0;
    width: var(--ff-sidebar-right-w);
    overflow-y: auto;
    padding: 20px 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--ff-border) transparent;
}
.ff-sidebar-right::-webkit-scrollbar {
    width: 4px;
}
.ff-sidebar-right::-webkit-scrollbar-thumb {
    background: var(--ff-border);
    border-radius: 4px;
}

/* --- Cards (Sidebar) --- */
.ff-card {
    background: var(--ff-bg-raised);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    overflow: hidden;
    margin-bottom: 16px;
}

.ff-card__header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--ff-border);
}

.ff-card__header--accent {
    background: var(--ff-primary);
    color: #fff;
    border-bottom: none;
}

.ff-card__header-title {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.ff-card__body {
    padding: 16px;
}

.ff-card__body--flush {
    padding: 0;
}

.ff-card__desc {
    font-size: 0.85rem;
    color: var(--ff-text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.ff-card__stats {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ff-border);
}

.ff-card__stat {
    display: flex;
    flex-direction: column;
}

.ff-card__stat-num {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--ff-text);
}

.ff-card__stat-label {
    font-size: 0.75rem;
    color: var(--ff-text-muted);
}

/* --- Trending Items --- */
.ff-trending-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 16px;
    text-decoration: none;
    transition: background var(--ff-transition);
    border-bottom: 1px solid var(--ff-border-light);
}
.ff-trending-item:last-child {
    border-bottom: none;
}
.ff-trending-item:hover {
    background: var(--ff-bg-hover);
}

.ff-trending-item__rank {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--ff-primary);
    min-width: 20px;
    padding-top: 1px;
}

.ff-trending-item__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ff-trending-item__title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ff-text);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ff-trending-item__meta {
    font-size: 0.75rem;
    color: var(--ff-text-muted);
}

/* --- Feed Controls --- */
.ff-feed-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--ff-border-light);
}

.ff-feed-controls__sort {
    display: flex;
    gap: 2px;
}

.ff-feed-controls__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--ff-radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ff-text-muted);
    text-decoration: none;
    transition: all var(--ff-transition);
}
.ff-feed-controls__btn:hover {
    background: var(--ff-bg-hover);
    color: var(--ff-text);
}
.ff-feed-controls__btn--active {
    background: var(--ff-primary-light);
    color: var(--ff-primary);
}
.ff-feed-controls__btn--active:hover {
    background: var(--ff-primary-light);
    color: var(--ff-primary);
}

/* --- Topic Card (Feed Item) --- */
.ff-card-topic {
    display: flex;
    gap: 0;
    background: var(--ff-bg-raised);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    padding: 0;
    margin-bottom: 10px;
    transition: all var(--ff-transition);
    overflow: hidden;
}
.ff-card-topic:hover {
    border-color: var(--ff-text-muted);
    box-shadow: var(--ff-shadow-sm);
}

.ff-card-topic--pinned {
    border-left: 3px solid var(--ff-primary);
}

.ff-card-topic__vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 12px 8px;
    background: var(--ff-bg);
    min-width: 48px;
}

.ff-card-topic__content {
    flex: 1;
    padding: 12px 14px;
    min-width: 0;
}

.ff-card-topic__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--ff-text-muted);
    margin-bottom: 4px;
}

.ff-card-topic__meta a {
    color: var(--ff-text-muted);
    font-weight: 500;
}
.ff-card-topic__meta a:hover {
    color: var(--ff-text);
}

.ff-card-topic__dot {
    color: var(--ff-text-muted);
    opacity: 0.4;
}

.ff-card-topic__title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.ff-card-topic__title a {
    color: var(--ff-text);
    text-decoration: none;
}
.ff-card-topic__title a:hover {
    color: var(--ff-primary);
}

.ff-icon-pin {
    color: var(--ff-primary);
    vertical-align: middle;
    margin-right: 4px;
}

.ff-card-topic__excerpt {
    font-size: 0.85rem;
    color: var(--ff-text-secondary);
    line-height: 1.5;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ff-card-topic__link-domain {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--ff-info);
    text-decoration: none;
}
.ff-card-topic__link-domain:hover {
    text-decoration: underline;
}

.ff-card-topic__thumb {
    margin-bottom: 8px;
    border-radius: var(--ff-radius-sm);
    overflow: hidden;
    max-height: 300px;
}
.ff-card-topic__thumb img {
    width: 100%;
    height: auto;
    object-fit: cover;
}

.ff-card-topic__footer {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ff-card-topic__action {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--ff-radius-sm);
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--ff-text-muted);
    text-decoration: none;
    transition: all var(--ff-transition);
    border: none;
    background: none;
    cursor: pointer;
}
.ff-card-topic__action:hover {
    background: var(--ff-bg-hover);
    color: var(--ff-text-secondary);
}

/* --- Vote Buttons --- */
.ff-vote-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--ff-radius-sm);
    color: var(--ff-text-muted);
    transition: all var(--ff-transition);
    cursor: pointer;
}
.ff-vote-btn:hover {
    background: var(--ff-bg-hover);
}

.ff-vote-btn--up:hover,
.ff-vote-btn--up.ff-vote-btn--active {
    color: var(--ff-upvote);
    background: rgba(249, 115, 22, 0.1);
}

.ff-vote-btn--down:hover,
.ff-vote-btn--down.ff-vote-btn--active {
    color: var(--ff-downvote);
    background: rgba(139, 92, 246, 0.1);
}

.ff-vote-count {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--ff-text);
    text-align: center;
    min-width: 28px;
    user-select: none;
}

.ff-vote-count--lg {
    font-size: 1rem;
}

/* --- Badges --- */
.ff-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--ff-radius-full);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    vertical-align: middle;
    margin-left: 6px;
}

.ff-badge--op {
    background: var(--ff-primary-light);
    color: var(--ff-primary);
}

.ff-badge--question {
    background: rgba(59, 130, 246, 0.12);
    color: var(--ff-info);
}

.ff-badge--link {
    background: rgba(34, 197, 94, 0.12);
    color: var(--ff-success);
}

.ff-badge--media {
    background: rgba(245, 158, 11, 0.12);
    color: var(--ff-warning);
}

.ff-badge--poll {
    background: rgba(139, 92, 246, 0.12);
    color: var(--ff-downvote);
}

.ff-badge--resolved {
    background: rgba(34, 197, 94, 0.12);
    color: var(--ff-success);
}

.ff-badge--locked {
    background: rgba(239, 68, 68, 0.12);
    color: var(--ff-danger);
}

.ff-badge--role {
    background: var(--ff-primary-light);
    color: var(--ff-primary);
}

/* --- Section Link (in topic meta) --- */
.ff-section-link {
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--section-color, var(--ff-primary));
    text-decoration: none;
}
.ff-section-link:hover {
    text-decoration: underline;
    color: var(--section-color, var(--ff-primary));
}

/* --- Tags --- */
.ff-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--ff-radius-full);
    background: var(--ff-bg);
    border: 1px solid var(--ff-border);
    font-size: 0.75rem;
    color: var(--ff-text-secondary);
    text-decoration: none;
    transition: all var(--ff-transition);
}
.ff-tag:hover {
    border-color: var(--ff-primary);
    color: var(--ff-primary);
    background: var(--ff-primary-ghost);
}

/* --- Single Topic Detail --- */
.ff-topic-detail {
    background: var(--ff-bg-raised);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    overflow: hidden;
}

.ff-topic-detail__header {
    padding: 16px 20px 0;
}

.ff-topic-detail__meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--ff-text-muted);
    margin-bottom: 8px;
}

.ff-topic-detail__meta a {
    color: var(--ff-text-secondary);
    font-weight: 500;
}
.ff-topic-detail__meta a:hover {
    color: var(--ff-text);
}

.ff-topic-detail__dot {
    opacity: 0.4;
}

.ff-topic-detail__title {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.ff-topic-detail__body {
    display: flex;
    gap: 0;
}

.ff-topic-detail__vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 16px 12px;
}

.ff-topic-detail__content-area {
    flex: 1;
    padding: 12px 20px 20px 8px;
    min-width: 0;
}

.ff-topic-detail__link-preview {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--ff-bg);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius-sm);
    color: var(--ff-info);
    font-size: 0.85rem;
    margin-bottom: 12px;
    text-decoration: none;
    transition: all var(--ff-transition);
}
.ff-topic-detail__link-preview:hover {
    border-color: var(--ff-info);
    background: rgba(59, 130, 246, 0.05);
}

.ff-topic-detail__image {
    border-radius: var(--ff-radius-sm);
    overflow: hidden;
    margin-bottom: 16px;
}
.ff-topic-detail__image img {
    max-height: 500px;
    width: 100%;
    object-fit: contain;
    background: var(--ff-bg);
}

.ff-topic-detail__content {
    margin-bottom: 16px;
}

.ff-topic-detail__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.ff-topic-detail__actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-top: 12px;
    border-top: 1px solid var(--ff-border-light);
}

.ff-topic-detail__action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: var(--ff-radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--ff-text-muted);
    transition: all var(--ff-transition);
    cursor: pointer;
    border: none;
    background: none;
}
.ff-topic-detail__action:hover {
    background: var(--ff-bg-hover);
    color: var(--ff-text-secondary);
}
.ff-topic-detail__action--danger:hover {
    color: var(--ff-danger);
    background: rgba(239, 68, 68, 0.08);
}

/* --- Comments Section --- */
.ff-topic-detail__comments {
    padding: 20px;
    border-top: 1px solid var(--ff-border);
}

.ff-comments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.ff-comments-header__title {
    font-size: 1rem;
    font-weight: 600;
}

/* --- Comment --- */
.ff-comment {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid var(--ff-border-light);
}
.ff-comment:last-child {
    border-bottom: none;
}
/* Comment inner wrapper - contains vote + body, nested comments sit outside */
.ff-comment__inner {
    display: flex;
    gap: 0;
}


.ff-comment--nested {
    margin-left: 24px;
    padding-left: 16px;
    border-left: 2px solid var(--ff-border);
    border-bottom: none;
}

.ff-comment__vote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding-right: 8px;
    flex-shrink: 0;
}

.ff-comment__body {
    flex: 1;
    min-width: 0;
}

.ff-comment__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.ff-comment__author {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ff-comment__author-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ff-text);
    text-decoration: none;
}
.ff-comment__author-name:hover {
    color: var(--ff-primary);
}

.ff-comment__time {
    font-size: 0.75rem;
    color: var(--ff-text-muted);
}

.ff-comment__content {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--ff-text-secondary);
}
.ff-comment__content p {
    margin-bottom: 8px;
}
.ff-comment__content p:last-child {
    margin-bottom: 0;
}

.ff-comment__actions {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 6px;
}

.ff-comment__action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--ff-radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ff-text-muted);
    transition: all var(--ff-transition);
    cursor: pointer;
    background: none;
    border: none;
}
.ff-comment__action:hover {
    background: var(--ff-bg-hover);
    color: var(--ff-text-secondary);
}
.ff-comment__action--delete:hover {
    color: var(--ff-danger);
}

/* --- Reply Composer --- */
.ff-reply-composer {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--ff-bg);
    border-radius: var(--ff-radius);
    border: 1px solid var(--ff-border);
}

.ff-reply-composer__input-area {
    flex: 1;
}

.ff-reply-composer__input {
    width: 100%;
    background: var(--ff-bg-raised);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius-sm);
    padding: 10px 14px;
    color: var(--ff-text);
    resize: vertical;
    min-height: 60px;
    outline: none;
    transition: border-color var(--ff-transition);
    font-size: 0.9rem;
    line-height: 1.5;
}
.ff-reply-composer__input:focus {
    border-color: var(--ff-primary);
}
.ff-reply-composer__input::placeholder {
    color: var(--ff-text-muted);
}

.ff-reply-composer__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
}

/* Inline reply form (threaded) */
.ff-reply-form-container {
    margin-top: 8px;
    padding: 12px;
    background: var(--ff-bg);
    border-radius: var(--ff-radius-sm);
    border: 1px solid var(--ff-border);
}

.ff-reply-input {
    width: 100%;
    background: var(--ff-bg-raised);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius-sm);
    padding: 8px 12px;
    color: var(--ff-text);
    resize: vertical;
    min-height: 60px;
    outline: none;
    font-size: 0.85rem;
    line-height: 1.5;
}
.ff-reply-input:focus {
    border-color: var(--ff-primary);
}
.ff-reply-input::placeholder {
    color: var(--ff-text-muted);
}

.ff-reply-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}

/* --- Locked / Login Prompt --- */
.ff-locked-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--ff-bg);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius-sm);
    font-size: 0.85rem;
    color: var(--ff-text-muted);
    margin-bottom: 20px;
}

.ff-login-prompt {
    padding: 20px;
    background: var(--ff-bg);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius-sm);
    text-align: center;
    margin-bottom: 20px;
}
.ff-login-prompt p {
    margin-bottom: 12px;
    color: var(--ff-text-secondary);
}

/* --- Page Header --- */
.ff-page-header {
    margin-bottom: 16px;
}

.ff-page-header__title {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.ff-page-header__count {
    font-size: 0.85rem;
    color: var(--ff-text-muted);
    margin-top: 4px;
}

/* --- Section Header (taxonomy archive) --- */
.ff-section-header {
    background: var(--ff-bg-raised);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    overflow: hidden;
    margin-bottom: 20px;
}

.ff-section-header__banner {
    height: 180px;
    background: linear-gradient(135deg, var(--section-color, var(--ff-primary)), color-mix(in srgb, var(--section-color, var(--ff-primary)) 60%, black));
    background-size: cover;
    background-position: center;
}

.ff-section-header__info {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
}

.ff-section-header__icon-wrap {
    width: 72px;
    height: 72px;
    background: var(--ff-bg-raised);
    border: 4px solid var(--ff-bg-raised);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -36px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    overflow: hidden;
}

.ff-section-header__icon {
    font-size: 1.6rem;
}

.ff-section-header__text {
    flex: 1;
    min-width: 0;
}

.ff-section-header__title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.ff-section-header__desc {
    font-size: 0.85rem;
    color: var(--ff-text-secondary);
    margin-top: 4px;
    line-height: 1.5;
}

.ff-section-header__stats {
    font-size: 0.8rem;
    color: var(--ff-text-muted);
    margin-top: 6px;
}

/* --- Section About (sidebar in section pages) --- */
.ff-section-about__desc {
    font-size: 0.85rem;
    color: var(--ff-text-secondary);
    margin-bottom: 16px;
}

.ff-section-about__stat {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}
.ff-section-about__stat-num {
    font-size: 1.3rem;
    font-weight: 700;
}
.ff-section-about__stat-label {
    font-size: 0.75rem;
    color: var(--ff-text-muted);
}

/* Rules */
.ff-rules-list {
    list-style: decimal;
    padding-left: 20px;
}
.ff-rules-list__item {
    font-size: 0.85rem;
    color: var(--ff-text-secondary);
    padding: 8px 0;
    border-bottom: 1px solid var(--ff-border-light);
}
.ff-rules-list__item:last-child {
    border-bottom: none;
}
.ff-rules-list__item strong {
    color: var(--ff-text);
    display: block;
}
.ff-rules-list__item p {
    margin-top: 2px;
    font-size: 0.8rem;
    color: var(--ff-text-muted);
}

/* --- Profile --- */
.ff-profile-header {
    background: var(--ff-bg-raised);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.ff-profile-header__banner {
    height: 140px;
    background-size: cover;
    background-position: center;
}
.ff-profile-header__banner--default {
    background: linear-gradient(135deg, var(--ff-primary), #8b5cf6);
}

.ff-profile-header__info {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 0 24px;
    margin-top: -32px;
}

.ff-profile-header__avatar-wrap {
    flex-shrink: 0;
}

.ff-avatar--lg {
    width: 96px !important;
    height: 96px !important;
    border-radius: 50% !important;
    border: 4px solid var(--ff-bg-raised) !important;
}

.ff-profile-header__details {
    flex: 1;
    min-width: 0;
    padding-top: 40px;
}

.ff-profile-header__name-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ff-profile-header__name {
    font-size: 1.3rem;
    font-weight: 700;
}

.ff-profile-header__username {
    font-size: 0.85rem;
    color: var(--ff-text-muted);
}

.ff-profile-header__bio {
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--ff-text-secondary);
    line-height: 1.5;
}

.ff-profile-header__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
}

.ff-profile-header__meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.8rem;
    color: var(--ff-text-muted);
}

.ff-profile-header__meta-item--link {
    color: var(--ff-primary);
    text-decoration: none;
}

.ff-profile-header__stats {
    display: flex;
    gap: 32px;
    padding: 16px 24px;
    border-top: 1px solid var(--ff-border);
    margin-top: 16px;
}

.ff-profile-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.ff-profile-stat__num {
    font-size: 1.2rem;
    font-weight: 700;
}
.ff-profile-stat__label {
    font-size: 0.75rem;
    color: var(--ff-text-muted);
}

/* --- Modal --- */
.ff-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 20px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--ff-transition-slow);
}
.ff-modal--open {
    opacity: 1;
    visibility: visible;
}

.ff-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.ff-modal__container {
    position: relative;
    width: 100%;
    max-width: 640px;
    max-height: calc(100vh - 120px);
    background: var(--ff-bg-raised);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius-lg);
    box-shadow: var(--ff-shadow-xl);
    overflow-y: auto;
    transform: translateY(16px) scale(0.97);
    transition: transform var(--ff-transition-slow);
}
.ff-modal--open .ff-modal__container {
    transform: translateY(0) scale(1);
}

.ff-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--ff-border);
}

.ff-modal__title {
    font-size: 1.1rem;
    font-weight: 600;
}

.ff-modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--ff-radius-sm);
    color: var(--ff-text-muted);
    transition: all var(--ff-transition);
}
.ff-modal__close:hover {
    background: var(--ff-bg-hover);
    color: var(--ff-text);
}

.ff-modal__form {
    padding: 24px;
}

.ff-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    border-top: 1px solid var(--ff-border);
    margin-top: 20px;
}

/* --- Form Elements --- */
.ff-form-row--inline {
    display: flex;
    gap: 12px;
}
.ff-form-row--inline > .ff-form-group {
    flex: 1;
}

.ff-form-group {
    margin-bottom: 16px;
}

.ff-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ff-text-secondary);
    margin-bottom: 6px;
}

.ff-input,
.ff-select,
.ff-textarea {
    width: 100%;
    background: var(--ff-bg);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius-sm);
    padding: 10px 14px;
    color: var(--ff-text);
    outline: none;
    transition: all var(--ff-transition);
    font-size: 0.9rem;
}
.ff-input:focus,
.ff-select:focus,
.ff-textarea:focus {
    border-color: var(--ff-primary);
    box-shadow: 0 0 0 3px var(--ff-primary-light);
}
.ff-input::placeholder,
.ff-textarea::placeholder {
    color: var(--ff-text-muted);
}

.ff-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.ff-textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.ff-char-count {
    display: block;
    text-align: right;
    font-size: 0.72rem;
    color: var(--ff-text-muted);
    margin-top: 4px;
}

/* --- Avatar --- */
.ff-avatar {
    border-radius: 50% !important;
    object-fit: cover;
}
.ff-avatar--xs {
    width: 24px !important;
    height: 24px !important;
}
.ff-avatar--sm {
    width: 32px !important;
    height: 32px !important;
}

/* --- Spinner --- */
.ff-spinner {
    animation: ff-spin 0.8s linear infinite;
}
@keyframes ff-spin {
    to { transform: rotate(360deg); }
}

/* --- Empty State --- */
.ff-empty-state {
    text-align: center;
    padding: 60px 20px;
}
.ff-empty-state__icon {
    color: var(--ff-text-muted);
    margin-bottom: 16px;
    opacity: 0.4;
}
.ff-empty-state h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}
.ff-empty-state p {
    color: var(--ff-text-muted);
    margin-bottom: 20px;
}
.ff-empty-state--404 .ff-empty-state__code {
    font-size: 5rem;
    font-weight: 800;
    color: var(--ff-primary);
    opacity: 0.3;
    line-height: 1;
    margin-bottom: 12px;
}

/* --- Pagination --- */
.ff-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 24px 0;
}
.ff-pagination a,
.ff-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--ff-radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ff-text-secondary);
    text-decoration: none;
    transition: all var(--ff-transition);
}
.ff-pagination a:hover {
    background: var(--ff-bg-hover);
    color: var(--ff-text);
}
.ff-pagination .current {
    background: var(--ff-primary);
    color: #fff;
}

/* --- Prose (content) --- */
.ff-prose {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--ff-text-secondary);
}
.ff-prose h2, .ff-prose h3, .ff-prose h4 {
    color: var(--ff-text);
    font-weight: 600;
    margin: 1.5em 0 0.5em;
}
.ff-prose h2 { font-size: 1.3rem; }
.ff-prose h3 { font-size: 1.1rem; }
.ff-prose p { margin-bottom: 1em; }
.ff-prose ul, .ff-prose ol {
    padding-left: 1.5em;
    margin-bottom: 1em;
}
.ff-prose li { margin-bottom: 0.3em; }
.ff-prose blockquote {
    border-left: 3px solid var(--ff-primary);
    padding: 8px 16px;
    margin: 1em 0;
    background: var(--ff-bg);
    border-radius: 0 var(--ff-radius-sm) var(--ff-radius-sm) 0;
    color: var(--ff-text-secondary);
}
.ff-prose code {
    font-family: var(--ff-font-mono);
    background: var(--ff-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.88em;
}
.ff-prose pre {
    background: var(--ff-bg);
    padding: 16px;
    border-radius: var(--ff-radius-sm);
    overflow-x: auto;
    margin-bottom: 1em;
    border: 1px solid var(--ff-border);
}
.ff-prose pre code {
    background: none;
    padding: 0;
}
.ff-prose img {
    border-radius: var(--ff-radius-sm);
    margin: 1em 0;
}
.ff-prose a {
    color: var(--ff-primary);
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* --- Hero (ACF) --- */
.ff-hero {
    position: relative;
    padding: 60px 40px;
    background: linear-gradient(135deg, var(--ff-primary), #8b5cf6);
    border-radius: var(--ff-radius-lg);
    margin-bottom: 24px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}
.ff-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    pointer-events: none;
}
.ff-hero__content {
    position: relative;
    z-index: 1;
}
.ff-hero__title {
    font-size: 2rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
    letter-spacing: -0.03em;
}
.ff-hero__subtitle {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 20px;
}

/* --- Featured Sections Grid (ACF) --- */
.ff-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.ff-featured-sections {
    margin-bottom: 24px;
}

.ff-featured-sections__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.ff-section-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 20px 16px;
    background: var(--ff-bg-raised);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    text-decoration: none;
    transition: all var(--ff-transition);
    text-align: center;
}
.ff-section-card:hover {
    border-color: var(--section-color, var(--ff-primary));
    transform: translateY(-2px);
    box-shadow: var(--ff-shadow);
}

.ff-section-card__icon {
    font-size: 1.8rem;
}

.ff-section-card__name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ff-text);
}

.ff-section-card__count {
    font-size: 0.75rem;
    color: var(--ff-text-muted);
}

/* --- Trending (ACF) --- */
.ff-trending {
    margin-bottom: 24px;
}

.ff-trending__list {
    background: var(--ff-bg-raised);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    overflow: hidden;
}

.ff-trending__item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 16px;
    text-decoration: none;
    border-bottom: 1px solid var(--ff-border-light);
    transition: background var(--ff-transition);
}
.ff-trending__item:last-child {
    border-bottom: none;
}
.ff-trending__item:hover {
    background: var(--ff-bg-hover);
}

.ff-trending__rank {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--ff-primary);
    min-width: 24px;
    text-align: center;
}

.ff-trending__info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ff-trending__title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--ff-text);
    line-height: 1.3;
}

.ff-trending__meta {
    font-size: 0.75rem;
    color: var(--ff-text-muted);
}

/* --- Stats Bar (ACF) --- */
.ff-stats-bar {
    display: flex;
    gap: 32px;
    padding: 24px;
    background: var(--ff-bg-raised);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    margin-bottom: 24px;
    justify-content: center;
}

.ff-stats-bar__item {
    text-align: center;
}

.ff-stats-bar__num {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--ff-primary);
}

.ff-stats-bar__label {
    font-size: 0.8rem;
    color: var(--ff-text-muted);
}

/* --- Custom Block (ACF) --- */
.ff-custom-block {
    padding: 24px;
    border-radius: var(--ff-radius);
    margin-bottom: 24px;
}

/* --- Footer --- */
.ff-footer {
    padding: 24px;
    margin-left: var(--ff-sidebar-w);
    border-top: 1px solid var(--ff-border);
}

.ff-footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    font-size: 0.8rem;
    color: var(--ff-text-muted);
}

.ff-footer__links {
    display: flex;
    gap: 16px;
    list-style: none;
}
.ff-footer__links a {
    color: var(--ff-text-muted);
    text-decoration: none;
}
.ff-footer__links a:hover {
    color: var(--ff-text);
}

/* --- Widget --- */
.ff-widget {
    background: var(--ff-bg-raised);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    padding: 16px;
    margin-bottom: 16px;
}
.ff-widget__title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ff-border);
}

/* --- Toast Notifications --- */
.ff-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--ff-bg-overlay);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    box-shadow: var(--ff-shadow-lg);
    font-size: 0.875rem;
    color: var(--ff-text);
    transform: translateY(20px);
    opacity: 0;
    transition: all var(--ff-transition-slow);
    pointer-events: none;
}
.ff-toast--visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}
.ff-toast--success {
    border-left: 3px solid var(--ff-success);
}
.ff-toast--error {
    border-left: 3px solid var(--ff-danger);
}

/* --- Responsive --- */
@media (max-width: 1280px) {
    .ff-sidebar-right {
        display: none;
    }
    .ff-main {
        margin-right: 0;
    }
}

@media (max-width: 900px) {
    .ff-sidebar {
        transform: translateX(-100%);
    }
    .ff-sidebar--open {
        transform: translateX(0);
        box-shadow: var(--ff-shadow-xl);
    }
    .ff-main {
        margin-left: 0;
    }
    .ff-header__menu-toggle {
        display: flex;
    }
    .ff-footer {
        margin-left: 0;
    }
    .ff-content-wrapper {
        padding: 16px;
    }
    .ff-header__center {
        display: none;
    }
    .ff-user-menu__name {
        display: none;
    }
}

@media (max-width: 600px) {
    html {
        font-size: 14px;
    }
    .ff-card-topic__vote {
        padding: 8px 6px;
        min-width: 40px;
    }
    .ff-topic-detail__title {
        font-size: 1.2rem;
    }
    .ff-hero {
        padding: 40px 20px;
    }
    .ff-hero__title {
        font-size: 1.5rem;
    }
    .ff-profile-header__info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .ff-profile-header__details {
        padding-top: 10px;
    }
    .ff-profile-header__meta {
        justify-content: center;
    }
    .ff-profile-header__stats {
        justify-content: center;
    }
    .ff-section-header__info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .ff-form-row--inline {
        flex-direction: column;
    }
    .ff-modal__container {
        max-height: 90vh;
    }
    .ff-modal {
        padding: 20px 12px;
    }
}

/* --- Utility: Overlay when sidebar is open on mobile --- */
.ff-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: all var(--ff-transition-slow);
}
.ff-overlay--visible {
    opacity: 1;
    visibility: visible;
}

/* --- WordPress Core Overrides --- */
.wp-caption {
    max-width: 100%;
}
.aligncenter {
    display: block;
    margin: 0 auto;
}
.alignleft {
    float: left;
    margin-right: 1em;
}
.alignright {
    float: right;
    margin-left: 1em;
}
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
}

/* ============================================================
   AUTH PAGES (Login / Register)
   ============================================================ */
.ff-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
    background: var(--ff-bg);
}

.ff-auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--ff-bg-raised);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius-lg);
    padding: 40px 36px;
}

.ff-auth-card__logo {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
}

.ff-auth-card__logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ff-primary);
    text-decoration: none;
}

.ff-auth-card__title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--ff-text);
    text-align: center;
    margin: 0 0 6px;
}

.ff-auth-card__subtitle {
    font-size: 0.875rem;
    color: var(--ff-text-secondary);
    text-align: center;
    margin: 0 0 24px;
}

.ff-auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ff-auth-card__switch {
    margin: 20px 0 0;
    text-align: center;
    font-size: 0.875rem;
    color: var(--ff-text-secondary);
}

.ff-auth-card__switch a {
    color: var(--ff-primary);
    font-weight: 500;
}

/* Alert */
.ff-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--ff-radius-sm);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.ff-alert--error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.ff-alert--success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #86efac;
}

.ff-alert__list {
    margin: 0;
    padding-left: 16px;
}

/* Label with link */
.ff-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ff-label__link {
    font-size: 0.8rem;
    color: var(--ff-primary);
    font-weight: 400;
}

/* Password toggle */
.ff-input-wrap {
    position: relative;
}

.ff-input-wrap .ff-input {
    padding-right: 44px;
}

.ff-input-wrap__toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--ff-text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--ff-transition);
}

.ff-input-wrap__toggle:hover {
    color: var(--ff-text);
}

/* Checkbox */
.ff-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--ff-text-secondary);
}

.ff-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--ff-primary);
    cursor: pointer;
}

/* Form hint */
.ff-form-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--ff-text-muted);
    margin-top: 4px;
}

/* ============================================================
   NOTIFICATIONS DROPDOWN
   ============================================================ */
.ff-notifications {
    position: relative;
}

.ff-notifications__trigger {
    position: relative;
    background: none;
    border: none;
    color: var(--ff-text-secondary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--ff-radius-sm);
    transition: color var(--ff-transition), background var(--ff-transition);
}

.ff-notifications__trigger:hover {
    color: var(--ff-text);
    background: var(--ff-bg-hover);
}

.ff-notifications__badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--ff-danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: var(--ff-radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.ff-notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    background: var(--ff-bg-overlay);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius-lg);
    box-shadow: var(--ff-shadow-lg);
    z-index: 200;
    overflow: hidden;
    max-height: 480px;
    overflow-y: auto;
}

.ff-notif-dropdown__header {
    padding: 12px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ff-text-muted);
    border-bottom: 1px solid var(--ff-border);
}

.ff-notif-dropdown__loading,
.ff-notif-dropdown__empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--ff-text-muted);
    font-size: 0.875rem;
}

.ff-notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ff-border-light);
    text-decoration: none;
    color: var(--ff-text);
    transition: background var(--ff-transition);
}

.ff-notif-item:hover {
    background: var(--ff-bg-hover);
}

.ff-notif-item--read {
    opacity: 0.65;
}

.ff-notif-item__body {
    flex: 1;
    min-width: 0;
}

.ff-notif-item__text {
    font-size: 0.875rem;
    color: var(--ff-text);
    margin: 0 0 2px;
}

.ff-notif-item__topic {
    display: block;
    font-size: 0.8rem;
    color: var(--ff-text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ff-notif-item__time {
    display: block;
    font-size: 0.75rem;
    color: var(--ff-text-muted);
    margin-top: 2px;
}

/* ============================================================
   SINGLE TOPIC — AUTHOR CARD & RELATED SIDEBAR
   ============================================================ */
.ff-author-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.ff-author-card__avatar-link {
    flex-shrink: 0;
}

.ff-author-card__name {
    display: block;
    font-weight: 600;
    color: var(--ff-text);
    text-decoration: none;
    font-size: 0.9rem;
}

.ff-author-card__name:hover {
    color: var(--ff-primary);
}

.ff-author-card__role {
    font-size: 0.78rem;
    color: var(--ff-text-muted);
}

.ff-author-card__stats {
    display: flex;
    gap: 20px;
    margin-bottom: 14px;
}

.ff-author-card__stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ff-author-card__stat-num {
    font-size: 1rem;
    font-weight: 700;
    color: var(--ff-text);
}

.ff-author-card__stat-label {
    font-size: 0.75rem;
    color: var(--ff-text-muted);
}

/* Section card header variant */
.ff-card__header--section {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(var(--section-color, 99, 102, 241), 0.1) !important;
    border-bottom: 1px solid var(--ff-border) !important;
}

.ff-card__header-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* Related items in sidebar */
.ff-related-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--ff-border-light);
    text-decoration: none;
    transition: background var(--ff-transition);
}

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

.ff-related-item:hover {
    background: var(--ff-bg-hover);
}

.ff-related-item__title {
    font-size: 0.85rem;
    color: var(--ff-text);
    line-height: 1.4;
    flex: 1;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ff-related-item__meta {
    font-size: 0.75rem;
    color: var(--ff-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================================
   LOAD MORE BUTTON
   ============================================================ */
.ff-load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.ff-load-more {
    min-width: 160px;
}

/* Spinner animation */
@keyframes ff-spin {
    to { transform: rotate(360deg); }
}

.ff-spin {
    animation: ff-spin 0.8s linear infinite;
}


/* Clickable topic cards - full card is clickable */
.ff-card-topic {
    position: relative;
    cursor: pointer;
}
.ff-card-topic__title a::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}
.ff-vote-btn,
.ff-card-topic__action,
.ff-share-btn,
.ff-card-topic__meta a,
.ff-card-topic__link-domain {
    position: relative;
    z-index: 2;
}
