/* Header Tabs */
.scdev-sb-v2-header {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: none;
    padding: 12px 16px;
    background: transparent !important;
    border-radius: 4px;
    justify-content: center;
    flex-wrap: wrap;
}

.scdev-sb-v2-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    background: rgba(255,255,255,0.6) !important;
    border: 2px solid #667eea;
    border-radius: 999px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    letter-spacing: 0.01em;
    color: #374151 !important;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
    top: 0;
    margin-bottom: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* 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 */
.scdev-sb-v2-tab.active[data-filter="all"]       { background: rgba(102,126,234,0.15) !important; color: #667eea !important; box-shadow: 0 0 0 3px rgba(102,126,234,0.18); }
.scdev-sb-v2-tab.active[data-filter="following"] { background: rgba(16,185,129,0.15) !important;  color: #10b981 !important; box-shadow: 0 0 0 3px rgba(16,185,129,0.18); }
.scdev-sb-v2-tab.active[data-filter="fav"]       { background: rgba(245,158,11,0.15) !important;  color: #f59e0b !important; box-shadow: 0 0 0 3px rgba(245,158,11,0.18); }
.scdev-sb-v2-tab.active[data-filter="pop"]       { background: rgba(239,68,68,0.15) !important;   color: #ef4444 !important; box-shadow: 0 0 0 3px rgba(239,68,68,0.18); }
.scdev-sb-v2-tab.active[data-filter="hidden"]    { background: rgba(139,92,246,0.15) !important;  color: #8b5cf6 !important; box-shadow: 0 0 0 3px rgba(139,92,246,0.18); }
.scdev-sb-v2-tab.active[data-tab="publisher"]    { background: rgba(6,182,212,0.15) !important;   color: #06b6d4 !important; box-shadow: 0 0 0 3px rgba(6,182,212,0.18); }

/* 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: 7px 14px;
    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: 0 0 16px 0;
}

/* 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;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.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 #0066cc;
    background: #0066cc;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.scdev-sb-follow-btn:hover {
    background: #0052a3;
    border-color: #0052a3;
}

.scdev-sb-follow-btn--following {
    background: transparent;
    color: #0066cc;
}

.scdev-sb-follow-btn--following:hover {
    background: #fff0f0;
    border-color: #e74c3c;
    color: #e74c3c;
}

.scdev-sb-follow-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 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 !important;
        margin: 0 -10px !important;
        width: calc(100% + 20px) !important;
        max-width: calc(100% + 20px) !important;
        box-sizing: border-box !important;
    }
    
    .scdev-sb-v2-header {
        overflow-x: visible !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        padding: 0 10px !important;
        gap: 4px !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !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 {
        min-width: 0 !important;
        padding: 10px 4px !important;
        flex: 1 1 0 !important;
        max-width: none !important;
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .scdev-sb-search-tab {
        padding: 10px 4px !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-icon-only .tab-text {
        display: none !important;
    }

    /* Tooltip */
    .scdev-sb-v2-tab.scdev-sb-icon-only::after {
        content: attr(data-label);
        position: absolute;
        bottom: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%);
        background: #1f2937;
        color: #f9fafb;
        font-size: 11px;
        font-weight: 500;
        font-family: 'Inter', system-ui, sans-serif;
        white-space: nowrap;
        padding: 4px 9px;
        border-radius: 6px;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.15s ease;
        z-index: 100;
    }

    /* Tooltip arrow */
    .scdev-sb-v2-tab.scdev-sb-icon-only::before {
        content: '';
        position: absolute;
        bottom: calc(100% + 3px);
        left: 50%;
        transform: translateX(-50%);
        border: 5px solid transparent;
        border-top-color: #1f2937;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.15s ease;
        z-index: 100;
    }

    .scdev-sb-v2-tab.scdev-sb-icon-only:hover::after,
    .scdev-sb-v2-tab.scdev-sb-icon-only:hover::before {
        opacity: 1;
    }
}
