/* Community Page Variables */
:root {
    --hpg-primary: #ff6b35;
    --hpg-secondary: #2ec4b6;
    --hpg-dark: #1a1a1a;
    --hpg-light: #f9f9f9;
    --hpg-white: #ffffff;
    --hpg-gray: #e0e0e0;
    --hpg-text: #333333;
    --hpg-text-light: #666666;
    --hpg-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --hpg-radius: 16px;
    --hpg-font: 'Rubik', sans-serif;
}

.hpg-community-wrapper {
    font-family: var(--hpg-font);
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f4f6f8;
    direction: rtl;
}

/* Hero Section */
.hpg-community-hero {
    background: linear-gradient(135deg, #ffffff 0%, #fff8f5 100%);
    border-radius: var(--hpg-radius);
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: var(--hpg-shadow);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hpg-community-hero::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: rgba(255, 107, 53, 0.05);
    border-radius: 50%;
}

.hpg-hero-content h1 {
    font-size: 2.5rem;
    color: var(--hpg-dark);
    margin-bottom: 10px;
    font-weight: 800;
}

.hpg-hero-content p {
    font-size: 1.1rem;
    color: var(--hpg-text-light);
    margin-bottom: 30px;
}

.hpg-hero-stats {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.hpg-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hpg-stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--hpg-primary);
}

.hpg-stat-label {
    font-size: 0.9rem;
    color: var(--hpg-text-light);
}

/* Grid Layout - CRITICAL FIX */
.hpg-community-wrapper .hpg-community-grid {
    display: grid !important;
    grid-template-columns: 65% 35% !important;
    gap: 30px !important;
    align-items: start !important;
    width: 100% !important;
}

.hpg-community-wrapper .hpg-main-col {
    grid-column: 1 !important;
    width: 100% !important;
}

.hpg-community-wrapper .hpg-sidebar-col {
    grid-column: 2 !important;
    width: 100% !important;
}

@media (max-width: 768px) {
    .hpg-community-wrapper .hpg-community-grid {
        grid-template-columns: 1fr !important;
    }

    .hpg-community-wrapper .hpg-main-col,
    .hpg-community-wrapper .hpg-sidebar-col {
        grid-column: 1 !important;
    }
}

/* Sections */
.hpg-section {
    background: var(--hpg-white);
    border-radius: var(--hpg-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--hpg-shadow);
}

.hpg-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.hpg-section-header h2 {
    font-size: 1.4rem;
    margin: 0;
    color: var(--hpg-dark);
}

.hpg-see-all {
    color: var(--hpg-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Popular Posts */
.hpg-popular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.hpg-post-card {
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #eee;
    transition: transform 0.2s;
}

.hpg-post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.hpg-card-image {
    height: 140px;
    background-size: cover;
    background-position: center;
    position: relative;
}

.hpg-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.0);
    transition: background 0.2s;
}

.hpg-post-card:hover .hpg-card-overlay {
    background: rgba(0, 0, 0, 0.1);
}

.hpg-card-content {
    padding: 15px;
}

.hpg-card-content h3 {
    font-size: 1rem;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.hpg-card-content h3 a {
    color: var(--hpg-text);
    text-decoration: none;
}

.hpg-card-meta {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--hpg-text-light);
}

/* Activity List */
.hpg-activity-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.hpg-activity-item:last-child {
    border-bottom: none;
}

.hpg-activity-avatar img {
    border-radius: 50%;
}

.hpg-activity-content {
    flex: 1;
}

.hpg-activity-header {
    font-size: 0.95rem;
    margin-bottom: 5px;
}

.hpg-activity-header a {
    color: var(--hpg-primary);
    text-decoration: none;
    font-weight: 600;
}

.hpg-activity-header a:hover {
    text-decoration: underline;
}

.hpg-activity-header strong {
    color: var(--hpg-text);
}

.hpg-activity-body {
    font-size: 0.9rem;
    color: var(--hpg-text-light);
    background: #f9f9f9;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 5px;
}

.hpg-activity-date {
    font-size: 0.8rem;
    color: #999;
}

/* Visually hidden (for accessible labels) */
.hpg-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ------------------------------------------------------------
   Single Post: Add Tag UI
   ------------------------------------------------------------ */
.hpg-add-tag-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 8px;
}

.hpg-add-tag-button {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #f6f6f6;
    color: #555;
    cursor: pointer;
    font-weight: 400;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.1s;
}

.hpg-add-tag-button:hover {
    background: #ececec;
    color: #333;
}

.hpg-add-tag-button:active {
    transform: scale(0.95);
}

.hpg-add-tag-form {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.hpg-add-tag-input {
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #ddd;
    font-size: 0.85rem;
}

.hpg-add-tag-save {
    padding: 4px 10px;
    border-radius: 999px;
    border: none;
    background: var(--hpg-secondary);
    color: #fff;
    font-size: 0.8rem;
    cursor: pointer;
}

.hpg-add-tag-loading {
    opacity: 0.7;
    pointer-events: none;
}

.hpg-added-tag-badge {
    display: inline-block;
    padding: 2px 8px;
    margin-right: 4px;
    border-radius: 999px;
    background: #f1f1f1;
    font-size: 0.8rem;
}

/* Widgets */
.hpg-widget {
    background: var(--hpg-white);
    border-radius: var(--hpg-radius);
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: var(--hpg-shadow);
}

.hpg-widget-header h3 {
    font-size: 1.2rem;
    margin: 0 0 20px 0;
    color: var(--hpg-dark);
}

/* Profile Widget */
.hpg-profile-summary {
    text-align: center;
    margin-bottom: 20px;
}

.hpg-profile-summary img {
    border-radius: 50%;
    border: 3px solid var(--hpg-primary);
    padding: 2px;
    margin-bottom: 10px;
}

.hpg-profile-summary h4 {
    margin: 0;
    font-size: 1.1rem;
}

.hpg-user-role {
    font-size: 0.85rem;
    color: var(--hpg-text-light);
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: block;
    text-align: center;
}

.hpg-btn-outline:hover {
    background: var(--hpg-primary);
    color: white;
}

/* Events Widget */
.hpg-events-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hpg-events-list li {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    align-items: center;
}

.hpg-event-date {
    background: #f0f0f0;
    padding: 5px 10px;
    border-radius: 8px;
    text-align: center;
    min-width: 50px;
}

.hpg-event-date .day {
    display: block;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--hpg-dark);
}

.hpg-event-date .month {
    display: block;
    font-size: 0.8rem;
    color: var(--hpg-text-light);
}

.hpg-event-info h4 {
    margin: 0 0 5px 0;
    font-size: 0.95rem;
}

.hpg-event-info span {
    font-size: 0.85rem;
    color: var(--hpg-text-light);
    display: block;
    margin-bottom: 5px;
}

.hpg-event-join-btn {
    background: var(--hpg-primary);
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 0.8rem;
    cursor: pointer;
    margin-top: 5px;
    transition: all 0.2s;
}

.hpg-event-join-btn:hover {
    background: #ff8c42;
    transform: scale(1.05);
}

/* Friends Widget */
.hpg-friends-grid {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.hpg-friend-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.hpg-friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hpg-more-friends {
    background: #eee;
    color: #666;
    font-size: 0.75rem;
    text-decoration: none;
}

/* Groups Widget */
.hpg-groups-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hpg-group-item {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.hpg-group-item:last-child {
    border-bottom: none;
}

.hpg-group-avatar {
    flex-shrink: 0;
}

.hpg-group-avatar img {
    border-radius: 8px;
}

.hpg-group-info {
    flex: 1;
}

.hpg-group-info h4 {
    margin: 0 0 3px 0;
    font-size: 0.95rem;
}

.hpg-group-info h4 a {
    color: var(--hpg-text);
    text-decoration: none;
}

.hpg-group-info span {
    font-size: 0.8rem;
    color: var(--hpg-text-light);
}

.hpg-group-join-btn {
    background: var(--hpg-secondary);
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.hpg-group-join-btn:hover {
    background: #26a69a;
    transform: scale(1.05);
}

.hpg-group-member-badge {
    font-size: 0.8rem;
    color: var(--hpg-secondary);
    font-weight: 600;
}

.hpg-widget-footer-link {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9rem;
}

.hpg-widget-footer-link a {
    color: var(--hpg-primary);
    text-decoration: none;
}

/* Member Search Widget */
.hpg-member-search-widget .hpg-search-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.hpg-member-search-widget .hpg-search-input:focus {
    outline: none;
    border-color: var(--hpg-primary);
}

.hpg-search-results {
    margin-top: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.hpg-search-result-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.hpg-search-result-item:hover {
    background: #f9f9f9;
}

.hpg-result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-left: 10px;
}

.hpg-result-info a {
    color: var(--hpg-text);
    text-decoration: none;
    font-weight: 500;
}

.hpg-result-info a:hover {
    color: var(--hpg-primary);
}

.hpg-search-loading,
.hpg-no-results,
.hpg-search-error {
    padding: 15px;
    text-align: center;
    color: var(--hpg-text-light);
}

/* Comment Likes */
.hpg-comment-like-container {
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
}

.hpg-comment-like-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 15px;
    padding: 2px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    transition: all 0.2s;
}

.hpg-comment-like-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.hpg-comment-like-btn.liked {
    color: #e74c3c;
    border-color: #e74c3c;
    background: #fff0f0;
}

.hpg-comment-like-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 1;
}

/* Post Likes - Active State */
.hpg-like-btn.liked-by-user svg {
    fill: #e74c3c !important;
    color: #e74c3c !important;
}

.hpg-more-friends {
    background: #eee;
    color: #666;
    font-size: 0.75rem;
    text-decoration: none;
}

/* Groups Widget */
.hpg-groups-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hpg-group-item {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.hpg-group-item:last-child {
    border-bottom: none;
}

.hpg-group-avatar {
    flex-shrink: 0;
}

.hpg-group-avatar img {
    border-radius: 8px;
}

.hpg-group-info {
    flex: 1;
}

.hpg-group-info h4 {
    margin: 0 0 3px 0;
    font-size: 0.95rem;
}

.hpg-group-info h4 a {
    color: var(--hpg-text);
    text-decoration: none;
}

.hpg-group-info span {
    font-size: 0.8rem;
    color: var(--hpg-text-light);
}

.hpg-group-join-btn {
    background: var(--hpg-secondary);
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 5px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.hpg-group-join-btn:hover {
    background: #26a69a;
    transform: scale(1.05);
}

.hpg-group-member-badge {
    font-size: 0.8rem;
    color: var(--hpg-secondary);
    font-weight: 600;
}

.hpg-widget-footer-link {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9rem;
}

.hpg-widget-footer-link a {
    color: var(--hpg-primary);
    text-decoration: none;
}

/* Member Search Widget */
.hpg-member-search-widget .hpg-search-input {
    width: 100%;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.hpg-member-search-widget .hpg-search-input:focus {
    outline: none;
    border-color: var(--hpg-primary);
}

.hpg-search-results {
    margin-top: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    display: none;
}

.hpg-search-result-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.hpg-search-result-item:hover {
    background: #f9f9f9;
}

.hpg-result-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-left: 10px;
}

.hpg-result-info a {
    color: var(--hpg-text);
    text-decoration: none;
    font-weight: 500;
}

.hpg-result-info a:hover {
    color: var(--hpg-primary);
}

.hpg-search-loading,
.hpg-no-results,
.hpg-search-error {
    padding: 15px;
    text-align: center;
    color: var(--hpg-text-light);
}

/* Comment Likes */
.hpg-comment-like-container {
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
}

.hpg-comment-like-btn {
    background: none;
    border: 1px solid #ddd;
    border-radius: 15px;
    padding: 2px 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    transition: all 0.2s;
}

.hpg-comment-like-btn:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

.hpg-comment-like-btn.liked {
    color: #e74c3c;
    border-color: #e74c3c;
    background: #fff0f0;
}

.hpg-comment-like-btn .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
    line-height: 1;
}

/* Post Likes - Active State */
.hpg-like-btn.liked-by-user svg {
    fill: #e74c3c !important;
    color: #e74c3c !important;
}

.hpg-like-btn.liked-by-user {
    color: #e74c3c !important;
}

/* --- Chat-Like Comment Layout (Forced) --- */
.hpg-chat-layout {
    padding: 12px 0 !important;
    border-bottom: 1px solid #f0f0f0 !important;
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
}

/* 1. Header Row */
.hpg-comment-header {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    width: 100% !important;
    margin-bottom: 5px !important;
}

/* Avatar */
.hpg-comment-header img.avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    border: 1px solid #eee !important;
    margin: 0 !important;
}

/* Name */
.hpg-comment-header cite,
.hpg-comment-header b {
    font-weight: 700 !important;
    font-size: 14px !important;
    color: #333 !important;
    font-style: normal !important;
}

/* Date */
.hpg-comment-header a {
    color: #999 !important;
    text-decoration: none !important;
    font-size: 12px !important;
}

/* Edit Link */
.hpg-comment-header .comment-edit-link {
    font-size: 11px !important;
    color: #bbb !important;
}

/* Like Button - Push to End */
.hpg-comment-header .hpg-comment-like-container {
    margin-right: auto !important;
    /* RTL: Push to left */
    margin-left: 0 !important;
}

/* Like Button Style */
.hpg-comment-like-btn {
    background: #f5f5f5 !important;
    border: 1px solid #ddd !important;
    border-radius: 12px !important;
    padding: 2px 8px !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    font-size: 11px !important;
    color: #777 !important;
    transition: all 0.2s !important;
    line-height: 1 !important;
    height: 24px !important;
}

.hpg-comment-like-btn:hover {
    background: #e9e9e9 !important;
}

.hpg-comment-like-btn.has-likes {
    color: #e91e63 !important;
    background: #fce4ec !important;
    border-color: #f8bbd0 !important;
}

.hpg-comment-like-btn.liked {
    color: #e74c3c !important;
    background: #ffebee !important;
    border-color: #ffcdd2 !important;
}

.hpg-comment-like-btn .dashicons {
    font-size: 12px !important;
    width: 12px !important;
    height: 12px !important;
}

/* 2. Star Rating */
.hpg-chat-layout .star-rating {
    font-size: 11px !important;
    margin-top: -5px !important;
    /* Pull closer to header */
    margin-right: 42px !important;
    /* Align under name */
    display: block !important;
}

/* 3. Content */
.hpg-chat-layout .comment-content {
    margin-right: 42px !important;
    /* Align under name */
    margin-bottom: 5px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    color: #444 !important;
    padding: 0 !important;
}

.hpg-chat-layout .comment-content p {
    margin: 0 0 5px 0 !important;
}

/* 4. Reply Button */
.hpg-chat-layout .reply {
    margin-right: 42px !important;
}

.hpg-chat-layout .comment-reply-link {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #7699f2 !important;
    background: none !important;
    border: none !important;
    padding: 0 !important;
}

/* Hide Old Containers if they still exist but are empty or duplicate */
.hpg-chat-layout>.comment-author,
.hpg-chat-layout>.comment-meta {
    display: none !important;
}

/* Hide "says" */
.hpg-chat-layout .says {
    display: none !important;
}