/* Community Premium Styles v3.0 */

:root {
    --comm-primary: #4f46e5;
    --comm-primary-hover: #4338ca;
    --comm-bg-page: #f8fafc;
    --comm-bg-card: #ffffff;
    --comm-text-main: #1e293b;
    --comm-text-sub: #64748b;
    --comm-border: #e2e8f0;
    --comm-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --comm-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --comm-radius-lg: 16px;
    --comm-radius-md: 12px;
}

body {
    background-color: var(--comm-bg-page);
    color: var(--comm-text-main);
}

/* =====================
   Layout & Grid
   ===================== */
.community-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    align-items: start;
}

.community-main {
    min-width: 0;
    /* Prevent grid blowout */
}

.community-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* =====================
   Category Tabs (Pill Style)
   ===================== */
.community-tabs-wrapper {
    position: sticky;
    top: 50px;
    z-index: 20;
    background: var(--comm-bg-card);
    /* Distinct background for separation */
    padding: 0.75rem 0.5rem;
    /* Added side padding for better aesthetics on white */
    margin: 0 -0.75rem 1rem -0.75rem;
    /* Negative margin to pull it to edges of grid column if needed, or just stay within */
    /* Actually, better to just keep it simple first */
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--comm-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    /* Subtle shadow for depth */
}

.community-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
}

.community-tabs::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar Chrome/Safari */

.community-tab {
    background: var(--comm-bg-card);
    border: 1px solid var(--comm-border);
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--comm-text-sub);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.community-tab:hover {
    background: #f1f5f9;
    color: var(--comm-text-main);
}

.community-tab.active {
    background: var(--comm-text-main);
    color: white;
    border-color: var(--comm-text-main);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* =====================
   Feed Cards
   ===================== */
.feed-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feed-card {
    background: var(--comm-bg-card);
    border-radius: var(--comm-radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--comm-border);
    box-shadow: var(--comm-shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    display: block;
    color: inherit;
    position: relative;
    overflow: hidden;
}

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

.feed-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.feed-badges {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* User Info (Restored for Feed List) */
.feed-user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feed-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
    flex-shrink: 0;
}

.feed-avatar.color-2 {
    background: linear-gradient(135deg, #3b82f6 0%, #14b8a6 100%);
}

.feed-avatar.color-3 {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
}

.feed-meta-col {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.3;
}

.feed-author {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--comm-text-main);
}

.feed-time {
    font-size: 0.75rem;
    color: var(--comm-text-sub);
}

.feed-category-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--comm-primary);
    background: rgba(79, 70, 229, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
}

.feed-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--comm-text-main);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.feed-preview {
    font-size: 0.95rem;
    color: var(--comm-text-sub);
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f1f5f9;
    padding-top: 1rem;
    margin-top: auto;
    /* Push to bottom if flex column */
}

.feed-actions {
    display: flex;
    gap: 0.8rem;
}

.action-pill {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--comm-text-sub);
    font-weight: 500;
}

.action-pill.active {
    color: var(--comm-primary);
}

.icon {
    font-style: normal;
    display: inline-block;
    filter: grayscale(1);
    opacity: 0.7;
    transition: 0.2s;
}

.feed-card:hover .icon {
    filter: grayscale(0);
    opacity: 1;
}


/* =====================
   Sidebar Widgets
   ===================== */
.sidebar-widget {
    background: var(--comm-bg-card);
    border-radius: var(--comm-radius-lg);
    padding: 1.25rem;
    border: 1px solid var(--comm-border);
    box-shadow: var(--comm-shadow);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.widget-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--comm-text-main);
}

.widget-more {
    font-size: 0.8rem;
    color: var(--comm-text-sub);
    text-decoration: none;
}

.widget-more:hover {
    color: var(--comm-primary);
}

/* Write Widget */
.write-widget {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    text-align: center;
}

.btn-write-full {
    width: 100%;
    background: var(--comm-text-main);
    /* Dark theme button */
    color: white;
    border: none;
    padding: 0.8rem;
    border-radius: var(--comm-radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-write-full:hover {
    transform: translateY(-2px);
    background: #0f172a;
    box-shadow: 0 8px 12px -1px rgba(0, 0, 0, 0.15);
}

.write-help {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--comm-text-sub);
}

/* Notice Widget */
.pinned-notice-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-radius: var(--comm-radius-md);
    text-decoration: none;
    color: #92400e;
    transition: background 0.2s;
}

.pinned-notice-item:hover {
    background: #fef3c7;
}

.pinned-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.pinned-date {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Top 3 Widget */
.top3-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Legacy Top 3 Styles (removed) */

/* Rank Colors - preserved if needed for reference, but legacy classes removed */

/* =====================
   Empty State
   ===================== */
.feed-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--comm-text-sub);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}


/* =====================
   Animations & Coming Soon
   ===================== */
.community-animate {
    opacity: 0;
    animation: fadeUp 0.6s ease-out forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.coming-soon {
    /* Optional: visual cue for non-functional items */
    cursor: not-allowed !important;
    opacity: 0.8;
}

/* =====================
   Responsive
   ===================== */
.writer-fab.mobile-only {
    display: none;
}

/* Mobile Widgets Area (Hidden by default on Desktop) */
.mobile-widgets-area {
    display: none;
    flex-direction: column;
    gap: 0;
    margin-bottom: 1.5rem;
    padding: 0 0 1.5rem 0;
    border-bottom: 1px solid var(--comm-border);
}

.mobile-notice {
    padding-bottom: 1.5rem;
}

.mobile-top3 {
    padding-top: 1.5rem;
    border-top: 1px solid var(--comm-border);
}

/* Mobile Widget Styling */
.mobile-widget .sidebar-widget {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 0;
}

.mobile-widget .widget-header {
    margin-bottom: 0.5rem;
}

@media (max-width: 992px) {
    .community-layout {
        grid-template-columns: 1fr;
        /* Stack sidebar below or hide */
    }

    .community-sidebar {
        display: none;
        /* Hide Desktop Sidebar on Mobile */
    }

    .mobile-widgets-area {
        display: flex;
        /* Show Mobile Widgets */
    }

    /* Hide Desktop Write Button on Mobile */
    .write-widget {
        display: none;
    }

    /* Re-enable FAB for mobile since Sidebar is hidden */
    .writer-fab.mobile-only {
        display: flex;
        position: fixed;
        bottom: 2rem;
        right: 2rem;
        width: 56px;
        height: 56px;
        background: var(--comm-text-main);
        color: white;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        z-index: 100;
        border: none;
    }
}

/* Top 3 Card Styling (Mobile & Desktop) */
.top3-card-mobile,
.top3-card-desktop {
    padding: 1rem;
    background: #ffffff;
    border: 1px solid var(--comm-border);
}

.top3-card-mobile .feed-footer,
.top3-card-desktop .feed-footer {
    justify-content: flex-end;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 800;
    color: white;
    background: #94a3b8;
}

.rank-badge.rank-1 {
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    box-shadow: 0 2px 5px rgba(251, 191, 36, 0.3);
}

.rank-badge.rank-2 {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
}

.rank-badge.rank-3 {
    background: linear-gradient(135deg, #b45309 0%, #78350f 100%);
}

@media (max-width: 576px) {
    .feed-card {
        padding: 1.25rem;
    }
}