/**
 * Hello Middleton - Plugin Overrides
 * Styles to integrate third-party plugins with our design system.
 * Isolated here for maintainability.
 *
 * Plugins covered:
 * - BuddyPress / BuddyX
 * - WPAdverts (Classifieds)
 * - The Events Calendar
 * - myCred (Trust Points)
 * - Directorist (Business Directory)
 * - Feedzy RSS
 * - wpDiscuz (Comments)
 *
 * @requires critical/tokens.css
 */

/* =========================================================================
   BUDDYPRESS / BUDDYX OVERRIDES
   ========================================================================= */

/* Activity Stream */
#buddypress .activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

#buddypress .activity-list li {
    background: var(--hm-bg-elevated);
    border: 1px solid var(--hm-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    transition: box-shadow var(--duration-fast) var(--ease-out);
}

#buddypress .activity-list li:hover {
    box-shadow: var(--shadow-sm);
}

/* Activity header */
#buddypress .activity-header {
    font-size: var(--text-sm);
    color: var(--hm-text-secondary);
    margin-bottom: var(--space-2);
}

#buddypress .activity-header a {
    color: var(--hm-primary);
    font-weight: var(--font-semibold);
}

/* Activity content */
#buddypress .activity-content {
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
}

/* Activity meta/actions */
#buddypress .activity-meta {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--hm-border);
}

#buddypress .activity-meta a {
    font-size: var(--text-xs);
    color: var(--hm-text-muted);
    text-decoration: none;
}

#buddypress .activity-meta a:hover {
    color: var(--hm-primary);
}

/* Remove duplicate spam buttons */
#buddypress .activity-meta .spam-activity.confirm,
#buddypress .activity-item .spam-activity.confirm:not(:first-of-type) {
    display: none;
}

/* Member cards */
#buddypress .bp-member-card,
#buddypress .member-list li {
    background: var(--hm-bg-elevated);
    border: 1px solid var(--hm-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

/* User avatars */
#buddypress .avatar,
#buddypress img.avatar {
    border-radius: var(--radius-full);
    border: 2px solid var(--hm-bg-elevated);
    box-shadow: var(--shadow-sm);
}

/* Profile header */
#buddypress .item-header {
    background: var(--hm-bg-elevated);
    border: 1px solid var(--hm-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
}

/* BP Buttons */
#buddypress .button,
#buddypress button,
#buddypress input[type="submit"] {
    background: var(--hm-primary);
    color: var(--hm-text-inverse);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out);
}

#buddypress .button:hover,
#buddypress button:hover {
    background: var(--hm-primary-hover);
}

/* Secondary buttons */
#buddypress .button.secondary,
#buddypress .generic-button a {
    background: var(--hm-bg-elevated);
    color: var(--hm-text);
    border: 1px solid var(--hm-border);
}

/* =========================================================================
   WPADVERTS (CLASSIFIEDS) OVERRIDES
   ========================================================================= */

/* Classified listings grid */
.adverts-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}

/* Classified card */
.adverts-list .advert-item,
.advert-single {
    background: var(--hm-bg-elevated);
    border: 1px solid var(--hm-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition:
        transform var(--duration-normal) var(--ease-out),
        box-shadow var(--duration-normal) var(--ease-out);
}

.adverts-list .advert-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Classified image */
.advert-item .advert-img {
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.advert-item .advert-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--duration-slow) var(--ease-out);
}

.advert-item:hover .advert-img img {
    transform: scale(1.05);
}

/* Classified content */
.advert-item .advert-content {
    padding: var(--space-4);
}

.advert-item .advert-title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--hm-text);
    margin: 0 0 var(--space-2);
}

.advert-item .advert-title a {
    color: inherit;
    text-decoration: none;
}

.advert-item .advert-title a:hover {
    color: var(--hm-primary);
}

/* Classified price */
.advert-item .advert-price,
.advert-price {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--hm-success);
}

/* --- Status Badges (Unified System) --- */

/* Base status badge */
.hm-status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
    line-height: 1;
}

/* SOLD badge */
.advert-item.sold::before,
.advert-sold-badge,
.hm-status-badge--sold {
    content: 'SOLD';
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    padding: var(--space-1) var(--space-3);
    background: var(--hm-sold);
    color: var(--hm-text-inverse);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3);
}

/* BUMPED badge */
.advert-item.bumped::after,
.hm-status-badge--bumped {
    content: 'BUMPED';
    position: absolute;
    top: var(--space-3);
    left: var(--space-3);
    padding: var(--space-1) var(--space-3);
    background: var(--hm-bumped);
    color: var(--hm-text-inverse);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 4px rgba(124, 58, 237, 0.3);
}

/* FEATURED badge */
.advert-item.featured .hm-status-badge--featured,
.hm-status-badge--featured {
    background: var(--hm-featured);
    color: var(--hm-text-inverse);
    box-shadow: 0 2px 4px var(--hm-primary-muted);
}

/* NEW badge */
.hm-status-badge--new {
    background: var(--hm-success);
    color: var(--hm-text-inverse);
}

/* URGENT badge */
.hm-status-badge--urgent {
    background: var(--hm-warning);
    color: var(--hm-neutral-900);
}

/* Search form */
.adverts-search-form {
    background: var(--hm-bg-elevated);
    border: 1px solid var(--hm-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

/* =========================================================================
   THE EVENTS CALENDAR OVERRIDES
   ========================================================================= */

/* Events container */
.tribe-events,
.tribe-events-calendar {
    font-family: var(--font-body);
}

/* Event cards */
.tribe-events-calendar-list__event,
.tribe-events .tribe-event {
    background: var(--hm-bg-elevated);
    border: 1px solid var(--hm-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    transition: box-shadow var(--duration-fast) var(--ease-out);
}

.tribe-events-calendar-list__event:hover,
.tribe-events .tribe-event:hover {
    box-shadow: var(--shadow-md);
}

/* Event title */
.tribe-events-calendar-list__event-title,
.tribe-event-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-semibold);
    color: var(--hm-text);
    margin: 0 0 var(--space-2);
}

.tribe-events-calendar-list__event-title a,
.tribe-event-title a {
    color: inherit;
    text-decoration: none;
}

.tribe-events-calendar-list__event-title a:hover,
.tribe-event-title a:hover {
    color: var(--hm-primary);
}

/* Event date/time */
.tribe-events-calendar-list__event-datetime,
.tribe-event-date-start {
    font-size: var(--text-sm);
    color: var(--hm-primary);
    font-weight: var(--font-medium);
}

/* Event venue */
.tribe-events-calendar-list__event-venue,
.tribe-event-venue {
    font-size: var(--text-sm);
    color: var(--hm-text-muted);
}

/* Calendar view */
.tribe-events-calendar-month__day {
    border: 1px solid var(--hm-border);
}

.tribe-events-calendar-month__day--current {
    background: var(--hm-primary-light);
}

.tribe-events-calendar-month__calendar-event {
    background: var(--hm-primary);
    color: var(--hm-text-inverse);
    border-radius: var(--radius-sm);
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
}

/* Events strip (homepage) */
.upcoming-events-strip {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.upcoming-events-strip .event-item {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--hm-bg-elevated);
    border: 1px solid var(--hm-border);
    border-radius: var(--radius-md);
}

.upcoming-events-strip .event-date {
    flex-shrink: 0;
    text-align: center;
    min-width: 50px;
}

.upcoming-events-strip .event-date-day {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--hm-primary);
    line-height: 1;
}

.upcoming-events-strip .event-date-month {
    font-size: var(--text-xs);
    color: var(--hm-text-muted);
    text-transform: uppercase;
}

/* =========================================================================
   MYCRED (TRUST POINTS) OVERRIDES
   ========================================================================= */

/* Base Trust Badge */
.mycred-badge,
.mycred-my-rank,
.hm-trust-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-2-5);
    background: var(--hm-trust-new-light);
    color: var(--hm-trust-new);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    transition: transform var(--duration-fast) var(--ease-out);
}

/* Trust Badge with Icon */
.hm-trust-badge .hm-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Gold Trust Level (Highest) */
.hm-trust-badge--gold,
.mycred-badge.gold,
[data-trust-level="gold"] .hm-trust-badge {
    background: var(--hm-trust-gold-light);
    color: var(--hm-trust-gold);
    box-shadow: 0 0 0 1px var(--hm-trust-gold), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.hm-trust-badge--gold::before {
    content: '★';
    margin-right: var(--space-0-5);
}

/* Silver Trust Level (Medium) */
.hm-trust-badge--silver,
.mycred-badge.silver,
[data-trust-level="silver"] .hm-trust-badge {
    background: var(--hm-trust-silver-light);
    color: var(--hm-trust-silver);
    box-shadow: 0 0 0 1px var(--hm-trust-silver), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.hm-trust-badge--silver::before {
    content: '✦';
    margin-right: var(--space-0-5);
}

/* Bronze Trust Level (Entry) */
.hm-trust-badge--bronze,
.mycred-badge.bronze,
[data-trust-level="bronze"] .hm-trust-badge {
    background: var(--hm-trust-bronze-light);
    color: var(--hm-trust-bronze);
    box-shadow: 0 0 0 1px var(--hm-trust-bronze);
}

.hm-trust-badge--bronze::before {
    content: '●';
    margin-right: var(--space-0-5);
    font-size: 0.6em;
}

/* New Member (No trust yet) */
.hm-trust-badge--new,
.mycred-badge.new,
[data-trust-level="new"] .hm-trust-badge {
    background: var(--hm-trust-new-light);
    color: var(--hm-trust-new);
}

/* Badge hover effect */
.hm-trust-badge:hover {
    transform: scale(1.05);
}

/* Badge sizes */
.hm-trust-badge--sm {
    padding: var(--space-0-5) var(--space-2);
    font-size: 10px;
}

.hm-trust-badge--lg {
    padding: var(--space-1-5) var(--space-3);
    font-size: var(--text-sm);
}

/* Points display */
.mycred-points,
.mycred-users-balance {
    font-family: var(--font-mono);
    font-weight: var(--font-semibold);
    color: var(--hm-accent);
}

/* Leaderboard */
.mycred-leaderboard {
    background: var(--hm-bg-elevated);
    border: 1px solid var(--hm-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.mycred-leaderboard-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--hm-border);
}

.mycred-leaderboard-row:last-child {
    border-bottom: none;
}

/* =========================================================================
   DIRECTORIST (BUSINESS DIRECTORY) OVERRIDES
   ========================================================================= */

/* Directory grid */
.directorist-listing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-4);
}

/* Business card */
.directorist-listing-single,
.directorist-listing-card {
    background: var(--hm-bg-elevated);
    border: 1px solid var(--hm-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition:
        transform var(--duration-normal) var(--ease-out),
        box-shadow var(--duration-normal) var(--ease-out);
}

.directorist-listing-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Business image */
.directorist-listing-card .listing-img {
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.directorist-listing-card .listing-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Business content */
.directorist-listing-card .listing-content {
    padding: var(--space-4);
}

.directorist-listing-card .listing-title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--hm-text);
}

/* Rating stars */
.directorist-rating .directorist-star {
    color: var(--hm-warning);
}

/* Category badges */
.directorist-category-badge {
    display: inline-block;
    padding: var(--space-0-5) var(--space-2);
    background: var(--hm-bg-muted);
    color: var(--hm-text-secondary);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

/* =========================================================================
   FEEDZY RSS OVERRIDES
   ========================================================================= */

/* RSS container */
.feedzy-rss {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

/* Ensure titles display */
.feedzy-rss .rss_item .rss_title {
    display: block !important;
    visibility: visible !important;
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--hm-text);
    line-height: var(--leading-tight);
}

/* RSS item images */
.feedzy-rss .rss_image {
    border-radius: var(--radius-md);
    overflow: hidden;
}

.feedzy-rss .rss_image img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

/* RSS meta */
.feedzy-rss .rss_meta {
    font-size: var(--text-xs);
    color: var(--hm-text-muted);
    margin-top: var(--space-2);
}

/* =========================================================================
   WPDISCUZ (COMMENTS) OVERRIDES
   ========================================================================= */

/* Comment form */
.wpdiscuz-form {
    background: var(--hm-bg-elevated);
    border: 1px solid var(--hm-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

/* Comment items */
.wpdiscuz .wpd-comment {
    background: var(--hm-bg-elevated);
    border: 1px solid var(--hm-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-3);
}

/* Comment author */
.wpdiscuz .wpd-comment-author {
    font-weight: var(--font-semibold);
    color: var(--hm-text);
}

/* Comment text */
.wpdiscuz .wpd-comment-text {
    color: var(--hm-text-secondary);
    line-height: var(--leading-relaxed);
}

/* Vote buttons */
.wpdiscuz .wpd-vote-up,
.wpdiscuz .wpd-vote-down {
    color: var(--hm-text-muted);
    transition: color var(--duration-fast) var(--ease-out);
}

.wpdiscuz .wpd-vote-up:hover {
    color: var(--hm-success);
}

.wpdiscuz .wpd-vote-down:hover {
    color: var(--hm-danger);
}

/* =========================================================================
   ELEMENTOR OVERRIDES
   ========================================================================= */

/* Reset Elementor default spacing */
.elementor-widget:not(:last-child) {
    margin-bottom: var(--space-4);
}

/* Elementor buttons */
.elementor-button {
    font-family: var(--font-body);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-md);
    transition:
        background var(--duration-fast) var(--ease-out),
        transform var(--duration-fast) var(--ease-out);
}

.elementor-button:hover {
    transform: translateY(-1px);
}

/* Elementor headings */
.elementor-heading-title {
    font-family: var(--font-display);
}

/* Fix Elementor container alignment */
.e-con {
    --container-max-width: var(--content-width);
}
