/* Community Feed Styles */
.community-layout {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto; /* Margin atas dihapus agar tidak bertumpuk dengan padding */
    padding: 0 30px 100px;
    align-items: flex-start; /* Penting untuk fitur sticky */
}

/* Sidebar Tags */
.community-sidebar {
    position: sticky;
    top: 100px; /* Posisi pas di bawah navbar */
    height: fit-content;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    z-index: 10;
}

.sidebar-title {
    font-weight: 700;
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: var(--text-main);
}

.tag-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tag-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}

.tag-item:hover, .tag-item.active {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.tag-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* Accent Colors */
.tag-loker .tag-icon { background: #ff4d4d; box-shadow: 0 0 10px #ff4d4d; }
.tag-apply .tag-icon { background: #2ecc71; box-shadow: 0 0 10px #2ecc71; }
.tag-beasiswa .tag-icon { background: #f1c40f; box-shadow: 0 0 10px #f1c40f; }
.tag-tanya .tag-icon { background: #3498db; box-shadow: 0 0 10px #3498db; }
.tag-curhat .tag-icon { background: #9b59b6; box-shadow: 0 0 10px #9b59b6; }

/* Post Input */
.post-input-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 30px;
}

.post-input-area {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1.1rem;
    resize: none;
    outline: none;
    min-height: 80px;
}

.post-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

/* Feed Cards */
.post-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    margin-bottom: 20px;
    transition: var(--transition);
    animation: fadeIn 0.5s ease forwards;
}

.post-card:hover { border-color: rgba(178, 6, 6, 0.4); }

.post-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.user-meta h4 { font-size: 1rem; margin-bottom: 2px; }
.user-meta span { font-size: 0.8rem; color: var(--text-muted); }

.post-content {
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 18px;
    color: #e4e6eb;
}

.post-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.post-tag.loker { background: rgba(255, 77, 77, 0.15); color: #ff4d4d; }
.post-tag.apply { background: rgba(46, 204, 113, 0.15); color: #2ecc71; }
.post-tag.beasiswa { background: rgba(241, 196, 15, 0.15); color: #f1c40f; }
.post-tag.tanya { background: rgba(52, 152, 219, 0.15); color: #3498db; }
.post-tag.curhat { background: rgba(155, 89, 182, 0.15); color: #9b59b6; }

.post-footer {
    display: flex;
    gap: 20px;
    border-top: 1px solid var(--border);
    padding-top: 15px;
}

.action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 6px 14px;
    border-radius: 50px;
    transition: all 0.25s ease;
}

.action-btn .like-icon,
.action-btn .comment-icon {
    font-size: 1.4rem;
    line-height: 1;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block;
}

.action-btn:hover {
    background: rgba(255,255,255,0.06);
    color: var(--text-main);
}

.action-btn:hover .like-icon,
.action-btn:hover .comment-icon {
    transform: scale(1.3) translateY(-2px);
}

.action-btn.liked {
    color: #ff4d4d;
}

.action-btn.liked .like-icon {
    animation: firePop 0.4s ease;
}

@keyframes firePop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.5) translateY(-4px); }
    100% { transform: scale(1.1); }
}

.btn-send-comment {
    background: transparent !important;
    color: #b20606 !important;
    border: none !important;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    min-width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: none !important;
}

.btn-send-comment:hover {
    color: #e74c3c !important;
    background: transparent !important;
    transform: translateY(-2px) scale(1.15);
    text-shadow: 0 0 10px rgba(178, 6, 6, 0.6);
}

.btn-send-comment:active { transform: scale(0.88); }
.btn-send-comment:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }


/* Right Sidebar Stats */
.community-stats {
    position: sticky;
    top: 100px;
    height: fit-content;
    z-index: 10;
}

.trending-pill-mobile, .trending-container-mobile {
    display: none;
}

.mobile-top-bar {
    display: flex;
}

.stats-card {
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
}

/* Comment Section */
.comment-section {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
}

.comment-section.active {
    max-height: 1000px;
    transition: max-height 0.4s ease-in;
    margin-top: 20px;
    padding: 15px;
    border: 1px solid var(--border);
}

.comment-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.comment-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.comment-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.comment-content h5 { font-size: 0.9rem; margin-bottom: 4px; }
.comment-content p { font-size: 0.85rem; color: #ced4da; line-height: 1.4; }

.comment-input-wrap {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.comment-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 8px 16px;
    color: white;
    font-size: 0.85rem;
    outline: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1100px) {
    .community-layout { grid-template-columns: 1fr 300px; padding: 0 20px 100px; }
    .community-sidebar { display: none; }
}

@media (max-width: 768px) {
    .community-layout { 
        display: block !important; 
        padding: 110px 15px 60px !important; 
        margin-top: 0 !important;
    }
    .community-sidebar { 
        display: block !important; 
        position: static !important; 
        background: transparent !important; 
        border: none !important; 
        padding: 0 0 15px 0 !important;
        margin-bottom: 0 !important;
        width: 100% !important;
    }
    .sidebar-title {
        font-size: 0.9rem !important;
        margin-bottom: 12px !important;
        opacity: 0.7;
    }
    .tag-list {
        flex-direction: row !important;
        overflow-x: auto !important;
        padding-bottom: 5px !important;
        gap: 8px !important;
        scrollbar-width: none; /* Firefox */
    }
    .tag-list::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
    .tag-item {
        white-space: nowrap !important;
        padding: 8px 16px !important;
        font-size: 0.85rem !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        flex-shrink: 0 !important;
    }
    .btn-back-game {
        padding: 5px 12px !important;
        font-size: 0.75rem !important;
        gap: 5px !important;
        margin-bottom: 0 !important; /* Reset margin for flex container */
    }
    .btn-back-game svg {
        width: 14px !important;
        height: 14px !important;
    }
    .comment-input {
        font-size: 16px !important; /* Mencegah auto-zoom di iOS */
        padding: 10px 16px !important;
    }
    .mobile-top-bar {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important; 
        margin-bottom: 20px !important;
        width: 100% !important;
        gap: 15px !important; /* Beri jarak antar elemen */
    }
    .trending-container-mobile {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-end !important; /* Rata kanan agar tidak tabrakan dengan tombol kembali */
        gap: 2px !important;
        flex: 1 !important;
    }
    .trending-label-mobile {
        font-size: 0.6rem !important;
        text-transform: uppercase !important;
        letter-spacing: 1px !important;
        color: var(--primary) !important;
        font-weight: 800 !important;
        opacity: 0.9 !important;
    }
    .trending-pill-mobile {
        display: flex !important;
        align-items: center !important;
        padding: 5px 12px !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        border-radius: 50px !important;
        font-size: 0.7rem !important;
        color: #eee !important;
        overflow: hidden !important;
        width: 160px !important;
        position: relative !important;
    }
    .trending-track-mobile {
        display: flex !important;
        gap: 15px !important;
        white-space: nowrap !important;
        animation: scroll-trending-mobile 10s linear infinite !important;
    }
    @keyframes scroll-trending-mobile {
        0% { transform: translateX(0); }
        100% { transform: translateX(-50%); }
    }
    .stats-card { display: none; }
    .post-input-card, .post-card { padding: 18px; border-radius: 16px; }
    .post-content { font-size: 0.95rem; }
    .post-actions { flex-direction: column; gap: 10px; align-items: stretch; }
}
