/* ========================================================
   COMPONENTS FEED LAYOUT (RESPONSIVE DOWN TO 300PX)
   ======================================================== */
.components-feed-container {
    padding: 1.25rem 0;
}

.feed-grid {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

@media (min-width: 992px) {
    .feed-grid {
        display: grid;
        grid-template-columns: 240px 1fr 260px;
        align-items: start;
        gap: 1.5rem;
    }
}

/* ========================================================
   RESPONSIVE ORDERING: MIDDLE STREAM ON TOP IN SMALL SCREENS
   ======================================================== */
.feed-main-stream {
    order: -1;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

@media (min-width: 992px) {
    .feed-main-stream {
        order: 0;
    }
}

/* ========================================================
   LIVE SEARCH BAR WITH HIGHLIGHTED SUGGESTIONS
   ======================================================== */
.feed-search-wrapper {
    position: relative;
    width: 100%;
}

.search-input-group {
    display: flex;
    align-items: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.5rem 0.85rem;
    gap: 0.5rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.search-icon {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font-ui);
    outline: none;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.clear-search-btn {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: none;
    padding: 0 0.25rem;
}

.clear-search-btn:hover {
    color: var(--text-primary);
}

/* Suggestions Dropdown Card */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    z-index: 200;
    max-height: 280px;
    overflow-y: auto;
}

.search-results-dropdown.hidden {
    display: none;
}

.suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.825rem;
    text-decoration: none;
    transition: background 0.15s ease;
}

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

.suggestion-item:hover {
    background: var(--bg-card);
}

.suggestion-title {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 80%;
}

/* Highlighted Matching Text Area */
.search-highlight {
    background: rgba(245, 158, 11, 0.25);
    color: var(--amber-accent);
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 700;
}

.suggestion-tag {
    font-size: 0.7rem;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    padding: 0.15rem 0.45rem;
    border-radius: 50px;
    font-weight: 700;
}

/* ========================================================
   LEFT SIDEBAR: FRAMEWORK FILTERS
   ======================================================== */
.feed-left-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 992px) {
    .feed-left-sidebar {
        position: sticky;
        top: 80px;
    }
}

.sidebar-menu-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-menu-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.825rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    text-decoration: none;
}

.sidebar-menu-btn:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.sidebar-menu-btn.active {
    background: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--primary);
}

.tech-icon-badge {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.725rem;
    font-weight: 800;
    flex-shrink: 0;
}

/* ========================================================
   CENTER FEED POST CARDS
   ======================================================== */
.feed-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: border-color 0.2s ease;
}

.feed-card:hover {
    border-color: var(--border-highlight);
}

.feed-card-header {
    padding: 1rem 1rem 0.65rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.author-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--purple-glow));
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.author-meta-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.author-meta-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.feed-card-body {
    padding: 0 1rem 0.85rem 1rem;
}

.feed-card-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    word-break: break-word;
}

.feed-card-desc {
    color: var(--text-secondary);
    font-size: 0.825rem;
    margin-bottom: 0.85rem;
    line-height: 1.5;
    word-break: break-word;
}

/* Gallery Preview */
.feed-media-gallery {
    display: grid;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #000;
    max-height: 280px;
}

.feed-media-gallery.single-img { grid-template-columns: 1fr; }
.feed-media-gallery.multi-img { grid-template-columns: 1fr 1fr; }

.gallery-img {
    width: 100%;
    height: 100%;
    max-height: 280px;
    object-fit: cover;
}

/* Code Snippets & Scrollable Tabs */
.code-snippets-container {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.code-tabs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0 0.35rem;
    gap: 0.5rem;
}

.code-tabs-list {
    display: flex;
    list-style: none;
    gap: 0.2rem;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}

.code-tabs-list::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.code-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: var(--font-code);
    font-size: 0.725rem;
    padding: 0.55rem 0.65rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.code-tab-btn:hover { color: var(--text-primary); }
.code-tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.copy-code-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
}

.copy-code-btn:hover {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.code-tab-pane {
    display: none;
    padding: 0.75rem;
}

.code-tab-pane.active { display: block; }

.code-tab-pane pre {
    font-family: var(--font-code);
    font-size: 0.75rem;
    color: #E5E7EB;
    overflow-x: auto;
    margin: 0;
}

/* Card Actions Footer */
.feed-card-footer {
    padding: 0.65rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.15);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bookmark-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    font-weight: 600;
}

.bookmark-btn:hover { color: var(--primary); }

.card-link {
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
}

/* ========================================================
   RIGHT SIDEBAR & POPULAR TAGS
   ======================================================== */
.feed-right-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

@media (min-width: 992px) {
    .feed-right-sidebar {
        position: sticky;
        top: 80px;
    }
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.tag-chip {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.tag-chip:hover {
    color: var(--primary);
    border-color: var(--primary);
}

/* ========================================================
   ULTRA-RESPONSIVE BREAKPOINTS (DOWN TO 300PX)
   ======================================================== */
@media (max-width: 480px) {
    .components-feed-container {
        padding: 0.75rem 0;
    }

    .feed-card-header,
    .feed-card-body,
    .feed-card-footer {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .feed-card-title {
        font-size: 0.98rem;
    }

    .feed-media-gallery.multi-img {
        grid-template-columns: 1fr;
    }

    .feed-card-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
}