/* ==========================================================================
   BUDDYBOSS OVERRIDES MODULE
   --------------------------------------------------------------------------
   Purpose:
   - Correct, normalize, or enhance BuddyBoss default UI components
   - Fix layout issues, spacing inconsistencies, and visibility bugs
   - Override BuddyBoss navigation, edit-mode UI, repeater fields, and headers
   - Provide universal BuddyBoss-specific utilities used across all profiles

   Exclusions:
   - No profile-specific UI (belongs in profile-ui.css)
   - No snapshot UI (belongs in snapshots.css)
   - No listing or directory UI (belongs in directory.css)
   - No GravityForms or GravityView styling (belongs in forms.css)
   - No page-specific overrides (belongs in pages.css)

   Related JS:
   - profile.js (BuddyBoss profile enhancements)
   - core.js (global utilities that interact with BuddyBoss DOM)

   Sections:
   1. BuddyBoss header layout fixes
   2. Repeater field fixes
   3. Profile navigation (desktop)
   4. Profile navigation (mobile)
   5. BuddyBoss v2 navigation
   6. “More” dropdown styling
   7. High-specificity tab overrides
   8. BuddyBoss overflow fixes
   ========================================================================== */

/* ==========================================================================
   1. BuddyBoss Header Layout Fixes
   --------------------------------------------------------------------------
   Purpose:
   - Correct spacing, alignment, and positioning issues in BuddyBoss headers
   - Applies to member header meta containers across all profile types
   ========================================================================== */
   
/* Adjust header meta container positioning and padding */
#buddypress #member-header #item-header-content #item-header-meta {
    position: relative;
    padding-top: 0;
}

/* Header action positioning  */
.users-header #item-header-content {
    position: relative !important;
}

.users-header #item-header-content .member-header-actions-wrap {
    position: absolute !important;
    top: 1rem !important;
    right: 1rem !important;
    margin: 0 !important;
    align-self: auto !important;
}


/* ==========================================================================
   2. Repeater field fixes
   ========================================================================== */

.repeater_tools a.repeater_set_edit::before,
.repeater_tools a.repeater_set_delete::before {
    opacity: 1 !important;
}

.repeater_tools i.dashicons {
    display: inline-block !important;
}

#buddypress .bp-repeater-loop-item .repeater_tools {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    margin-bottom: 15px !important;
    flex-wrap: wrap !important;
}

#buddypress .bp-repeater-loop-item .item-actions {
    display: flex !important;
    align-items: center !important;
    gap: 5px !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex-shrink: 0 !important;
}

#buddypress .bp-repeater-loop-item .item-actions .repeater_set_delete,
#buddypress .bp-repeater-loop-item .item-actions .bp-repeater-remove-item,
#buddypress .repeater_tools > .repeater_set_delete,
#buddypress .repeater_tools > .bp-repeater-remove-item,
#buddypress .bp-repeater-loop-item .item-actions a.delete-button,
#buddypress .bp-repeater-loop-item a.bp-repeater-remove-item,
#buddypress .bp-repeater-loop-item .bp-delete-button,
#buddypress .bp-repeater-loop-item .item-actions .bb-icon-trash-alt:before,
#buddypress .bp-repeater-loop-item .item-actions .dashicons-trash:before {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    visibility: visible !important;
    opacity: 1 !important;
    cursor: pointer !important;
    font-size: 1.2em !important;
    color: rgb(155, 156, 159) !important;
    background-color: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    text-decoration: none !important;
    min-width: 20px !important;
    min-height: 20px !important;
}

#buddypress .bp-repeater-loop-item .item-actions .repeater_set_delete i,
#buddypress .bp-repeater-loop-item .item-actions .repeater_set_delete svg,
#buddypress .bp-repeater-loop-item .item-actions .bp-repeater-remove-item i,
#buddypress .bp-repeater-loop-item .item-actions .bp-repeater-remove-item svg,
#buddypress .repeater_tools > .repeater_set_delete i,
#buddypress .repeater_tools > .bp-repeater-remove-item i,
#buddypress .repeater_tools > .bp-repeater-remove-item svg,
#buddypress .bp-repeater-loop-item .item-actions a.delete-button i,
#buddypress .bp-repeater-loop-item .item-actions a.delete-button svg,
#buddypress .bp-repeater-loop-item a.bp-repeater-remove-item i,
#buddypress .bp-repeater-loop-item a.bp-repeater-remove-item svg,
#buddypress .bp-repeater-loop-item .bp-delete-button i,
#buddypress .bp-repeater-loop-item .bp-delete-button svg {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    font-size: 1em !important;
    line-height: 1 !important;
}

/* ==========================================================================
   3. Profile navigation – universal desktop (ORIGINAL PILL DESIGN)
   ========================================================================== */

nav#object-nav ul {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    padding: 0 !important;
    list-style: none !important;
}

nav#object-nav ul li {
    margin: 0 5px 5px 0 !important;
}

nav#object-nav ul li a {
    background-color: #ffffff !important;
    color: #000000 !important;
    padding: 10px 20px !important;
    border-radius: 25px !important;
    text-decoration: none !important;
    display: inline-block !important;
    transition: all 0.3s ease !important;
    border: 1px solid #ccc !important;
    box-shadow: none !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    border-bottom: none !important;
}

nav#object-nav ul li.current a,
nav#object-nav ul li a:hover {
    background-color: #004F7A !important;
    color: #FFFFFF !important;
    border-color: #004F7A !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-1px) !important;
}

/* ==========================================================================
   4. BuddyBoss Profile Navigation Overrides (V2 wrappers)
   ========================================================================== */

.bb-template-v2 nav#object-nav > ul > li > a {
    background-color: #f0f0f0 !important;
    color: #333 !important;
    padding: 10px 16px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    text-transform: none !important;
    text-decoration: none !important;
    display: inline-block !important;
    transition: background-color 0.2s ease, color 0.2s ease !important;
    border: none !important;
    box-shadow: none !important;
    line-height: 1.4 !important;
}

.bb-template-v2 nav#object-nav > ul > li.selected > a,
.bb-template-v2 nav#object-nav > ul > li > a:hover {
    background-color: #0077B5 !important;
    color: #fff !important;
    border: none !important;
}

.bb-template-v2 nav#object-nav > ul > li.selected > a {
    border-bottom: none !important;
}

/* ==========================================================================
   5. BuddyBoss Mobile Nav Adjustments (≤ 768px)
   ========================================================================== */

@media (max-width: 768px) {
    .bb-template-v2 nav#object-nav ul {
        justify-content: flex-start !important;
        gap: 6px !important;
        margin-bottom: 10px !important;
    }

    .bb-template-v2 nav#object-nav ul li a {
        font-size: 13px !important;
        padding: 8px 12px !important;
        border-radius: 6px !important;
        background-color: #f0f0f0 !important;
        color: #333 !important;
    }

    .bb-template-v2 nav#object-nav ul li.selected a,
    .bb-template-v2 nav#object-nav ul li a:hover {
        background-color: #0077B5 !important;
        color: #fff !important;
    }

    .bb-template-v2 nav#object-nav > ul > .selected > a {
        border-bottom: none !important;
    }
}

/* ==========================================================================
   6. “More” dropdown styling – ORIGINAL DESIGN
   ========================================================================== */

.sub-menu.bb_more_dropdown li a {
    background-color: #f0f0f0 !important;
    color: #333 !important;
    padding: 10px 16px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    text-transform: none !important;
    border: none !important;
    box-shadow: none !important;
    line-height: 1.4 !important;
    transition: background-color 0.2s ease, color 0.2s ease !important;
    display: block !important;
    text-decoration: none !important;
}

.sub-menu.bb_more_dropdown li a:hover,
.sub-menu.bb_more_dropdown li.current a {
    background-color: #0077B5 !important;
    color: #fff !important;
}

/* Add spacing between More dropdown items */
.sub-menu.bb_more_dropdown li {
    margin-bottom: 6px !important;
}

/* ==========================================================================
   7. Edit Mode Subnav Tabs (RESTORED)
   ========================================================================== */

#buddypress #profile-edit-form ul.button-tabs.button-nav {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    padding: 0 !important;
    list-style: none !important;
    margin-bottom: 20px !important;
    border-bottom: none !important;
}

#buddypress #profile-edit-form ul.button-tabs.button-nav li {
    margin: 0 5px 5px 0 !important;
}

#buddypress #profile-edit-form ul.button-tabs.button-nav li a {
    background-color: #f8f8f8 !important;
    color: #666 !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    text-decoration: none !important;
    display: inline-block !important;
    transition: all 0.3s ease !important;
    border: 1px solid #e0e0e0 !important;
    box-shadow: none !important;
    font-weight: 500 !important;
    font-size: 13px !important;
}

#buddypress #profile-edit-form ul.button-tabs.button-nav li.current a,
#buddypress #profile-edit-form ul.button-tabs.button-nav li a:hover {
    background-color: #DBEEF8 !important;
    color: #0077B5 !important;
    border-color: #0077B5 !important;
    box-shadow: 0 1px 3px rgba(0, 119, 181, 0.2) !important;
    transform: translateY(-1px) !important;
}

/* ==========================================================================
   8. High-Specificity Tab Style Matching (RESTORED)
   ========================================================================== */

.bb-template-v2 .buddypress-wrap nav#object-nav > ul > li > a {
    display: flex !important;
    align-items: center !important;
    padding: 0 15px !important;
    line-height: 29px !important;
    border-radius: 6px !important;
    border: 1px solid transparent !important;
    background-color: var(--bb-content-alternate-background-color) !important;
    color: var(--bb-body-body-text-color) !important;
    font-size: 14px !important;
    text-decoration: none !important;
    transition: background-color 0.2s ease, color 0.2s ease !important;
}

.bb-template-v2 .buddypress-wrap nav#object-nav > ul > li.selected > a,
.bb-template-v2 .buddypress-wrap nav#object-nav > ul > li > a:hover {
    background-color: #555 !important;
    color: #fafafa !important;
    font-weight: 600 !important;
}
