/* ==========================================================================
   BuddyBoss Topic Switcher v4.0
   Uses BuddyBoss CSS custom properties for primary/secondary button colours.
   ========================================================================== */

/* ── Bar wrapper ─────────────────────────────────────────────────────────── */

#bb-ts-bar {
    width: 100%;
    margin: 0 0 16px;
    box-sizing: border-box;
}

/* ── Shared scroll row ───────────────────────────────────────────────────── */

.bb-ts-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 3px 2px 5px;
}
.bb-ts-inner::-webkit-scrollbar { display: none; }

/* ── Topic pills (Row 1) ─────────────────────────────────────────────────── */

.bb-ts-pill {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 6px 16px;
    border-radius: 4px;
    border: 1.5px solid rgba(0,0,0,.13);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
    background: transparent;
    color: var(--bb-ts-pill-color, #555);
    transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    box-shadow: none;
}

.bb-ts-pill:hover {
    border-color: var(--bb-color-primary, #22c55e);
    color:        var(--bb-color-primary, #22c55e);
    background:   rgba(34,197,94,.06);
}

.bb-ts-pill:focus-visible {
    box-shadow: 0 0 0 3px rgba(34,197,94,.25);
}

/* Active topic pill — white bg, green border + text, clearly different from unselected */
#bb-ts-topics .bb-ts-pill.bb-ts-pill--active,
#bb-ts-topics .bb-ts-pill.bb-ts-pill--active:hover {
    background:   #ffffff;
    color:        #16a34a;
    border-color: #16a34a;
    border-width: 2px;
    font-weight:  700;
    box-shadow:   0 0 0 3px rgba(22,163,74,.15);
}

/* ── Shimmer skeleton ────────────────────────────────────────────────────── */

.bb-ts-placeholder {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.bb-ts-placeholder span {
    display: inline-block;
    border-radius: 4px;
    background: linear-gradient(90deg, #e8e8e8 25%, #f4f4f4 50%, #e8e8e8 75%);
    background-size: 200% 100%;
    animation: bb-ts-shimmer 1.4s ease infinite;
}

/* Topic row shimmer heights */
#bb-ts-topics .bb-ts-placeholder span {
    height: 32px;
    width: 80px;
}
#bb-ts-topics .bb-ts-placeholder span:nth-child(1) { width: 50px; }
#bb-ts-topics .bb-ts-placeholder span:nth-child(2) { width: 90px; }
#bb-ts-topics .bb-ts-placeholder span:nth-child(3) { width: 66px; }
#bb-ts-topics .bb-ts-placeholder span:nth-child(4) { width: 80px; }
#bb-ts-topics .bb-ts-placeholder span:nth-child(5) { width: 55px; }

/* Hashtag row shimmer — shorter pills */
.bb-ts-ht-placeholder span {
    height: 24px;
    width: 64px;
}
.bb-ts-ht-placeholder span:nth-child(1) { width: 60px; }
.bb-ts-ht-placeholder span:nth-child(2) { width: 75px; }
.bb-ts-ht-placeholder span:nth-child(3) { width: 50px; }
.bb-ts-ht-placeholder span:nth-child(4) { width: 68px; }
.bb-ts-ht-placeholder span:nth-child(5) { width: 55px; }
.bb-ts-ht-placeholder span:nth-child(6) { width: 70px; }
.bb-ts-ht-placeholder span:nth-child(7) { width: 48px; }

@keyframes bb-ts-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Activity type tabs (standalone bar above feed) ─────────────────────── */

.bb-ts-type-bar {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0;
    border-bottom: 2px solid rgba(0,0,0,.07);
    margin: 0 0 12px;
    padding: 0 2px;
}

.bb-ts-type-tab {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px 8px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    color: #6b7280;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;         /* sits flush on the bar border */
    border-radius: 0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: color .15s, border-color .15s;
}

.bb-ts-type-tab:hover {
    color: var(--bb-color-primary, #16a34a);
}

.bb-ts-type-tab.bb-ts-type-tab--active {
    color: #16a34a;
    border-bottom-color: #16a34a;
    font-weight: 700;
}

/* ── Hashtag pill row (Row 2) ────────────────────────────────────────────── */

.bb-ts-hashtags {
    display: none;
    border-top: 1px solid rgba(0,0,0,.07);
    padding-top: 5px;
    margin-top: 1px;
    position: relative;
    align-items: center;
    gap: 0;
}

@media (max-width: 768px) {
    .bb-ts-hashtags { display: flex; }
}

/* ── Pinned selected-tag slot (left side, never scrolls) ─────────────────── */
#bb-ts-ht-selected {
    flex-shrink: 0;
    display: none;           /* hidden until a tag is selected */
    align-items: center;
    padding-right: 8px;
    border-right: 1px solid rgba(0,0,0,.10);
    margin-right: 8px;
}

#bb-ts-ht-selected.has-tag {
    display: flex;
}

/* The pinned selected pill — solid green */
#bb-ts-ht-selected .bb-ht-selected-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px 4px 13px;
    border-radius: 999px;
    border: 2px solid #16a34a;
    background: #16a34a;
    color: #fff;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: background .15s;
    -webkit-appearance: none;
    appearance: none;
}

#bb-ts-ht-selected .bb-ht-selected-pill:hover {
    background: #15803d;
    border-color: #15803d;
}

/* × dismiss button inside the pill */
#bb-ts-ht-selected .bb-ht-x {
    font-size: 12px;
    line-height: 1;
    opacity: .75;
    margin-left: 1px;
}

/* ── Scrolling ticker of unselected tags ─────────────────────────────────── */
#bb-ts-ht-ticker {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    scrollbar-width: none;
    padding: 4px 4px;
    -webkit-overflow-scrolling: touch;
}
#bb-ts-ht-ticker::-webkit-scrollbar { display: none; }

/* Fade masks */
.bb-ts-hashtags::after {
    content: '';
    position: absolute;
    right: 0;
    top: 6px;
    bottom: 0;
    width: 28px;
    background: linear-gradient(to left, rgba(255,255,255,1), rgba(255,255,255,0));
    pointer-events: none;
    z-index: 1;
}

/* Unselected hashtag = pure plain text, zero pill styling */
#bb-ts-ht-ticker button,
.bb-ht-text {
    display: inline-block;
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    white-space: nowrap;
    cursor: pointer;
    padding: 0;
    margin: 0;
    border: none !important;
    background: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: color .12s;
    text-decoration: none;
    line-height: 1.5;
}

#bb-ts-ht-ticker button:hover,
.bb-ht-text:hover {
    color: #16a34a;
    background: none !important;
    border: none !important;
}

/* Fade-in for ticker items */
@keyframes bb-ts-fadein {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.bb-ht-text { animation: bb-ts-fadein .2s ease both; }

/* ── Feed loading progress bar ───────────────────────────────────────────── */

#bb-ts-bar-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 3px;
    margin: 0;
    border-radius: 0;
    overflow: hidden;
    background: rgba(34,197,94,.15);
    z-index: 99999;
}

#bb-ts-bar-loader::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        #22c55e 30%,
        #86efac 50%,
        #22c55e 70%,
        transparent 100%);
    background-size: 200% 100%;
    animation: bb-ts-bar-slide 1.1s ease-in-out infinite;
}

@keyframes bb-ts-bar-slide {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── CSS custom property overrides (child theme) ─────────────────────────────

:root {
    --bb-ts-pill-bg:           transparent;
    --bb-ts-pill-color:        var(--bb-color-primary, #1f70b8);
    --bb-ts-pill-border:       #d1d5db;
    --bb-ts-pill-hover-bg:     rgba(31,112,184,.08);
}
   ========================================================================== */


/* ── Activity Topic Selector: scrollable pill row ───────────────────────── */
.activity-topic-selector {
    width: 700px !important;
    flex: 0 0 700px !important;
    overflow: hidden !important;
}
.activity-topic-selector > ul {
    flex-wrap: nowrap !important;
    overflow-x: scroll !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
.activity-topic-selector > ul::-webkit-scrollbar {
    display: none !important;
}

/* ── Activity Topic Selector: scrollable pill row ───────────────────────── */
.activity-topic-selector {
    width: 700px !important;
    flex: 0 0 700px !important;
    overflow: hidden !important;
}
.activity-topic-selector > ul {
    flex-wrap: nowrap !important;
    overflow-x: scroll !important;
    overflow-y: hidden !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}
.activity-topic-selector > ul::-webkit-scrollbar {
    display: none !important;
}

/* ── Topic wrap: reserve space to prevent layout shift ──────────────────── */
#bbc-topic-wrap {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 4px 0;
}
#bbc-topic-slot {
    display: flex;
    align-items: center;
    width: 100%;
}

/* ── Shimmer for topic bar placeholder ──────────────────────────────────── */
.bbc-topic-shimmer {
    display: flex !important;
    gap: 6px;
    padding: 4px 0;
    flex-wrap: nowrap;
}
.bbc-topic-shimmer > span {
    display: inline-block !important;
    height: 30px;
    border-radius: 999px;
    flex-shrink: 0;
    background: linear-gradient(90deg,
        var(--bb-ts-shimmer-a, #e5e7eb) 25%,
        var(--bb-ts-shimmer-b, #f3f4f6) 50%,
        var(--bb-ts-shimmer-a, #e5e7eb) 75%);
    background-size: 200% 100%;
    animation: bb-ts-shimmer 1.4s ease infinite;
}
