/* Homer Patuach - BuddyPress Tweaks - Main Stylesheet */

/* --- General & Fonts --- */
body.buddypress, .buddypress-wrap {
    font-family: 'Rubik', sans-serif !important;
}
#buddypress button, #buddypress a, #buddypress input, #buddypress textarea, #buddypress select {
    font-family: 'Rubik', sans-serif !important;
}


/* --- Custom User Bar --- */
.hp-bp-user-bar {
    background: #ffffff;
    border-bottom: 1px solid #e9ebee;
    padding: 5px 0;
}
.hp-bp-user-bar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: flex-end; /* Aligns to left in RTL */
}

/* Logged-out state */
.hp-bp-user-bar .hp-bp-user-links {
    display: flex;
    align-items: center;
    gap: 15px;
}
.hp-bp-user-bar .hp-bp-user-links a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}
.hp-bp-user-bar .hp-bp-user-links a.button-register {
    background-color: #7699f2;
    color: white;
    padding: 8px 18px;
    border-radius: 20px;
    transition: opacity 0.2s;
}
.hp-bp-user-bar .hp-bp-user-links a.button-register:hover {
    opacity: 0.9;
}


/* Logged-in state dropdown menu */
.hp-bp-user-menu {
    position: relative;
}
.hp-bp-profile-trigger {
    background: none;
    border: none;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    display: block;
}
.hp-bp-profile-trigger .avatar {
    display: block;
    border-radius: 50%;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    width: 40px;
    height: 40px;
    object-fit: cover;
}
.hp-bp-profile-trigger:hover .avatar,
.hp-bp-profile-trigger[aria-expanded="true"] .avatar {
    border-color: #7699f2;
}

.hp-bp-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: auto;
    background: white;
    border: 1px solid #e9ebee;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    width: 200px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.hp-bp-dropdown-menu[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.hp-bp-dropdown-menu a {
    padding: 10px 20px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    display: block;
    transition: background-color 0.2s;
}
.hp-bp-dropdown-menu a:hover {
    background-color: #f5f5f5;
}
.hp-bp-dropdown-menu a.logout-link {
    border-top: 1px solid #e9ebee;
    color: #d9534f;
}


/* --- Profile Header --- */
#buddypress #cover-image-container {
    background-color: #e9ebee;
    background-size: cover;
    background-position: center;
    min-height: 220px !important;
}

#buddypress #item-header {
    background: linear-gradient(135deg, #FB8255, #FB6965) !important;
    margin-top: 0;
    padding: 10px 0;
    position: relative;
    border: none !important;
    box-shadow: none !important;
}

#buddypress #item-header-avatar {
    float: right;
    margin-left: 20px;
    margin-top: -80px; /* Pull the avatar up */
    border: 4px solid white;
    background-color: white;
    border-radius: 50%;
}

#buddypress #item-header-content {
    padding-top: 5px; /* Adjust for the thin strip */
    text-align: right;
}

#buddypress #item-header-content h2 a {
    color: white !important;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3) !important;
    font-size: 2rem;
}

/* --- BP General Styles --- */
#buddypress #item-nav ul li a, #buddypress .bp-navs ul li a {
    border-radius: 8px 8px 0 0 !important;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}
#buddypress #item-nav ul li.current a, #buddypress .bp-navs ul li.current a {
    background-color: #7699f2 !important; /* Use main theme color */
    color: white !important;
    font-weight: 700;
}
#buddypress #item-nav ul li a:hover {
     background-color: #e9ebee;
}

#buddypress #item-header-content h2 a {
    color: white !important; /* White text for better visibility on cover image */
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5) !important;
}


/* --- BuddyPress Form & Notice Styling --- */
/* General form styling, retained for settings pages etc. */
#buddypress div#template-notices div.bp-template-notice {
    background: #eaf1ff !important;
    border-right: 5px solid #7699f2 !important;
    color: #333;
    border-radius: 4px;
    padding: 12px 20px;
    margin-bottom: 20px;
}
.buddypress-wrap form .label,
.buddypress-wrap form label {
    font-weight: 600 !important;
    color: #333;
    display: block;
    margin-bottom: 8px;
}
.buddypress-wrap form input[type="text"],
.buddypress-wrap form input[type="email"],
.buddypress-wrap form input[type="password"],
.buddypress-wrap form textarea {
    border-radius: 8px !important;
    border: 1px solid #ccc !important;
    padding: 10px 15px !important;
    transition: all 0.2s ease !important;
    width: 100%;
}
.buddypress-wrap form input:focus,
.buddypress-wrap form textarea:focus {
    border-color: #7699f2 !important;
    box-shadow: 0 0 8px rgba(118, 153, 242, 0.4) !important;
}

/* Generic submit buttons */
.buddypress-wrap form .submit input[type="submit"] {
    background: linear-gradient(135deg, #FB8255, #FB6965) !important;
    color: white !important;
    font-weight: 600 !important;
    border: none !important;
    border-radius: 20px !important;
    padding: 12px 25px !important;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 1.5rem !important;
}
.buddypress-wrap form .submit input[type="submit"]:hover {
    opacity: 0.9;
}


/* --- Custom Registration Form --- */
#hp-bp-custom-register-form {
    max-width: 500px;
    margin: 40px auto;
    padding: 30px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    direction: rtl;
}
#hp-bp-custom-register-form .form-row {
    margin-bottom: 20px;
}
#hp-bp-custom-register-form label {
    font-weight: 600;
    color: #333;
    display: block;
    margin-bottom: 8px;
    font-size: 16px;
}
#hp-bp-custom-register-form input[type="text"],
#hp-bp-custom-register-form input[type="email"],
#hp-bp-custom-register-form input[type="password"],
#hp-bp-custom-register-form textarea {
    width: 100%;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #ccc;
    transition: all 0.2s ease;
    font-size: 16px;
}
#hp-bp-custom-register-form input:focus,
#hp-bp-custom-register-form textarea:focus {
    border-color: #7699f2;
    box-shadow: 0 0 0 3px rgba(118, 153, 242, 0.2);
    outline: none;
}
#hp-bp-custom-register-form .description {
    font-size: 13px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}
#hp-bp-custom-register-form .submit-row input[type="submit"] {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #FB8255, #FB6965);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.2s;
}
#hp-bp-custom-register-form .submit-row input[type="submit"]:hover {
    opacity: 0.9;
}
#hp-bp-custom-register-form .login-link {
    text-align: center;
    margin-top: 25px;
    font-size: 14px;
}
#hp-bp-custom-register-form .login-link a {
    color: #7699f2;
    font-weight: 600;
}
.hp-bp-reg-errors {
    background: #ffebe9;
    border: 1px solid #ffc2ba;
    border-right: 5px solid #d9534f;
    color: #c72525;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 25px;
}
.hp-bp-reg-errors p {
    margin: 0;
    padding: 5px 0;
}


/* --- Floating Button --- */
.hp-bp-floating-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #7699f2;
    color: white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 999;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
.hp-bp-floating-button:hover {
    background-color: #5a77c3;
}
.hp-bp-floating-button i {
    font-size: 24px;
} 

/* BuddyPress Profile Header Tweaks */
#buddypress #item-header-cover-image {
    margin-bottom: 0; /* Removes the grey bar under the cover image */
}

#buddypress #item-header-avatar img {
    border-radius: 50% !important; /* Makes the avatar a perfect circle */
    width: 150px !important; /* Ensure consistent size */
    height: 150px !important;
    object-fit: cover; /* Prevents the image from being squashed */
}

#buddypress #item-header-content h2.user-nicename {
    font-size: 28px;
    margin-top: -65px; /* Pulls the name up closer to the avatar */
    margin-right: 170px; /* Adjusts horizontal position relative to avatar */
    color: #333;
    background: rgba(255, 255, 255, 0.7);
    padding: 5px 15px;
    border-radius: 8px;
    display: inline-block;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    #buddypress #item-header-content h2.user-nicename {
        margin-top: 15px;
        margin-right: 0;
        display: block;
        text-align: center;
    }
} 

/* --- Responsive Menu Fixes --- */
@media (max-width: 768px) {
    /* Ensure our custom user bar stays visible and behaves */
    .hp-bp-user-bar {
        padding: 5px 10px; /* Reduce padding on mobile */
    }

    .hp-bp-user-bar-inner {
        justify-content: flex-end; /* Keep icon to the left (in RTL) */
        padding: 0;
    }

    /* Make sure the profile trigger (the account icon) is always visible */
    .hp-bp-profile-trigger {
        display: block !important;
        order: 2; /* Place it after the mobile menu toggle if one exists */
    }

    /* Position the dropdown menu correctly on mobile */
    .hp-bp-dropdown-menu {
        left: 0;
        right: auto;
        width: 240px; /* Give it a bit more space */
    }

    /* This is a common class for theme's mobile menu toggles. 
       We add some space to avoid overlap with our profile icon. */
    .main-header-menu-toggle {
        margin-left: 15px; /* Adjust as needed */
    }
}

/* --- Fixes --- */
/* Hide the default BuddyPress/Theme profile icon in the header to prevent duplication */
#wp-admin-bar-my-account, /* BuddyPress Default Admin Bar item */
.header-account-icon /* Common theme class - adjust if needed */ {
    display: none !important;
} 

.hp-bp-user-menu .logout-link {
    border-top: 1px solid #eee;
}

/* Make sure dropdown is above content */
.hp-bp-user-menu .hp-bp-dropdown-menu {
    z-index: 1000;
}

/*
=========================================
  User Reputation Stats (Profile Header)
=========================================
*/
.hpg-user-stats-container {
    display: flex;
    justify-content: space-around;
    background-color: #fafafa;
    border-radius: 12px;
    padding: 20px 15px;
    margin: 25px 0;
    border: 1px solid #e7e7e7;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.hpg-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    text-align: center;
}

.hpg-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1;
}

.hpg-stat-label {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 500;
}

/*
=========================================
  User Bio on Profile
=========================================
*/
.hpg-profile-bio-container {
    padding: 20px;
    background-color: #ffffff;
    border-radius: 8px;
    margin-top: 25px;
    line-height: 1.7;
    font-size: 16px;
    color: #555;
    border: 1px solid #e7e7e7;
    text-align: right;
}

.hpg-profile-bio-container p:last-child {
    margin-bottom: 0;
}

.hpg-profile-bio-container a {
    color: #FB7A5F; /* A color that matches the theme */
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid rgba(251, 122, 95, 0.3);
    transition: all 0.2s ease-in-out;
}

.hpg-profile-bio-container a:hover {
    background-color: rgba(251, 122, 95, 0.1);
    border-bottom-color: #FB7A5F;
}

/* Character counter for Bio editor */
.hpg-char-counter {
    font-size: 13px;
    color: #666;
    text-align: left;
    margin-top: 5px;
    direction: ltr;
}

/* Author Box in Single Post */
.hpg-author-box {
    margin-top: 30px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Puts space between info and button */
    gap: 20px;
}

.hpg-author-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.hpg-author-avatar img {
    border-radius: 50%;
    width: 60px;
    height: 60px;
    object-fit: cover;
}

.hpg-author-name {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}
.hpg-author-name a {
    text-decoration: none;
    color: #333;
    transition: color 0.2s;
}
.hpg-author-name a:hover {
    color: #FB7A5F;
}

/* No changes needed for follow button, it will be pushed to the end by justify-content */ 