/* =========================================================
   PLEXO / COMUNIDADE DETALHE
   Página: /comunidade/{slug}
   Header social + tabs estilo app + livros em prateleira
   ========================================================= */

/* Base da página interna */
.community-detail-hero {
    background: #fff;
    padding: 38px 0 70px;
}

/* =========================================================
   HEADER / CAPA DA COMUNIDADE
   ========================================================= */

.community-detail-cover-social {
    position: relative;
    min-height: 250px;
    overflow: hidden;
    border: 1px solid rgba(18, 55, 42, 0.08);
    border-radius: 28px;
    background:
        radial-gradient(circle at top right, color-mix(in srgb, var(--community-color, #0f6f5c) 24%, #fff 76%), transparent 34%),
        linear-gradient(135deg, #fff 0%, #f8fbf7 64%, color-mix(in srgb, var(--community-color, #0f6f5c) 12%, #fff 88%) 100%);
    box-shadow: 0 24px 60px rgba(18, 42, 35, 0.08);
}

.community-detail-cover-social.has-cover {
    background:
        linear-gradient(90deg, rgba(255, 255, 255, 0.96) 0%, rgba(255, 255, 255, 0.9) 46%, rgba(255, 255, 255, 0.54) 100%),
        var(--community-cover);
    background-size: cover;
    background-position: center;
}

.community-detail-cover-social::before {
    display: none;
}

.community-detail-cover-art {
    position: absolute;
    top: -60px;
    right: -40px;
    width: 250px;
    height: 250px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--community-color, #0f6f5c) 28%, #f6d681 72%);
    opacity: 0.58;
}

.community-detail-cover-social.has-cover .community-detail-cover-art {
    display: none;
}

.community-detail-content {
    position: relative;
    z-index: 2;
    padding: 34px;
}

.community-detail-cover-social .community-detail-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 16px;
    align-items: center;
}

.community-detail-cover-social .community-symbol-large {
    width: 76px;
    height: 76px;
    border-radius: 22px;
    background: color-mix(in srgb, var(--community-color, var(--accent)) 13%, #fff);
    color: var(--community-color, var(--accent));
}

.community-detail-cover-social h1 {
    max-width: 900px;
    margin: 0;
    color: var(--primary);
    font-size: clamp(2.4rem, 6vw, 4.4rem);
    line-height: 1.02;
    letter-spacing: -0.07em;
}

.community-detail-cover-social p {
    max-width: 680px;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.6;
}

.community-detail-cover-social .community-detail-bar {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 26px;
}

.community-detail-cover-social .community-detail-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 0;
}

.community-detail-cover-social .community-detail-stats dt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--primary);
    font-size: 0.95rem;
    font-weight: 900;
}

.community-detail-cover-social .community-detail-stats svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.community-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.community-detail-actions form {
    margin: 0;
}

.community-share-status {
    min-height: 20px;
    margin: 10px 0 0;
    color: var(--accent-strong);
    font-size: 0.84rem;
    font-weight: 900;
}

/* =========================================================
   BARRA DE TABS — ESTILO APP
   ========================================================= */

.community-tabs-bar {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    margin-top: 34px;
    border: 1px solid rgba(18, 55, 42, 0.08);
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    overflow: hidden;
}

.community-tabs-bar button {
    position: relative;
    min-height: 64px;
    display: grid;
    place-items: center;
    gap: 5px;
    border: 0;
    border-right: 1px solid rgba(18, 55, 42, 0.06);
    border-radius: 0;
    background: #fff;
    color: #6b7280;
    font: inherit;
    font-weight: 850;
    cursor: pointer;
    transition: color 160ms ease, background 160ms ease;
}

.community-tabs-bar button:last-child {
    border-right: 0;
}

.community-tabs-bar button::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    transition: background 160ms ease;
}

.community-tabs-bar button:hover {
    color: var(--primary);
    background: #fffdf9;
}

.community-tabs-bar button.is-active {
    color: var(--primary);
    background: #fff;
}

.community-tabs-bar button.is-active::after {
    background: var(--accent, #ff6b1a);
}

.community-tab-icon {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
}

.community-tab-icon svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.community-tab-label {
    display: block;
    font-size: 0.78rem;
    line-height: 1;
    font-weight: 900;
}

/* sobrescreve o estilo pill antigo quando a barra nova existir */
.community-tabs.community-tabs-bar {
    display: grid;
}

.community-tabs.community-tabs-bar button {
    min-height: 64px;
}

/* =========================================================
   PAINÉIS DAS TABS
   ========================================================= */

.community-tab-panels {
    padding-top: 22px;
}

.community-tab-panel {
    display: none;
}

.community-tab-panel.is-active {
    display: block;
}

/* =========================================================
   FEED DA COMUNIDADE
   ========================================================= */

.community-feed-clean {
    max-width: 100%;
}

.community-feed-clean .community-feed-card,
.community-feed-card {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border: 1px solid rgba(15, 111, 92, 0.08);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 10px 28px rgba(18, 42, 35, 0.04);
}

.community-feed-card > span {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #f0f7f1;
    color: var(--primary);
    font-size: 0.96rem;
    font-weight: 1000;
}

.community-feed-card p {
    margin: 0;
    color: var(--text);
    font-weight: 760;
    line-height: 1.42;
}

.community-feed-card a {
    color: var(--primary);
    font-weight: 900;
}

.community-feed-card time {
    display: inline-flex;
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.78rem;
}

/* =========================================================
   ABA LIVROS — PRATELEIRA
   ========================================================= */

.community-books-shelf {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 28px 16px;
}

.community-shelf-book {
    min-width: 0;
}

.community-shelf-cover {
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border-radius: 7px;
    background: #f1f3f2;
    text-decoration: none;
    box-shadow: 0 10px 22px rgba(18, 42, 35, 0.1);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.community-shelf-book:hover .community-shelf-cover {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px rgba(18, 42, 35, 0.16);
}

.community-shelf-cover img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.community-shelf-cover span {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    background:
        radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 34%),
        linear-gradient(180deg, #12372a 0%, #0d2d23 100%);
    color: #fff;
    font-size: 2rem;
    font-weight: 1000;
    letter-spacing: 0.08em;
}

.community-shelf-info {
    padding-top: 8px;
}

.community-shelf-info h3 {
    margin: 0;
    color: var(--primary);
    font-size: 0.92rem;
    line-height: 1.22;
    font-weight: 1000;
    letter-spacing: -0.01em;
}

.community-shelf-info h3 a {
    color: inherit;
    text-decoration: none;
}

.community-shelf-info h3 a:hover {
    color: var(--accent-strong);
}

.community-shelf-info p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.community-shelf-info small {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 850;
}

.community-shelf-info small span {
    color: var(--accent-strong);
}

/* =========================================================
   ESCRITORES / MEMBROS
   ========================================================= */

.community-people-grid-clean {
    display: grid;
    gap: 16px;
}

.community-people-grid-clean .community-person-card,
.community-person-card {
    padding: 18px 14px;
    border: 1px solid rgba(15, 111, 92, 0.08);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    text-align: center;
    box-shadow: 0 10px 28px rgba(18, 42, 35, 0.04);
}

.community-person-card h3 {
    margin: 0 0 4px;
    color: var(--primary);
}

.community-person-card p {
    margin: 0 0 6px;
    color: var(--muted);
}

.community-person-card span {
    display: block;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 750;
}

.community-person-card a {
    display: inline-flex;
    margin-top: 10px;
    color: var(--accent-strong);
    font-weight: 900;
    text-decoration: none;
}

.community-avatar {
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 50%;
    background: #eef7ef;
    color: var(--primary);
    font-weight: 1000;
}

.community-avatar-large {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
}

.community-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =========================================================
   ESTADOS VAZIOS
   ========================================================= */

.community-empty {
    padding: 18px;
    border: 1px solid rgba(15, 111, 92, 0.08);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--muted);
    font-weight: 800;
    box-shadow: 0 12px 32px rgba(18, 42, 35, 0.05);
}

.community-empty h1 {
    margin: 0 0 8px;
    color: var(--primary);
}

.community-empty p {
    margin: 0 0 12px;
}

.community-empty a {
    color: var(--accent-strong);
    font-weight: 900;
}

/* =========================================================
   RESPONSIVO
   ========================================================= */

@media (min-width: 760px) {
    .community-people-grid-clean {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1080px) {
    .community-people-grid-clean {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1180px) {
    .community-books-shelf {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .community-books-shelf {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .community-detail-cover-social {
        border-radius: 22px;
    }

    .community-detail-content {
        padding: 24px;
    }

    .community-detail-cover-social .community-detail-head {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .community-detail-cover-social .community-symbol-large {
        margin: 0 auto;
    }

    .community-detail-cover-social .community-detail-bar {
        justify-content: center;
    }

    .community-tabs-bar {
        overflow-x: auto;
        grid-template-columns: repeat(4, minmax(98px, 1fr));
    }

    .community-tabs-bar button {
        min-width: 98px;
    }

    .community-books-shelf {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 24px 12px;
    }
}

@media (max-width: 520px) {
    .community-detail-hero {
        padding-top: 26px;
    }

    .community-detail-cover-social h1 {
        font-size: clamp(2rem, 13vw, 3rem);
    }

    .community-tabs-bar {
        margin-left: -12px;
        margin-right: -12px;
        width: calc(100% + 24px);
        border-left: 0;
        border-right: 0;
    }

    .community-tab-label {
        font-size: 0.72rem;
    }

    .community-books-shelf {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .community-shelf-info h3 {
        font-size: 0.86rem;
    }

    .community-shelf-info p,
    .community-shelf-info small {
        font-size: 0.72rem;
    }
}