/* =========================================================
   BuddyPress enhancements (cover images, online status)
   Loaded only on BuddyPress pages via functions.php
   ========================================================= */

.ast-separate-container .ast-article-post,.ast-separate-container .ast-article-single,.ast-separate-container .comment-respond {
    padding: 0 !important;
}


/* -- Cover image card banners (groups & members directory) -- */

.bp-list:not(.grid) .buddyx-mem-cover-wrapper,
.bp-list:not(.grid) .buddyx-grp-cover-wrapper {
    display: none;
}

.buddypress-wrap .grid.bp-list > li .list-wrap .buddyx-mem-cover-wrapper + .item-avatar,
.buddypress-wrap .grid.bp-list > li .list-wrap .buddyx-grp-cover-wrapper + .item-avatar {
    margin-top: -80px;
    margin-bottom: 15px;
    position: relative;
    z-index: 1;
}

.buddypress-wrap .grid.bp-list > li .list-wrap .item-avatar img.avatar {
    border: 4px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.buddyx-mem-cover-wrapper,
.buddyx-grp-cover-wrapper {
    position: relative;
    margin: -16px;
    margin-bottom: 16px;
}

.buddyx-mem-cover-img,
.buddyx-grp-cover-img {
    border-radius: 4px 4px 0 0;
    position: relative;
    overflow: hidden;
    padding-top: 52.56%;
    display: block;
    background: linear-gradient(135deg, #c8b89a, #e8dcc8);
}

.buddyx-mem-cover-img:before,
.buddyx-grp-cover-img:before {
    background: rgba(0, 0, 0, 0.15);
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0; top: 0;
}

.buddyx-mem-cover-img img,
.buddyx-grp-cover-img img {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    margin: auto;
    z-index: 0;
    min-height: 100%;
    width: auto;
    min-width: 100%;
    object-fit: cover;
}

/* -- Online status dot -- */

.member-status {
    background: #00e652;
    border: 2px solid #fff;
    border-radius: 100%;
    position: absolute;
    width: 12px;
    height: 12px;
    right: -4px;
    top: -4px;
}

.member-status.offline {
    opacity: 0;
    visibility: hidden;
}

.grid .member-status {
    right: 18px;
    top: 5px;
    width: 14px;
    height: 14px;
}

/* -- Group/Member card list base -- */

.bp-list > li {
    margin: 0;
    padding: 0;
    border-bottom: 0;
}

.bp-list > li .list-wrap {
    position: relative;
    margin: 0.5rem 0;
    padding: 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    transition: box-shadow .15s ease;
}

.bp-list > li .list-wrap:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
}

/* -- Grid card: title as dark text, not blue link -- */
.bp-list.grid > li .list-wrap h2.list-title a,
.bp-list.grid > li .list-wrap h2.list-title a:visited {
    color: #1f2937 !important;
    text-decoration: none;
}
.bp-list.grid > li .list-wrap h2.list-title {
    margin: 0.5rem 0 0.25rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
}
.bp-list.grid > li .list-wrap p.item-meta {
    font-size: 0.8rem;
    color: #6b7280;
    text-align: center;
    margin: 0 0 0.15rem;
}
.bp-list.grid > li .list-wrap p.item-meta a,
.bp-list.grid > li .list-wrap p.last-activity a {
    color: #6b7280;
    text-decoration: none;
}

/* -- GES (Group Email Subscription) widget in directory cards only -- */
.bp-list > li .list-wrap .groups-meta.action,
.bp-list > li .list-wrap .members-meta.action {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
}

.bp-list > li .list-wrap .group-subscription-status-desc {
    display: none;
}

.bp-list > li .list-wrap .group-subscription-div {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
}

.bp-list > li .list-wrap .group-subscription-status {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
    order: 2;
}

.bp-list > li .list-wrap .group-subscription-status.gemail_icon {
    background-image: none !important;
    padding-left: 0 !important;
}

.bp-list > li .list-wrap button.ges-change {
    order: 1;
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: #e53935 !important;
    color: #fff !important;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background .15s ease;
}

.bp-list > li .list-wrap button.ges-change:hover {
    background: #c62828 !important;
}

/* GES on single group/member pages: keep inline, style as small pill button */
.item-header-cover-image-wrapper button.ges-change {
    display: inline-block;
    padding: 3px 10px;
    background: #e53935 !important;
    color: #fff !important;
    border: none;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    vertical-align: middle;
}

/* -- Single group/member cover image header -- */

/* Remove Astra's article padding and pull up to cancel #content's padding-top (40px)
   Also cancel #primary's margin-top (64px from Astra) which creates the gap above the cover image.
   Groups use body.single-item; member profiles use body.bp-user. */
body.single-item article.bp_group,
body.single-item article.bp_user,
body.bp-user article.bp_members {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: -40px !important;
}

body.single-item #primary,
body.bp-user #primary {
    margin-top: 0 !important;
}

/* Break the cover image out of Astra's constrained container to span full viewport width */
#cover-image-container {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    height: 220px;
    border-radius: 0;
    overflow: hidden;
    background: #c8b89a;
}

#buddypress #header-cover-image {
    height: 220px;
    border-radius: 0;
    overflow: hidden;
}

.item-header-cover-image-wrapper {
    position: relative;
    background: #fff;
    margin: -40px 0 0;
    padding: 1em;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    z-index: 1;
}

.item-header-cover-image-wrapper::after {
    content: "";
    display: table;
    clear: both;
}

.item-header-cover-image-wrapper.hide-header-cover-image {
    margin: 1.5rem 0 0;
}

/*
 * Override BuddyPress default CSS that was designed for the template where
 * #item-header-cover-image sits INSIDE #cover-image-container. In that
 * structure BP uses large margin-top values to push the avatar/content down
 * into the cover image area. In our structure (BuddyX-style), the avatar and
 * content sit in a separate white card below the cover image, so those
 * margins collapse through #item-header-cover-image causing a ~225px gap.
 */
#buddypress #item-header-cover-image,
#buddypress.buddypress-wrap #item-header-cover-image {
    min-height: auto !important;
    margin: 0 !important;
    padding: 0.5em 0 !important;
}

#buddypress #item-header-cover-image #item-header-avatar {
    margin-top: 0 !important;
    float: left;
}

#buddypress div#item-header #item-header-cover-image #item-header-content,
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-header-content {
    margin-top: 0 !important;
    clear: none !important;
    float: none !important;
    margin-left: 160px;
}

/* Group Administrators / item-actions: pin to top-right of the white header card */
#buddypress #item-header-cover-image #item-actions,
body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions {
    margin-top: 0 !important;
    position: absolute !important;
    top: 1em;
    right: 1em;
    text-align: right;
    float: none !important;
}

#buddypress #item-header-cover-image #item-header-avatar {
    margin-top: 0;
    float: left;
    margin-right: 1.5em;
    position: relative;
}

#buddypress #item-header-cover-image .avatar-wrap {
    position: relative;
    display: inline-block;
}

#buddypress #item-header-cover-image #item-header-avatar img.avatar {
    border: 4px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
    border-radius: 4px;
    max-width: 120px;
}

#buddypress div#item-header #item-header-cover-image #item-header-content {
    clear: none;
    float: none;
    margin-left: 140px;
    margin-top: 0;
    width: auto;
}

#buddypress #item-header-cover-image h2,
#buddypress #item-header-cover-image h2 a {
    color: #111;
    margin: 0 0 8px;
    font-size: 1.5rem;
}

.item-header-cover-image-wrapper .activity,
.item-header-cover-image-wrapper .group-status {
    font-size: 0.85rem;
    color: #666;
    margin: 0 0 6px;
}

.desc-wrap {
    margin: 1rem 0;
    padding: 1em;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

.buddypress-wrap .item-body {
    margin: 1rem 0;
    padding: 1em;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

/* -- Single group/member vertical sidebar nav (unified card, matching BuddyX layout) --
   Groups use body.single-item; member profiles use body.bp-user.
   :is() lets us write each rule once for both. */

/* Mobile first: nav is its own card with horizontal tabs, body card is separate */
:is(.single-item, body.bp-user) .bp-wrap {
    display: block;
    margin: 1rem 0 0;
}

:is(.single-item, body.bp-user) .bp-wrap nav#object-nav {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    margin-bottom: 1rem;
    overflow: hidden;
}

:is(.single-item, body.bp-user) .bp-wrap nav#object-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
}

:is(.single-item, body.bp-user) .bp-wrap nav#object-nav ul li {
    display: block !important;
    margin: 0;
    border-right: 1px solid #f0f0f0;
}

/* inline-flex so mobile tabs stay horizontal */
:is(.single-item, body.bp-user) .bp-wrap nav#object-nav ul li a {
    display: inline-flex !important;
    align-items: center;
    gap: 4px;
    padding: 10px 14px;
    color: #374151;
    text-decoration: none;
    font-size: 0.85rem;
    transition: background .1s ease;
    white-space: nowrap;
}

:is(.single-item, body.bp-user) .bp-wrap nav#object-nav ul li .count {
    display: inline-flex !important;
    background: #e5e7eb;
    border-radius: 10px;
    padding: 0 6px;
    font-size: 0.75rem;
    color: #6b7280;
}

:is(.single-item, body.bp-user) .bp-wrap nav#object-nav ul li a:hover {
    background: #f3f4f6;
}

:is(.single-item, body.bp-user) .bp-wrap nav#object-nav ul li.current a,
:is(.single-item, body.bp-user) .bp-wrap nav#object-nav ul li.selected a {
    color: #c0392b;
    font-weight: 600;
    background: #fff5f5;
}

/* Item body on mobile — separate card */
:is(.single-item, body.bp-user) .bp-wrap #item-body {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 1rem;
}

/* Desktop (≥749px): unified single card, nav on left with border-right */
@media screen and (min-width: 749px) {
    :is(.single-item, body.bp-user) .bp-wrap {
        display: flex !important;
        flex-flow: row nowrap;
        align-items: stretch;
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 4px;
        /* no overflow:hidden — avoids spurious scrollbar gutter on Windows;
           children use their own border-radius to clip at the card corners */
        padding: 0;
        gap: 0;
    }

    :is(.single-item, body.bp-user) .bp-wrap nav#object-nav {
        flex: 0 0 200px;
        border: none;
        border-right: 1px solid #e5e7eb;
        border-radius: 4px 0 0 4px;
        background: #fafafa;
        margin-bottom: 0;
        overflow: visible;
        min-height: 200px;
    }

    :is(.single-item, body.bp-user) .bp-wrap nav#object-nav ul {
        flex-direction: column !important;
        padding: 12px 0;
        width: 100%;
    }

    :is(.single-item, body.bp-user) .bp-wrap nav#object-nav ul li {
        display: block !important;
        width: 100%;
        border-right: none;
        border-bottom: none;
    }

    :is(.single-item, body.bp-user) .bp-wrap nav#object-nav ul li a {
        display: flex !important;
        justify-content: space-between;
        padding: 10px 16px;
        font-size: 0.9rem;
        width: 100%;
        box-sizing: border-box;
    }

    :is(.single-item, body.bp-user) .bp-wrap nav#object-nav ul li.current a,
    :is(.single-item, body.bp-user) .bp-wrap nav#object-nav ul li.selected a {
        border-left: 3px solid #c0392b;
        background: #fff;
        padding-left: 13px;
    }

    :is(.single-item, body.bp-user) .bp-wrap #item-body {
        flex: 1;
        min-width: 0;
        border: none;
        border-radius: 0 4px 4px 0;
        padding: 1rem;
        background: #fff;
    }
}

/* -- Activity list: card-per-item layout matching BuddyX -- */

.activity-list.bp-list {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
}

.activity-list.bp-list .activity-item {
    position: relative;
    margin: 1rem 0;
    padding: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
}

/* Activity item header (avatar + action text) */
.activity-list .activity-item .activity-item-head,
.activity-list .activity-item .activity-header {
    padding: 12px 15px;
}

/* Activity content body */
.activity-list .activity-item .activity-content .activity-inner {
    background: transparent;
    padding: 12px 15px;
    margin: 0;
}

.activity-list .activity-item .activity-content .activity-inner p {
    margin: 0;
    padding: 0;
}

/* Action bar (like, comment links) */
.activity-list .activity-item .activity-meta.action {
    border-top: 1px solid #f0f0f0;
    background: rgba(0,0,0,.02);
    padding: 8px 15px;
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Comments area */
.buddypress-wrap .activity-comments {
    margin: 0;
}

.buddypress-wrap .activity-comments ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.buddypress-wrap .activity-comments > ul > li {
    margin: 0;
    padding: 12px 15px;
    border-top: 1px solid #f0f0f0;
}

.buddypress-wrap .activity-comments .acomment-content p {
    margin: 0;
    padding: 0;
}

/* Override BuddyPress white-text h2 (designed for text-over-image) — we're on a white card now */
#buddypress div#item-header-cover-image h2,
#buddypress div#item-header-cover-image h2 a,
#buddypress div#item-header-cover-image h2.bp-group-title,
#buddypress div#item-header-cover-image .user-nicename,
#buddypress div#item-header-cover-image .user-displayname {
    color: #111 !important;
    text-shadow: none !important;
    font-size: 1.4rem;
    margin: 0 0 6px;
}

/* change-avatar/cover-image dashicon button — top-left of cover, hidden until hover (matches BuddyX) */
.link-change-cover-image,
.link-change-profile-image {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255,255,255,0.9);
    color: #333;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.2s ease;
    box-shadow: 0 0 3px 0 rgba(0,0,0,.2);
}

#cover-image-container:hover .link-change-cover-image,
#item-header-avatar:hover .link-change-profile-image {
    opacity: 1;
}

.link-change-cover-image .dashicons,
.link-change-profile-image .dashicons {
    color: #333;
    font-size: 16px;
    width: 16px;
    height: 16px;
}

@media screen and (max-width: 782px) {
    #buddypress #item-header-cover-image #item-header-avatar {
        float: none !important;
        margin-right: 0 !important;
        text-align: center;
    }

    #buddypress #item-header-cover-image #item-header-avatar img.avatar {
        float: none !important;
        display: block;
        margin: 0 auto 12px;
        border-radius: 50%;
    }

    #buddypress div#item-header #item-header-cover-image #item-header-content,
    body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-header-content {
        margin-left: 0 !important;
        margin-top: 0.5em !important;
        text-align: center;
    }

    #buddypress #item-header-cover-image h2,
    #buddypress #item-header-cover-image h2 a {
        text-align: center;
    }

    body.single-item.groups #buddypress div#item-header #item-header-cover-image #item-actions,
    body.bp-user #buddypress #item-header-cover-image #item-actions,
    #buddypress #item-header-cover-image #item-actions {
        position: static !important;
        text-align: center;
        margin-top: 0.75em !important;
        float: none !important;
        width: 100%;
    }
}

/* -- Activity reply form -- */

form.ac-form .ac-reply-avatar img {
    max-width: 38px;
    height: 38px;
    border-radius: 50%;
    display: block;
}

form.ac-form .ac-reply-content {
    overflow: hidden;
    padding-left: 10px;
}

form.ac-form .ac-reply-content .ac-textarea {
    width: 100%;
    box-sizing: border-box;
}

form.ac-form textarea.ac-input {
    width: 100%;
    box-sizing: border-box;
}


/* -- BuddyX-style favorite (heart) icon: make it red when active -- */

/* Default state: ensure it's a heart */
.activity-list .activity-item .activity-meta.action .fav:before,
.activity-list .activity-item .activity-meta.action .unfav:before {
    content: "\f487"; /* Heart dashicon */
    font-family: dashicons;
    font-size: 1.1rem;
    vertical-align: middle;
    margin-right: 4px;
}

/* Red color when it's an 'unfavorite' action (meaning it is CURRENTLY favorited) */
.activity-list .activity-item .activity-meta.action .unfav:before {
    color: #db2828 !important;
}

/* Optional: hover effect for the favorite button */
.activity-list .activity-item .activity-meta.action .fav:hover:before {
    color: #db2828;
    opacity: 0.7;
}

/* -- BuddyX-style 'Post Updates' (whats-new) layout -- */

#buddypress form#whats-new-form {
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 0;
    margin-bottom: 2rem;
    overflow: hidden;
    background: #fff;
}

#buddypress form#whats-new-form #whats-new-avatar {
    display: none;
}

#buddypress form#whats-new-form #whats-new-content {
    margin-left: 0;
    padding: 0;
}

#buddypress form#whats-new-form #whats-new-textarea {
    padding: 12px 15px;
    border-bottom: 1px solid #f3f4f6;
}

#buddypress form#whats-new-form textarea#whats-new {
    width: 100%;
    min-height: 50px;
    border: none;
    outline: none;
    font-size: 0.95rem;
    resize: none;
}

#buddypress form#whats-new-form #whats-new-options {
    background: #fafafa;
    padding: 8px 15px;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 50px;
}

/* BuddyX-style submit button in the form */
#buddypress form#whats-new-form #whats-new-submit input#aw-whats-new-submit {
    background-color: #e53935 !important;
    color: #fff !important;
    border: none;
    border-radius: 4px;
    padding: 6px 18px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
}

/* -- Standardized BuddyPress Buttons (Primary Actions) -- */

/* These are the buttons that should be Red like BuddyX primary buttons */
.buddypress-wrap .generic-button a,
.buddypress-wrap .comment-reply-link,
.buddypress-wrap button#aw-whats-new-submit,
.buddypress-wrap .activity-list .load-more a,
.buddypress-wrap .activity-list .load-newest a,
.buddypress-wrap #item-header-cover-image .item-buttons a,
.buddypress-wrap .standard-form input[type="submit"],
.buddypress-wrap .standard-form button[type="submit"],
form.ac-form input[type="submit"] {
    background-color: #e53935 !important;
    color: #fff !important;
    border-radius: 4px !important;
    border: none !important;
    padding: 8px 16px !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    text-transform: none !important;
    text-decoration: none !important;
    display: inline-block;
    transition: all 0.2s ease;
}

.buddypress-wrap .generic-button a:hover,
.buddypress-wrap .comment-reply-link:hover,
.buddypress-wrap .activity-list .load-more a:hover,
.buddypress-wrap .activity-list .load-newest a:hover,
form.ac-form input[type="submit"]:hover {
    background-color: #c62828 !important;
    color: #fff !important;
}

/* -- Secondary nav (group admin sub-nav, member settings sub-nav) -- */

.buddypress-wrap ul.subnav {
    width: 100%;
    background: #fafafa;
    margin: 15px 0;
    padding: 0 8px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    list-style: none;
    display: flex !important;
    flex-wrap: wrap;
}

.buddypress-wrap .bp-navs ul.subnav li a {
    padding: 8px 10px;
    display: block;
    color: #374151;
    text-decoration: none;
    font-size: 0.875rem;
}

.buddypress-wrap .bp-navs li:not(.current) a:hover,
.buddypress-wrap .bp-navs li:not(.selected) a:hover {
    background: transparent;
    color: #c0392b;
}

.buddypress-wrap .bp-navs li.current a,
.buddypress-wrap .bp-navs li.selected a {
    background: transparent;
    color: #c0392b !important;
    border-bottom: 2px solid #c0392b;
    font-weight: 500;
}

/* Activity meta action buttons (favourite, reply, delete, etc.) — white/neutral like BuddyX */
.activity-list .activity-item .activity-meta.action .button,
.activity-list .activity-item .activity-meta.action .generic-button a {
    background: #fff !important;
    color: rgba(0, 0, 0, 0.6) !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 4px !important;
    font-weight: 400 !important;
    padding: 6px 12px !important;
}

.activity-list .activity-item .activity-meta.action .button:hover,
.activity-list .activity-item .activity-meta.action .generic-button a:hover {
    border-color: rgba(0, 0, 0, 0.8) !important;
    color: rgba(0, 0, 0, 0.8) !important;
    background: #fff !important;
}

