/* ============================================================
   Página dedicada de discussão (thread) — /bip/{id}
   Layout plano inspirado no Threads
   ============================================================ */

.bip-thread {
    display: flex;
    flex-direction: column;
}

.bip-thread__context {
    padding: 12px 0 0;
}

.bip-thread__context-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-3);
    text-decoration: none;
}

.bip-thread__context-link:hover {
    color: var(--accent);
}

/* Post raiz — sem caixa, direto no fundo */
.bip-thread__root {
    padding: 20px 0 0;
}

.bip-thread__root .bip-card,
.bip-thread__root-fallback.bip-card {
    border-bottom: none;
    padding: 0 0 16px;
}

.bip-thread__root .bip-card--thread-root {
    gap: 14px;
    align-items: flex-start;
}

/* Avatar do post principal — maior que os comentários */
.bip-thread__root .bip-card__avatar {
    width: 56px;
    height: 56px;
    font-size: 1.45rem;
}

.bip-thread__root .bip-card__text {
    font-size: 1rem;
    line-height: 1.55;
    margin-top: 6px;
}

.bip-thread__root .bip-card__actions {
    margin-top: 10px;
}

.bip-thread__root-composer:empty {
    display: none;
}

.bip-thread__root-composer {
    padding: 0 0 10px;
}

/* Barra: voltar (esq.) + ordenação (dir.) */
.bip-thread__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0 14px;
}

.bip-thread__pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 16px;
    height: 34px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-3);
    text-decoration: none;
    line-height: 1;
    transition: background var(--duration), color var(--duration), border-color var(--duration);
    white-space: nowrap;
}

.bip-thread__pill i {
    font-size: 1rem;
    line-height: 1;
}

.bip-thread__pill--back:hover {
    color: var(--white);
    background: var(--surface-2);
    border-color: var(--border);
}

.bip-thread__sort {
    display: inline-flex;
    gap: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 3px;
    height: 34px;
    align-items: center;
    box-sizing: border-box;
    flex-shrink: 0;
}

.bip-thread__sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-3);
    padding: 0 12px;
    height: 26px;
    border-radius: var(--radius);
    transition: background var(--duration), color var(--duration);
    white-space: nowrap;
}

.bip-thread__sort-btn i {
    font-size: 1rem;
}

.bip-thread__sort-btn.is-active {
    background: var(--accent-soft, rgba(79, 142, 247, 0.18));
    color: var(--white);
}

.bip-thread__sort-btn:hover {
    color: var(--white);
}

/* Divisor visível abaixo da barra de controles */
.bip-thread__divider {
    display: block;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.14);
    margin: 0 0 8px;
    flex-shrink: 0;
}

/* Lista de respostas — estilo plano */
.bip-thread__replies {
    display: flex;
    flex-direction: column;
}

.bip-thread__replies > .bip-reply-branch {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.bip-thread__replies .bip-reply-branch--nested {
    padding: 0;
    border-bottom: none;
}

.bip-thread__replies .bip-reply__follow .bip-reply-branch {
    border-bottom: none;
}

.bip-thread__replies .bip-reply__header {
    gap: 4px;
}

.bip-thread__replies .bip-reply__author {
    font-size: 0.9rem;
}

.bip-thread__replies .bip-reply__text {
    margin-top: 2px;
    font-size: 0.95rem;
    line-height: 1.45;
}

.bip-thread__replies .bip-reply__actions {
    padding-top: 8px;
    margin-left: -8px;
}

/* Estados */
.bip-thread__loading,
.bip-thread__empty,
.bip-thread__error {
    text-align: center;
    color: var(--text-3);
    padding: 28px 16px;
}

.bip-thread__loading i {
    font-size: 1.6rem;
}

.bip-thread__empty i {
    font-size: 2rem;
    display: block;
    margin-bottom: 10px;
    color: var(--text-3);
}

.bip-thread__error {
    color: var(--red);
}

.bip-thread__more {
    display: flex;
    justify-content: center;
    padding: 16px 0;
}

/* Destaque ao chegar via link direto (#reply-ID) */
.bip-thread__highlight {
    animation: bipThreadHighlight 2.2s ease;
    border-radius: var(--radius);
}

@keyframes bipThreadHighlight {
    0%, 30% { background: var(--accent-soft, rgba(79, 142, 247, 0.18)); }
    100% { background: transparent; }
}

@media (max-width: 768px) {
    .bip-thread__root {
        padding-top: 16px;
    }

    .bip-thread__root .bip-card__avatar {
        width: 48px;
        height: 48px;
        font-size: 1.3rem;
    }

    .bip-thread__root .bip-card__text {
        font-size: 1rem;
    }

    .bip-thread__toolbar {
        gap: 8px;
    }

    .bip-thread__pill {
        padding: 7px 10px;
        font-size: 0.78rem;
    }

    .bip-thread__sort-btn {
        padding: 5px 10px;
        font-size: 0.78rem;
    }

    .bip-thread__replies .bip-reply__follow {
        margin-left: 0;
    }
}
