/**
 * Hello Middleton - Mobile Plugin Overrides
 * BuddyPress, Events Calendar, Classifieds mobile-specific styles
 *
 * Uses @layer for clean specificity management instead of !important
 *
 * @version 2.2.0
 * @requires tokens.css, layers.css
 */

/* =========================================================================
   BUDDYPRESS / COMMUNITY - Activity Feed
   ========================================================================= */

@layer plugins {
    /* Wrapper resets */
    #buddypress,
    .buddypress-wrap {
        padding: 0;
    }

    /* Activity tabs - horizontal scroll */
    .activity-type-tabs,
    #activity-filter-select,
    .bp-navs {
        padding: var(--space-3);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .activity-type-tabs::-webkit-scrollbar,
    .bp-navs::-webkit-scrollbar {
        display: none;
    }

    .bp-navs li a,
    .activity-type-tabs a {
        min-height: 40px;
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-sm);
        white-space: nowrap;
        border-radius: var(--radius-full);
    }

    #activity-filter-select select {
        min-height: 48px;
        padding: var(--space-2-5) var(--space-3);
        font-size: 16px; /* Prevents iOS zoom */
        border-radius: var(--radius-md);
    }

    /* Activity items */
    .activity-item,
    .bp-activity-item,
    .pulse-items .activity-item {
        padding: var(--space-3);
        margin-bottom: var(--space-3);
        border-radius: var(--radius-lg);
        background: var(--hm-bg-elevated);
    }

    /* Avatars */
    .activity-avatar,
    .bp-avatar,
    .pulse-avatar {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }

    .activity-avatar img,
    .bp-avatar img,
    .pulse-avatar img {
        width: 44px;
        height: 44px;
        border-radius: var(--radius-full);
    }

    /* Content */
    .activity-content,
    .pulse-content {
        font-size: var(--text-base);
        line-height: var(--leading-relaxed);
    }

    .activity-header,
    .pulse-header {
        font-size: var(--text-sm);
        margin-bottom: var(--space-2);
    }

    .activity-time-since,
    .pulse-time {
        font-size: var(--text-xs);
        color: var(--hm-text-muted);
    }

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

    .activity-meta a,
    .activity-meta button {
        min-height: 36px;
        padding: var(--space-2) var(--space-3);
        font-size: var(--text-xs);
        border-radius: var(--radius-md);
    }

    /* Post form */
    #whats-new-form {
        padding: var(--space-4);
        margin-bottom: var(--space-4);
        border-radius: var(--radius-lg);
        background: var(--hm-bg-elevated);
    }

    #whats-new {
        min-height: 80px;
        padding: var(--space-3);
        font-size: 16px; /* Prevents iOS zoom */
        border-radius: var(--radius-md);
    }

    #whats-new-submit {
        min-height: 44px;
        padding: var(--space-2-5) var(--space-5);
        border-radius: var(--radius-md);
    }

    /* Photo grid */
    .pulse-photos {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-2);
    }
}

/* =========================================================================
   EVENTS CALENDAR - The Events Calendar / Modern Events
   ========================================================================= */

@layer plugins {
    /* Date picker button */
    .tribe-events-c-top-bar__datepicker-button,
    [class*="datepicker"] button {
        min-height: 44px;
        padding: var(--space-2-5) var(--space-4);
        font-size: var(--text-base);
        border-radius: var(--radius-md);
    }

    /* View selector */
    .tribe-events-c-view-selector button,
    button[aria-label*="List"],
    button[aria-label*="Grid"] {
        min-width: 44px;
        min-height: 44px;
    }

    /* Event cards */
    .tribe-events-calendar-list__event,
    .mec-event-article,
    .events-strip-item {
        padding: var(--space-3);
        margin-bottom: var(--space-3);
        border-radius: var(--radius-lg);
        background: var(--hm-bg-elevated);
    }

    /* Event date badge */
    .events-strip-date {
        min-width: 50px;
        padding: var(--space-2);
        text-align: center;
    }

    .events-strip-day {
        font-size: var(--text-xl);
        font-weight: var(--font-bold);
        line-height: 1;
    }

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

    /* Event details */
    .tribe-events-calendar-list__event-title,
    .events-strip-item-title {
        font-size: var(--text-base);
        line-height: var(--leading-snug);
        font-weight: var(--font-semibold);
    }

    .events-strip-time,
    .events-strip-venue {
        font-size: var(--text-sm);
        color: var(--hm-text-secondary);
    }

    /* Navigation buttons */
    .tribe-events-c-nav__list-item a {
        min-height: 44px;
        padding: var(--space-2-5) var(--space-4);
        border-radius: var(--radius-md);
    }
}

/* =========================================================================
   CLASSIFIEDS - AWPCP / Custom Classifieds
   ========================================================================= */

@layer plugins {
    /* Search form */
    .awpcp-search-form,
    [class*="classifieds-search"] {
        padding: var(--space-4);
        flex-direction: column;
        gap: var(--space-3);
    }

    .awpcp-search-form input,
    .awpcp-search-form select,
    [class*="classifieds"] input[type="text"],
    [class*="classifieds"] input[type="search"] {
        width: 100%;
        min-height: 48px;
        padding: var(--space-3) var(--space-4);
        font-size: 16px; /* Prevents iOS zoom */
        border-radius: var(--radius-md);
    }

    .awpcp-search-form button,
    [class*="classifieds"] button[type="submit"] {
        width: 100%;
        min-height: 48px;
        padding: var(--space-3) var(--space-5);
        font-size: var(--text-base);
        font-weight: var(--font-semibold);
        border-radius: var(--radius-md);
    }

    /* View toggle buttons */
    .awpcp-display-buttons a {
        min-width: 44px;
        min-height: 44px;
    }

    /* Listing cards */
    .awpcp-listing,
    .hm-classifieds-item {
        padding: var(--space-3);
        margin-bottom: var(--space-3);
        border-radius: var(--radius-lg);
        background: var(--hm-bg-elevated);
    }

    .awpcp-listing-title,
    .hm-classifieds-item-title {
        font-size: var(--text-base);
        font-weight: var(--font-semibold);
        line-height: var(--leading-snug);
    }

    /* Scroll items */
    .hm-classifieds-items {
        gap: var(--space-3);
    }

    .hm-classifieds-scroll-item {
        min-width: 200px;
        padding: var(--space-3);
        border-radius: var(--radius-lg);
    }
}

/* =========================================================================
   NEWS HUB - Tabs & Cards
   Note: News hub mobile styles are defined in components/news-hub.css
   with comprehensive @media (max-width: 768px) rules.
   No additional overrides needed here.
   ========================================================================= */

/* =========================================================================
   NEWS TICKER
   ========================================================================= */

@layer plugins {
    .hm-ticker-wrap {
        border-radius: var(--radius-lg);
        margin: var(--space-3);
        overflow: hidden;
    }

    .hm-ticker-label {
        padding: var(--space-2-5) var(--space-3);
        font-size: var(--text-xs);
    }

    .hm-ticker-text {
        display: none;
    }

    .hm-ticker-item {
        padding: var(--space-2-5) 0;
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .hm-ticker-title {
        font-size: var(--text-sm);
        line-height: var(--leading-snug);
    }

    .hm-ticker-source {
        font-size: var(--text-xs);
        padding: var(--space-1) var(--space-2);
    }

    .hm-ticker-track {
        animation-duration: 50s;
    }
}
