/* Design tokens load as the bp-stats-variables stylesheet dependency. */

.widget-activity-content-table th,
.widget-activity-content-table td {
    text-align: start;
    padding: 10px;
}

.wbcom-bp-stats select.bp-stats-chart-filter:not(.bp-stats-filter-modern) {
    width: 100%;
    margin-bottom: 15px;
}

/* Single Profile Report   */
.bp-stats-report-section {
    margin-bottom: 25px;
    padding-bottom: 35px;
    border-bottom: 1px solid var(--bp-stats-border-color);
}

.bp-stats-report-section h3 {
    margin-top: 0 !important;
}

.bp-stats-activity-report,
.bp-stats-message-report,
.bp-stats-group-report,
.bp-stats-engagement-report {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    margin-bottom: 10px;
    gap: 10px;
}

.bp-stats-report-section select,
.bp-stats-report-section input[type="date"] {
    height: 40px !important;
    line-height: normal !important;
    width: 150px !important;
    border-radius: 5px !important;
    padding: 8px 12px !important;
    font-size: 14px !important;
}

.bp-stats-report-section canvas {
    padding: 10px;
    background: var(--bp-stats-bg-secondary);
}

div#bp_stats_group_activity_statistics,
div#bp_stats_user_message_statistics,
div#bp_stats_engagement_statistics,
div#bp_stats_activity_statistics {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 20px;
    margin: 15px 0 0;
    font-size: 15px;
    padding: 8px 15px;
    background: var(--bp-stats-bg-tertiary);
    border-radius: 0 !important;
    overflow: hidden;
    border-bottom: 1px solid var(--bp-stats-border-color);
}

div#bp_stats_user_message_graph {
    margin-bottom: 20px;
}

#bp-stats-profile-reports-container .bp-stats-report-section:last-child {
    margin: 0;
}

.bp-stats-report-section h4 {
    font-size: 18px;
}

div#bp_stats_user_message_pie_graph {
    background: var(--bp-stats-bg-secondary);
}

canvas#profile_message_pie_graph {
    max-width: 550px;
    margin: 0 auto;
    height: auto !important;
    width: 100% !important;
}

/* Widget UI */
div#member-front-widgets.bp-sidebar {
    max-width: 100%;
    display: block;
}

/* Improved Widget Styles */
.widget.widget-block.wbcom-bp-stats {
    position: relative;
    margin: 1rem 0;
    padding: 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
    width: 100% !important;
    background: transparent;
}

.widget.widget-block.wbcom-bp-stats.bp-stats-improved {
    background: var(--bp-stats-bg-secondary);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 1px 3px var(--bp-stats-shadow-color);
}

.widget.widget-block.wbcom-bp-stats .widget-title {
    display: none; /* Hide old title, use new one */
}

/* Group and member specific styles have been moved to separate CSS files for conditional loading */

/* Modern Filter Dropdown
 * Note: the inline SVG chevron's stroke colour is URL-encoded (%23999) inside
 * a data: URI — it's part of the SVG payload, not a CSS hex declaration.
 * Cannot be tokenised without splitting the chevron into its own element. */
.bp-stats-filter-modern,
.bp-stats-chart-filter.bp-stats-filter-modern {
    padding: 6px 24px 6px 10px !important;
    border: 1px solid var(--bp-stats-border-medium) !important;
    border-radius: 20px !important;
    font-size: 11px !important;
    color: var(--bp-stats-text-muted) !important;
    background: var(--bp-stats-bg-primary) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="%23999" stroke-width="2"><polyline points="6 9 12 15 18 9"></polyline></svg>') no-repeat right 8px center !important;
    background-size: 10px !important;
    cursor: pointer !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    width: auto !important;
    min-width: 80px !important;
    max-width: 120px !important;
    transition: all 0.2s ease;
    height: 32px !important;
    line-height: 20px !important;
    margin: 0 !important;
}

.bp-stats-filter-modern:hover,
.bp-stats-chart-filter.bp-stats-filter-modern:hover {
    border-color: var(--bp-stats-border-color) !important;
    background-color: var(--bp-stats-bg-secondary) !important;
}

.bp-stats-filter-modern:focus,
.bp-stats-chart-filter.bp-stats-filter-modern:focus {
    border-color: var(--bp-stats-text-muted) !important;
    box-shadow: 0 0 0 2px var(--bp-stats-shadow-color) !important;
}

/* Mouse-focus only — keyboard users get the :focus-visible ring below
   (WCAG 2.4.7). */
.bp-stats-filter-modern:focus:not(:focus-visible),
.bp-stats-chart-filter.bp-stats-filter-modern:focus:not(:focus-visible) {
    outline: none !important;
}

.bp-stats-filter-modern:focus-visible,
.bp-stats-chart-filter.bp-stats-filter-modern:focus-visible {
    outline: 2px solid var(--bp-stats-accent, #8b5cf6) !important;
    outline-offset: 2px !important;
}

/* Chart Container Improvements */
.bp-stats-chart-modern {
    background: var(--bp-stats-bg-primary);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
}

.widget-chart-content canvas {
    max-width: 100% !important;
    height: auto !important;
}

/* Quick Info Stats */
.bp-stats-quick-info {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--bp-stats-border-light);
    margin-top: 12px;
}

.bp-stats-info-item {
    text-align: center;
    padding: 8px;
    background: var(--bp-stats-bg-primary);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.bp-stats-info-item:hover {
    background: var(--bp-stats-bg-secondary);
    transform: translateY(-1px);
}

.info-value {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--bp-stats-text-primary);
    margin-bottom: 4px;
}

.info-label {
    display: block;
    font-size: 10px;
    color: var(--bp-stats-text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}


/* activity-content */
.bp_stats_count_number {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    line-height: 1;
}

.wb-activity-content-count {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
}

.wb-activity-count {
    background: var(--bp-stats-bg-primary);
    color: var(--bp-stats-text-primary);
    width: 48%;
    text-align: center;
    border-radius: 6px !important;
    line-height: 13px;
    overflow: hidden;
    font-size: 14px;
    padding: 12px 10px;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    margin: 1%;
    -webkit-transition: all 0.2s;
    transition: all 0.2s;
    position: relative;
    border: 1px solid var(--bp-stats-border-light);
}

.wb-activity-count::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--bp-stats-chart-gradient-start), var(--bp-stats-chart-gradient-end));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.wb-activity-count:hover {
    border-color: var(--bp-stats-border-medium);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--bp-stats-shadow-color);
}

.wb-activity-count:hover::before {
    transform: scaleX(1);
}

.wb-activity-content-count span.dashicons {
    display: none; /* Remove old icons */
}

.wb-activity-count strong {
    font-size: 24px;
    font-weight: 700;
    color: var(--bp-stats-text-primary);
    margin-bottom: 4px;
    display: block;
}

.wb-activity-count small {
    display: block;
    color: var(--bp-stats-text-muted);
    line-height: 1;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

div#bp-stats-chart-member_activities-container {
    max-width: 100% !important;
    max-height: 100% !important;
}

/* Filter */
.widget-activity-date-filter form {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    gap: 5px;
}

.widget-activity-date-filter form select {
    width: 100%;
    height: 40px !important;
    border-radius: 4px !important;
}

.widget-activity-date-filter input[type="submit"] {
    border-radius: 4px !important;
    height: 40px;
    font-size: 15px;
}

/* Group Stats - moved to bp-stats-group-widgets.css */

/* Navigation icons for BuddyX and Reign themes */
.buddyx-nav-iconic #bp-statistics-groups-li>a#bp-statistics::before,
.reign-nav-iconic #bp-statistics-personal-li>a#user-bp-statistics::before,
.reign-nav-iconic #bp-statistics-groups-li>a#bp-statistics::before {
    content: "\f080";
}

/* Basic group chart styles - detailed styles moved to bp-stats-group-widgets.css */

/* BuddyBoss Theme */
.buddyboss-theme div#bp-stats-profile-reports-container {
    max-width: 900px;
}

/* BuddyX theme */
.theme-buddyx #item-body .member-front-page .wb-activity-count {
    width: 24%;
    margin: 0.5%;
}

/* Member Front Page Widget */
#item-body .member-front-page .wb-activity-count {
    padding: 20px 15px 20px;
}

#item-body .member-front-page .wb-activity-count small {
    font-size: 15px;
}

#item-body .member-front-page .wb-activity-count strong {
    font-size: 45px;
}


@media only screen and (max-width: 640px) {

    .theme-buddyx #item-body .member-front-page .wb-activity-count {
        width: 100%;
    }

    div#bp_stats_group_activity_statistics,
    div#bp_stats_user_message_statistics,
    div#bp_stats_engagement_statistics,
    div#bp_stats_activity_statistics {
        display: block;
    }

    div#bp_stats_group_activity_statistics span,
    div#bp_stats_user_message_statistics span,
    div#bp_stats_engagement_statistics span,
    div#bp_stats_activity_statistics span {
        display: block;
    }
    
    .bp-stats-filter-modern {
        flex: 1 1 auto;
        min-width: 100px;
    }

}

/* Responsive table styles moved to bp-stats-group-widgets.css */

/* Youzify */
.youzify-main-column #bp-stats-profile-reports-container .bp-stats-report-section,
.youzify-main-column #bp-stats-group-reports-container .bp-stats-report-section {
    background-color: var(--yzfy-card-bg-color);
    margin-bottom: 25px;
    padding: 25px;
    border-radius: 4px;
}

.youzify-main-column #bp-stats-profile-reports-container .bp-stats-report-section h3,
.youzify-main-column #bp-stats-group-reports-container .bp-stats-report-section h3 {
    margin: 0 0 25px;
    line-height: normal;
}

.youzify-main-column .bp_stats_group_statistics h4 {
    margin: 0 0 10px;
}

.youzify-group-navmenu a#statistics:before {
    content: '\f201';
}

/* Widget-specific styles for groups and members have been moved to:
   - bp-stats-group-widgets.css (group statistics)
   - bp-stats-member-widgets.css (member statistics) */

/* Error state styles for AJAX failures */
.bp-stats-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    color: var(--bp-stats-text-muted);
    background: var(--bp-stats-bg-secondary);
    border: 1px dashed var(--bp-stats-border-color);
    border-radius: 8px;
    min-height: 100px;
}

.bp-stats-error-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.bp-stats-error-small {
    padding: 10px;
    font-size: 12px;
    min-height: auto;
}

.bp-stats-retry-btn {
    margin-top: 10px;
    padding: 6px 16px;
    background: var(--bp-stats-info);
    color: var(--bp-stats-text-inverse);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s ease;
}

.bp-stats-retry-btn:hover {
    background: var(--bp-stats-primary);
}

/* ====================
   Accessibility Support
   ==================== */

/* High Contrast Mode Support - For users with reduced vision */
@media (prefers-contrast: high) {
    .wb-activity-count {
        border-width: 2px;
        border-color: currentColor;
    }

    .bp-stats-filter-modern,
    .bp-stats-chart-filter.bp-stats-filter-modern {
        border-width: 2px !important;
    }

    .bp-stats-info-item {
        border: 2px solid currentColor;
    }

    .bp-stats-report-section {
        border-width: 2px;
    }

    /* Ensure minimum contrast for text */
    .info-label,
    .wb-activity-count small {
        color: inherit;
        opacity: 0.8;
    }
}

/* Reduced Motion Support - For users sensitive to animations */
@media (prefers-reduced-motion: reduce) {
    .wb-activity-count,
    .bp-stats-info-item,
    .bp-stats-filter-modern,
    .bp-stats-chart-filter,
    .bp-stats-report-section {
        transition: none;
    }

    .wb-activity-count:hover,
    .bp-stats-info-item:hover,
    .bp-stats-report-section:hover {
        transform: none;
    }

    .wb-activity-count::before {
        transition: none;
        transform: scaleX(1);
    }

    @keyframes loading {
        from, to {
            background-position: 0 0;
        }
    }
}
/* ============================================================
 * 2.0.0 — Top Contributors table mobile responsiveness.
 *
 * The .widefat table emitted by bp_stats_group_top_contributors_chart()
 * (and the matching profile-side handlers) is a wp-admin pattern that
 * was being reused on the frontend. At <=640px the 4-column table
 * overflows its container — column header "Comments" truncates and
 * the row scrolls horizontally on the parent .bp_stats_group_top_contributors_statistics
 * div instead of inside the table.
 *
 * Each <td> already carries data-label="..." — we lean on that to
 * convert each row into a stacked card under 640px. Above 640px the
 * standard table layout is unchanged.
 *
 * Captured in audit/FRONTEND_REFACTOR_PLAN.md §5 bug #2.
 * ============================================================ */

@media (max-width: 640px) {

    /* Make the container clip cleanly so no horizontal scroll
       appears on the parent div. */
    .bp_stats_group_top_contributors_statistics,
    .bp-stats-contributors-list,
    .bp-stats-group-activity-report,
    .bp-stats-profile-reports {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Stack each row vertically. The table itself becomes a list of
       row-cards. The thead row is removed visually because every td
       reproduces its label via data-label. */
    .bp_stats_group_top_contributors_statistics .widefat,
    .bp-stats-group-reports .widefat,
    .bp-stats-profile-reports .widefat {
        display: block;
        width: 100%;
        max-width: 100%;
        border: 0;
        box-shadow: none;
        background: transparent;
    }

    .bp_stats_group_top_contributors_statistics .widefat thead,
    .bp-stats-group-reports .widefat thead,
    .bp-stats-profile-reports .widefat thead {
        /* Visually hide the column header row; data-label on each
           td restores the label per cell. */
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border: 0;
    }

    .bp_stats_group_top_contributors_statistics .widefat tbody,
    .bp-stats-group-reports .widefat tbody,
    .bp-stats-profile-reports .widefat tbody {
        display: block;
    }

    .bp_stats_group_top_contributors_statistics .widefat tr,
    .bp-stats-group-reports .widefat tr,
    .bp-stats-profile-reports .widefat tr {
        display: block;
        margin-block-end: 8px;
        padding: 10px 12px;
        background: var(--bp-stats-bg-primary);
        border: 1px solid var(--bp-stats-border-color);
        border-radius: 8px;
        box-shadow: 0 1px 2px var(--bp-stats-shadow-color);
    }

    .bp_stats_group_top_contributors_statistics .widefat td,
    .bp-stats-group-reports .widefat td,
    .bp-stats-profile-reports .widefat td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 6px 0;
        border-top: 0;
        border-bottom: 1px solid var(--bp-stats-border-light);
        font-size: 14px;
        line-height: 1.4;
        word-break: break-word;
    }

    .bp_stats_group_top_contributors_statistics .widefat td:last-child,
    .bp-stats-group-reports .widefat td:last-child,
    .bp-stats-profile-reports .widefat td:last-child {
        border-bottom: 0;
    }

    .bp_stats_group_top_contributors_statistics .widefat td::before,
    .bp-stats-group-reports .widefat td::before,
    .bp-stats-profile-reports .widefat td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--bp-stats-text-muted);
        flex-shrink: 0;
        min-width: 90px;
    }
}

/* ============================================================
 * 2.0.0 Profile Reports — card-panel redesign
 *
 * All new selectors use bp-stats-* (frontend prefix) tokens from
 * bp-stats-variables.css. Zero raw hex — every colour value is a
 * var(--bp-stats-*) reference. Physical margin-left / margin-right
 * replaced with logical margin-inline-* throughout.
 * ============================================================ */

/* ──────────────────────────────────────────────
   New spacing + layout tokens used only here.
   Added to :root so they're available globally
   and can be overridden by child themes.
   ────────────────────────────────────────────── */
:root {
    --bp-stats-radius:        8px;
    --bp-stats-radius-sm:     6px;
    --bp-stats-shadow:        0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
    --bp-stats-gap-sm:        8px;
    --bp-stats-gap-md:        16px;
    --bp-stats-gap-lg:        24px;
    --bp-stats-gap-xl:        32px;
}

/* Card section wrapper — vertical rhythm between sections */
.bp-stats-card-section {
    margin-block-end: var(--bp-stats-gap-lg);
}

/* ── Card chrome ──────────────────────────────────────────── */

.bp-stats-card {
    background: var(--bp-stats-bg-primary);
    color: var(--bp-stats-text-primary);
    border: 1px solid var(--bp-stats-border-color);
    border-radius: var(--bp-stats-radius);
    box-shadow: var(--bp-stats-shadow);
    overflow: hidden;
}

.bp-stats-card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--bp-stats-gap-md);
    padding: 14px 20px 12px;
    background: var(--bp-stats-bg-secondary);
    border-block-end: 1px solid var(--bp-stats-border-color);
}

/* Title row — icon + heading inline */
.bp-stats-card__title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.bp-stats-card__title-row .bpstats-icon {
    flex-shrink: 0;
    color: var(--bp-stats-primary);
}

.bp-stats-card__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--bp-stats-text-primary);
    line-height: 1.25;
}

.bp-stats-card__body {
    padding: 20px;
}

/* ── Filter toolbar ───────────────────────────────────────── */

.bp-stats-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--bp-stats-gap-sm);
}

.bp-stats-toolbar__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bp-stats-toolbar__label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bp-stats-text-muted);
    line-height: 1;
}

.bp-stats-toolbar select,
.bp-stats-toolbar input[type="date"],
.buddypress-wrap .bp-stats-toolbar select,
.buddypress-wrap .bp-stats-toolbar input[type="date"],
.bp-user .bp-stats-toolbar select,
.bp-user .bp-stats-toolbar input[type="date"] {
    min-height: 40px;
    height: auto;
    padding-block: 8px;
    padding-inline: 12px;
    border: 1px solid var(--bp-stats-border-medium);
    border-radius: var(--bp-stats-radius-sm);
    background: var(--bp-stats-bg-primary);
    color: var(--bp-stats-text-primary);
    font-size: 14px;
    line-height: 1.4;
    box-shadow: none;
    appearance: none;
    -webkit-appearance: none;
}

.bp-stats-toolbar select:focus,
.bp-stats-toolbar input[type="date"]:focus {
    border-color: var(--bp-stats-primary);
    box-shadow: 0 0 0 3px rgba(var(--bp-stats-primary-rgb), 0.15);
}

/* Mouse-focus only — keyboard users get :focus-visible (WCAG 2.4.7). */
.bp-stats-toolbar select:focus:not(:focus-visible),
.bp-stats-toolbar input[type="date"]:focus:not(:focus-visible) {
    outline: none;
}

.bp-stats-toolbar select:focus-visible,
.bp-stats-toolbar input[type="date"]:focus-visible {
    outline: 2px solid var(--bp-stats-primary);
    outline-offset: 2px;
}

/* ── Chart wrapper + loading spinner ─────────────────────── */

.bp-stats-chart-wrap {
    position: relative;
    width: 100%;
    min-height: 220px;
    margin-block-start: var(--bp-stats-gap-md);
}

.bp-stats-chart-wrap--pie {
    min-height: 280px;
    margin-block-start: var(--bp-stats-gap-md);
}

.bp-stats-chart-canvas-wrap {
    width: 100%;
}

.bp-stats-chart-canvas-wrap canvas {
    max-width: 100%;
    height: auto;
}

/* Spinner overlay shown while AJAX loads */
.bp-stats-chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
    background: var(--bp-stats-overlay-bg);
    border-radius: var(--bp-stats-radius);
    z-index: 2;
    /* JS removes this element or hides it once charts mount. */
}

/* Hide loading overlay once the chart canvas has rendered
   (bp-stats-member-widgets.js removes .loading class on
   #bp_stats_*_graph — keep in sync). */
#bp_stats_activity_graph:not(.loading) ~ .bp-stats-chart-loading,
#bp_stats_engagement_graph:not(.loading) ~ .bp-stats-chart-loading,
#bp_stats_user_message_graph:not(.loading) ~ .bp-stats-chart-loading {
    display: none;
}

/* CSS-only spinner — mirrors the .bpstats-spinner admin pattern. */
.bp-stats-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid var(--bp-stats-border-color);
    border-top-color: var(--bp-stats-primary);
    border-radius: 50%;
    animation: bp-stats-spin 0.8s linear infinite;
}

@keyframes bp-stats-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .bp-stats-spinner {
        animation: none;
        border-top-color: var(--bp-stats-border-medium);
    }
}

/* ── Statistics summary bar (injected by JS, styled here) ─── */

div#bp_stats_activity_statistics,
div#bp_stats_engagement_statistics,
div#bp_stats_user_message_statistics {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--bp-stats-gap-md);
    margin-block-end: var(--bp-stats-gap-md);
    padding: 10px 14px;
    background: var(--bp-stats-bg-tertiary);
    border-radius: var(--bp-stats-radius-sm);
    border: 1px solid var(--bp-stats-border-light);
    font-size: 14px;
    color: var(--bp-stats-text-primary);
}

/* ── Group participation card specifics ───────────────────── */

.bp-stats-group-subheading {
    margin: 0 0 var(--bp-stats-gap-sm);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bp-stats-text-muted);
}

/* Stat mini-cards (Groups Joined / Posts / Comments) */
.bp-stats-group-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--bp-stats-gap-sm);
    margin-block-end: var(--bp-stats-gap-lg);
}

.bp-stats-stat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 14px 10px;
    background: var(--bp-stats-bg-secondary);
    border: 1px solid var(--bp-stats-border-color);
    border-radius: var(--bp-stats-radius);
    text-align: center;
}

.bp-stats-stat-number {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    color: var(--bp-stats-primary);
    font-variant-numeric: tabular-nums;
}

.bp-stats-stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--bp-stats-text-muted);
    line-height: 1.3;
}

/* Most active groups list */
.bp-stats-active-groups {
    margin-block-start: var(--bp-stats-gap-md);
}

.bp-stats-groups-simple {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Individual group items rendered by MemberStatsWidgets.populateSimpleGroupsList() */
.bp-stats-group-simple-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--bp-stats-gap-sm);
    padding: 10px 14px;
    background: var(--bp-stats-bg-secondary);
    border: 1px solid var(--bp-stats-border-light);
    border-radius: var(--bp-stats-radius-sm);
    font-size: 13px;
}

.bp-stats-group-simple-name {
    font-weight: 600;
    color: var(--bp-stats-text-primary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bp-stats-group-simple-activity {
    flex-shrink: 0;
    font-size: 12px;
    color: var(--bp-stats-text-muted);
}

/* Empty / no-data state (injected by JS) */
.bp-stats-no-data-simple {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--bp-stats-gap-sm);
    padding: 32px 16px;
    text-align: center;
    color: var(--bp-stats-text-muted);
    background: var(--bp-stats-bg-secondary);
    border: 1px dashed var(--bp-stats-border-color);
    border-radius: var(--bp-stats-radius);
}

.bp-stats-no-data-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--bp-stats-tint-primary-alt);
    border-radius: 50%;
    color: var(--bp-stats-primary);
}

.bp-stats-no-data-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--bp-stats-text-muted);
    max-width: 280px;
}

/* Lucide icon sizing inside profile reports */
.bp-stats-card .bpstats-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ── Responsive ───────────────────────────────────────────── */

/* 1024 px — toolbar wraps but cards stay full-width */
@media (max-width: 1024px) {
    .bp-stats-card__head {
        gap: var(--bp-stats-gap-sm);
    }
}

/* 640 px — full-width stack; toolbar inputs fill row */
@media (max-width: 640px) {
    .bp-stats-card__head {
        flex-direction: column;
        align-items: flex-start;
    }

    .bp-stats-toolbar {
        width: 100%;
    }

    .bp-stats-toolbar__field {
        flex: 1 1 100%;
    }

    .bp-stats-toolbar select,
    .bp-stats-toolbar input[type="date"] {
        width: 100%;
    }

    .bp-stats-group-stats {
        grid-template-columns: 1fr;
    }

    .bp-stats-stat-number {
        font-size: 22px;
    }

    .bp-stats-group-simple-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .bp-stats-group-simple-activity {
        font-size: 11px;
    }

    .bp-stats-chart-wrap {
        min-height: 160px;
    }

    div#bp_stats_activity_statistics,
    div#bp_stats_engagement_statistics,
    div#bp_stats_user_message_statistics {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
}

/*
 * Dark mode — no per-component color overrides needed. The root dark block
 * in bp-stats-variables.css flips --bp-stats-bg-* / --bp-stats-border-color /
 * --bp-stats-text-* for every dark trigger, and every rule above already
 * references those tokens, so .bp-stats-card / .bp-stats-stat-card /
 * .bp-stats-group-simple-item / .bp-stats-no-data-simple adapt automatically.
 */


/* -----------------------------------------------------------------------
 * Chart empty state (2.0.0) — used by profile activity / engagement /
 * messages when total === 0 in the selected window. Theme-token-aware
 * surface, no hardcoded brand color.
 * --------------------------------------------------------------------- */

.bp-stats-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 40px 24px;
	text-align: center;
	background: var(--bp-stats-bg-elevated);
	border: 1px dashed var(--bp-stats-border-color);
	border-radius: 12px;
	color: var(--bp-stats-text-muted);
	min-height: 200px;
}

.bp-stats-empty__icon {
	width: 56px;
	height: 56px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: color-mix(in srgb, var(--bp-stats-accent) 10%, transparent);
	color: var(--bp-stats-accent);
	margin-block-end: 4px;
}

.bp-stats-empty__title {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
	color: var(--bp-stats-text-primary);
	max-width: 460px;
	line-height: 1.4;
}

.bp-stats-empty__body {
	margin: 0;
	font-size: 13px;
	line-height: 1.55;
	max-width: 500px;
	color: var(--bp-stats-text-muted);
}
