/* Header Tabs — Sticky on scroll (only top navigation header, NOT post headers) */
.scdev-sb-v2-feed > div.scdev-sb-v2-header {
    position: sticky !important;
    top: -2px !important;
    z-index: 9999 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
    border-bottom: none;
    padding: 8px 18px;
    box-sizing: border-box;
    border: 1px solid var(--scdev-border, #e2e8f0);
    border-radius: 999px;
    flex-wrap: wrap;
    background: var(--scdev-bg-card, #ffffff) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 14px var(--scdev-shadow, rgba(0, 0, 0, 0.08));
    transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

body.night-mode .scdev-sb-v2-feed > div.scdev-sb-v2-header,
body.dark-mode .scdev-sb-v2-feed > div.scdev-sb-v2-header,
html.dark .scdev-sb-v2-feed > div.scdev-sb-v2-header {
    background: var(--scdev-bg-card, #1e1f2b) !important;
    border-color: var(--scdev-border, #2e3146) !important;
}

/* Sidebar toggle — fade out on scroll */
.scdev-sidebar-toggle-right,
.scdev-top-user-btn,
.scdev-header-actions {
    transition: opacity 0.3s ease, transform 0.3s ease !important;
}

.scdev-scrolled-down .scdev-sidebar-toggle-right,
.scdev-scrolled-down .scdev-top-user-btn,
.scdev-scrolled-down .scdev-header-actions {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-10px) !important;
}

/* Reset header styling when inside feed item — MUST NOT BE STICKY */
.scdev-sb-v2-item .scdev-sb-v2-header {
    position: relative !important;
    top: auto !important;
    z-index: 1 !important;
    background: transparent !important;
    border: none !important;
    padding: 0 0 8px 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    margin-bottom: 12px !important;
}

/* Ensure post headers are not sticky and add spacing */
.scdev-sb-v2-item .scdev-sb-v2-header {
    position: relative !important;
    top: auto !important;
    z-index: auto !important;
    margin-top: 12px !important;
}


.scdev-sb-v2-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border: 2px solid #667eea;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    letter-spacing: 0.01em;
    color: var(--scdev-text-primary, #374151);
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
    top: 0;
    margin-bottom: 0;
    box-shadow: 0 1px 4px var(--scdev-shadow, rgba(0, 0, 0, 0.06));
}

.scdev-sb-icon-only {
    padding: 5px 10px !important;
}

body.night-mode .scdev-sb-v2-tab,
body.dark-mode .scdev-sb-v2-tab,
html.dark .scdev-sb-v2-tab {
    background: rgba(255, 255, 255, 0.06) !important;
    color: var(--scdev-text-primary, #f8fafc) !important;
}

/* Per-tab accent colors */
.scdev-sb-v2-tab[data-filter="all"] {
    border-color: #667eea;
}

.scdev-sb-v2-tab[data-filter="following"] {
    border-color: #10b981;
}

.scdev-sb-v2-tab[data-filter="fav"] {
    border-color: #f59e0b;
}

.scdev-sb-v2-tab[data-filter="pop"] {
    border-color: #ef4444;
}

.scdev-sb-v2-tab[data-filter="hidden"] {
    border-color: #8b5cf6;
}

.scdev-sb-v2-tab[data-tab="publisher"] {
    border-color: #06b6d4;
}

/* Hover — tinted background matching border */
.scdev-sb-v2-tab[data-filter="all"]:hover {
    background: rgba(102, 126, 234, 0.12) !important;
    color: #667eea !important;
}

.scdev-sb-v2-tab[data-filter="following"]:hover {
    background: rgba(16, 185, 129, 0.12) !important;
    color: #10b981 !important;
}

.scdev-sb-v2-tab[data-filter="fav"]:hover {
    background: rgba(245, 158, 11, 0.12) !important;
    color: #f59e0b !important;
}

.scdev-sb-v2-tab[data-filter="pop"]:hover {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #ef4444 !important;
}

.scdev-sb-v2-tab[data-filter="hidden"]:hover {
    background: rgba(139, 92, 246, 0.12) !important;
    color: #8b5cf6 !important;
}

.scdev-sb-v2-tab[data-tab="publisher"]:hover {
    background: rgba(6, 182, 212, 0.12) !important;
    color: #06b6d4 !important;
}

/* Active state — filled with strong glow */
.scdev-sb-v2-tab.active[data-filter="all"] {
    background: rgba(102, 126, 234, 0.15) !important;
    color: #667eea !important;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.5), 0 0 16px rgba(102, 126, 234, 0.8) !important;
}

.scdev-sb-v2-tab.active[data-filter="following"] {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #10b981 !important;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.5), 0 0 16px rgba(16, 185, 129, 0.8) !important;
}

.scdev-sb-v2-tab.active[data-filter="fav"] {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #f59e0b !important;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.5), 0 0 16px rgba(245, 158, 11, 0.8) !important;
}

.scdev-sb-v2-tab.active[data-filter="pop"] {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.5), 0 0 16px rgba(239, 68, 68, 0.8) !important;
}

.scdev-sb-v2-tab.active[data-filter="hidden"] {
    background: rgba(139, 92, 246, 0.15) !important;
    color: #8b5cf6 !important;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.5), 0 0 16px rgba(139, 92, 246, 0.8) !important;
}

.scdev-sb-v2-tab.active[data-tab="publisher"] {
    background: rgba(6, 182, 212, 0.15) !important;
    color: #06b6d4 !important;
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.5), 0 0 16px rgba(6, 182, 212, 0.8) !important;
}

/* Remove old bottom-border active indicator */
.scdev-sb-v2-tab.active {
    border-bottom-color: inherit;
}

/* ── Search tab icon ─────────────────────────────────────── */
.scdev-sb-search-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    margin-left: 8px;
    border-color: #6b7280 !important;
    color: #6b7280 !important;
}

.scdev-sb-search-tab:hover {
    background: rgba(107, 114, 128, 0.12) !important;
    color: #374151 !important;
}

.scdev-sb-search-tab.active {
    background: rgba(107, 114, 128, 0.15) !important;
    color: #374151 !important;
    box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.18) !important;
}

.scdev-sb-search-tab svg {
    display: block;
}

/* ── Search panel ────────────────────────────────────────── */
.scdev-sb-v2-search-panel {
    padding: 4px 12px 16px 12px;
}

/* Input row */
.scdev-sb-search-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    padding: 8px 14px;
    margin-bottom: 12px;
    transition: border-color 0.2s;
}

.scdev-sb-search-input-wrap:focus-within {
    border-color: #0066cc;
    background: #fff;
}

.scdev-sb-search-icon {
    color: #999;
    flex-shrink: 0;
}

.scdev-sb-search-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    color: #333;
    min-width: 0;
}

.scdev-sb-search-input::placeholder {
    color: #aaa;
}

.scdev-sb-search-clear {
    background: none;
    border: none;
    color: #999;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.scdev-sb-search-clear:hover {
    color: #333;
}

/* Filter chips */
.scdev-sb-search-filters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 4px 0 14px 0;
    margin-bottom: 0;
}

.scdev-sb-chip {
    display: inline-block;
    padding: 3px 12px;
    border: 1.5px solid #6b7280;
    border-radius: 999px;
    background: transparent;
    font-size: 10px;
    font-weight: 500;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: #4b5563 !important;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    line-height: 1.4;
}

.scdev-sb-chip:hover {
    border-color: #374151;
    color: #1f2937 !important;
    background: rgba(107, 114, 128, 0.1);
}

.scdev-sb-chip.active {
    background: #4b5563;
    border-color: #4b5563;
    color: #fff !important;
}

/* Night / dark mode — lighten up */
body.night-mode .scdev-sb-chip,
body.dark-mode .scdev-sb-chip {
    border-color: #9ca3af;
    color: #d1d5db !important;
}

body.night-mode .scdev-sb-chip:hover,
body.dark-mode .scdev-sb-chip:hover {
    border-color: #e5e7eb;
    color: #f9fafb !important;
    background: rgba(156, 163, 175, 0.15);
}

body.night-mode .scdev-sb-chip.active,
body.dark-mode .scdev-sb-chip.active {
    background: #6b7280;
    border-color: #6b7280;
    color: #fff !important;
}

/* Results */
.scdev-sb-search-results {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.scdev-sb-search-empty,
.scdev-sb-search-loading {
    text-align: center;
    padding: 24px;
    color: #999;
    font-size: 13px;
}

/* Result item */
.scdev-sb-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s;
    cursor: pointer;
}

.scdev-sb-search-result-item:hover {
    background: #f5f7ff;
}

/* Thumbnail */
.scdev-sb-search-result-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: #eee;
}

.scdev-sb-search-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.scdev-sb-search-result-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    border-radius: 8px;
}

/* User thumbnails are circular */
.scdev-sb-label-user~.scdev-sb-search-result-thumb,
.scdev-sb-search-result-item:has(.scdev-sb-label-user) .scdev-sb-search-result-thumb {
    border-radius: 50%;
}

/* Info */
.scdev-sb-search-result-info {
    flex: 1;
    min-width: 0;
}

.scdev-sb-search-result-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scdev-sb-search-result-excerpt {
    font-size: 12px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

/* Type label badge */
.scdev-sb-search-result-label {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.scdev-sb-label-user {
    background: #e3f2fd;
    color: #1565c0;
}

.scdev-sb-label-post {
    background: #e8f5e9;
    color: #2e7d32;
}

.scdev-sb-label-group {
    background: #fff3e0;
    color: #e65100;
}

.scdev-sb-label-page {
    background: #f3e5f5;
    color: #6a1b9a;
}

.scdev-sb-label-event {
    background: #fce4ec;
    color: #880e4f;
}

.scdev-sb-label-forum {
    background: #e0f7fa;
    color: #006064;
}

.scdev-sb-label-poll {
    background: #f9fbe7;
    color: #558b2f;
}

/* Dark / night mode */
body.night-mode .scdev-sb-search-input-wrap,
body.dark-mode .scdev-sb-search-input-wrap {
    background: #2a2a2a;
    border-color: #444;
}

body.night-mode .scdev-sb-search-input,
body.dark-mode .scdev-sb-search-input {
    color: #f0f0f0;
}

body.night-mode .scdev-sb-search-result-item:hover,
body.dark-mode .scdev-sb-search-result-item:hover {
    background: #2a2a2a;
}

body.night-mode .scdev-sb-search-result-title,
body.dark-mode .scdev-sb-search-result-title {
    color: #f0f0f0;
}

body.night-mode .scdev-sb-search-result-excerpt,
body.dark-mode .scdev-sb-search-result-excerpt {
    color: #aaa;
}

/* ── Follow button in search results ─────────────────────── */
.scdev-sb-follow-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid #2563eb;
    background: #2563eb;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.scdev-sb-follow-btn:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

.scdev-sb-follow-btn--following {
    background: transparent;
    color: #2563eb;
    border-color: #2563eb;
}

.scdev-sb-follow-btn--following:hover {
    background: #fff0f0;
    border-color: #e74c3c;
    color: #e74c3c;
}

.scdev-sb-follow-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Dark mode for search follow buttons */
body.dark-mode .scdev-sb-follow-btn,
body.night-mode .scdev-sb-follow-btn,
body.sheer-dark .scdev-sb-follow-btn,
body.sheer-dark-mode .scdev-sb-follow-btn,
body.wp-dark-mode-active .scdev-sb-follow-btn,
html.dark .scdev-sb-follow-btn,
[data-theme="dark"] .scdev-sb-follow-btn,
[data-color-scheme="dark"] .scdev-sb-follow-btn {
    background: #3b82f6 !important;
    border-color: #3b82f6 !important;
    color: #ffffff !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

body.dark-mode .scdev-sb-follow-btn:hover,
body.night-mode .scdev-sb-follow-btn:hover,
body.sheer-dark .scdev-sb-follow-btn:hover,
body.sheer-dark-mode .scdev-sb-follow-btn:hover,
body.wp-dark-mode-active .scdev-sb-follow-btn:hover,
html.dark .scdev-sb-follow-btn:hover,
[data-theme="dark"] .scdev-sb-follow-btn:hover,
[data-color-scheme="dark"] .scdev-sb-follow-btn:hover {
    background: #2563eb !important;
    border-color: #2563eb !important;
    color: #ffffff !important;
}

body.dark-mode .scdev-sb-follow-btn--following,
body.night-mode .scdev-sb-follow-btn--following,
body.sheer-dark .scdev-sb-follow-btn--following,
body.sheer-dark-mode .scdev-sb-follow-btn--following,
body.wp-dark-mode-active .scdev-sb-follow-btn--following,
html.dark .scdev-sb-follow-btn--following,
[data-theme="dark"] .scdev-sb-follow-btn--following,
[data-color-scheme="dark"] .scdev-sb-follow-btn--following {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #cbd5e1 !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

body.dark-mode .scdev-sb-follow-btn--following:hover,
body.night-mode .scdev-sb-follow-btn--following:hover,
body.sheer-dark .scdev-sb-follow-btn--following:hover,
body.sheer-dark-mode .scdev-sb-follow-btn--following:hover,
body.wp-dark-mode-active .scdev-sb-follow-btn--following:hover,
html.dark .scdev-sb-follow-btn--following:hover,
[data-theme="dark"] .scdev-sb-follow-btn--following:hover,
[data-color-scheme="dark"] .scdev-sb-follow-btn--following:hover {
    background: rgba(239, 68, 68, 0.15) !important;
    border-color: #ef4444 !important;
    color: #f87171 !important;
}

/* Round avatar for user results */
.scdev-sb-search-result-thumb--round,
.scdev-sb-search-result-thumb--round img,
.scdev-sb-search-result-thumb--round .scdev-sb-search-result-thumb-placeholder {
    border-radius: 50% !important;
}

/* User result — avatar + name link */
.scdev-sb-search-result-user-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.scdev-sb-search-result-user-link:hover .scdev-sb-search-result-title {
    text-decoration: underline;
    color: #0066cc;
}

.scdev-sb-search-result-user-link:hover .scdev-sb-search-result-thumb img {
    opacity: 0.85;
}

/* Mobile: Show icons only, hide text */
@media (max-width: 768px) {
    .scdev-sb-v2-feed {
        padding: 0 0 80px 0 !important;
        margin: 0 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .scdev-sb-v2-feed > .scdev-sb-v2-header,
    .scdev-sb-v2-feed > div.scdev-sb-v2-header {
        position: sticky !important;
        top: 0px !important;
        z-index: 9999 !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 10px 18px !important;
        gap: 6px !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
        border-radius: 999px !important;
    }

    .scdev-sb-v2-item .scdev-sb-v2-header {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        width: 100% !important;
        padding: 0 0 8px 0 !important;
        margin-bottom: 12px !important;
        gap: 12px !important;
        overflow: visible !important;
        background: transparent !important;
        border-radius: 0 !important;
    }

    .scdev-sb-v2-item .scdev-sb-v2-author {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }

    .scdev-sb-v2-item .scdev-sb-v2-author-info {
        display: flex !important;
        flex-direction: column !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
        gap: 4px !important;
    }

    .scdev-sb-v2-item .scdev-sb-v2-meta-row {
        display: flex !important;
        align-items: center !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .scdev-sb-v2-item .scdev-sb-v2-post-menu {
        margin-left: auto !important;
        flex-shrink: 0 !important;
        align-self: flex-start !important;
    }

    .scdev-sb-v2-tab .tab-text {
        display: none !important;
    }

    .scdev-sb-v2-tab .tab-icon {
        display: inline-block !important;
        font-size: 18px !important;
    }

    .scdev-sb-v2-tab {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        padding: 0 !important;
        flex: 0 0 42px !important;
        max-width: 42px !important;
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    .scdev-sb-search-tab {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        padding: 0 !important;
        margin-left: 0 !important;
    }

    .scdev-sb-search-tab svg {
        width: 18px !important;
        height: 18px !important;
    }

    .scdev-sb-v2-list {
        padding: 0 0px !important;
        margin: 0 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* Desktop: Show both icon and text */
@media (min-width: 769px) {
    .scdev-sb-v2-tab .tab-icon {
        display: inline-block !important;
        font-size: 15px !important;
    }

    .scdev-sb-v2-tab .tab-text {
        display: inline-block !important;
    }

    /* Icon-only tabs — no text, square-ish pill, tooltip on hover */
    .scdev-sb-v2-tab.scdev-sb-icon-only {
        padding: 7px 10px;
        position: relative;
    }

    .scdev-sb-v2-tab.scdev-sb-story-tab {
        gap: 4px;
    }

    .scdev-sb-v2-tab.scdev-sb-icon-only .tab-text {
        display: none !important;
    }

    .scdev-sb-v2-tab.scdev-sb-story-tab .tab-plus {
        font-size: 16px;
        font-weight: 700;
        line-height: 1;
        display: inline-block;
        transform: translateY(-1px);
    }

    /* Tooltip */
    .scdev-sb-v2-tab.scdev-sb-icon-only::after {
        content: attr(data-label);
        position: absolute;
        top: calc(100% + 12px);
        left: 50%;
        transform: translateX(-50%) translateY(-4px);
        background: rgba(17, 24, 39, 0.96);
        color: #ffffff;
        font-size: 12px;
        font-weight: 600;
        font-family: 'Inter', system-ui, sans-serif;
        white-space: nowrap;
        padding: 6px 11px;
        border-radius: 999px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
        letter-spacing: 0.01em;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.18s ease, transform 0.18s ease;
        z-index: 100;
    }

    /* Tooltip arrow */
    .scdev-sb-v2-tab.scdev-sb-icon-only::before {
        content: '';
        position: absolute;
        top: calc(100% + 5px);
        left: 50%;
        transform: translateX(-50%);
        border: 6px solid transparent;
        border-bottom-color: rgba(17, 24, 39, 0.96);
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.18s ease;
        z-index: 100;
    }

    .scdev-sb-v2-tab.scdev-sb-icon-only:hover::after,
    .scdev-sb-v2-tab.scdev-sb-icon-only:focus-visible::after,
    .scdev-sb-v2-tab.scdev-sb-icon-only:hover::before,
    .scdev-sb-v2-tab.scdev-sb-icon-only:focus-visible::before {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}