/* WP Mostify — Frontend Styles */

/* ============================
   Existing Widget & Shortcode
   ============================ */

/* Widget List */
.wp-mostify-widget-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wp-mostify-widget-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.wp-mostify-widget-item:last-child {
    border-bottom: none;
}

.wp-mostify-widget-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    overflow: hidden;
    border-radius: 4px;
}

.wp-mostify-widget-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wp-mostify-widget-content {
    flex: 1;
    min-width: 0;
}

.wp-mostify-widget-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    color: #333;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wp-mostify-widget-title:hover {
    color: #0073aa;
}

.wp-mostify-widget-count {
    display: block;
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

/* Shortcode — List Template */
.wp-mostify-list .wp-mostify-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.wp-mostify-list .wp-mostify-item:last-child {
    border-bottom: none;
}

.wp-mostify-list .wp-mostify-thumb {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    overflow: hidden;
    border-radius: 6px;
}

.wp-mostify-list .wp-mostify-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wp-mostify-list .wp-mostify-info {
    flex: 1;
    min-width: 0;
}

.wp-mostify-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: #0073aa;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    flex-shrink: 0;
}

.wp-mostify-title {
    font-weight: 600;
    font-size: 15px;
    color: #333;
    text-decoration: none;
}

.wp-mostify-title:hover {
    color: #0073aa;
}

.wp-mostify-count {
    display: block;
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

/* Shortcode — Grid Template */
.wp-mostify-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.wp-mostify-grid .wp-mostify-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s ease;
}

.wp-mostify-grid .wp-mostify-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.wp-mostify-grid .wp-mostify-thumb {
    width: 100%;
    height: 140px;
    overflow: hidden;
}

.wp-mostify-grid .wp-mostify-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wp-mostify-grid .wp-mostify-info {
    padding: 12px;
}

.wp-mostify-grid .wp-mostify-title {
    font-size: 14px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wp-mostify-grid .wp-mostify-count {
    margin-top: 6px;
}

.wp-mostify-empty {
    color: #888;
    font-style: italic;
    padding: 10px 0;
}

/* Counter Display (auto-appended after content) */
.wp-mostify-counter-display {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 20px;
    padding: 14px 18px;
    background: #f8f9fa;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1;
}

.wp-mostify-counter-badge-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    color: #444;
    white-space: nowrap;
}

.wp-mostify-counter-badge-item .wp-mostify-counter-icon {
    font-size: 15px;
}

.wp-mostify-counter-badge-item .wp-mostify-counter-value {
    font-weight: 700;
    color: #1d2327;
}

/* Chart Display */
.wp-mostify-chart-container {
    margin-top: 16px;
    padding: 16px 20px;
    background: #f8f9fa;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    position: relative;
}

.wp-mostify-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.wp-mostify-chart-header .wp-mostify-chart-title {
    margin: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.wp-mostify-chart-period {
    font: inherit;
    font-size: 12px;
    padding: 4px 24px 4px 8px;
    border: 1px solid #d5d5d8;
    border-radius: 4px;
    background: #fff;
    color: #1d2327;
    cursor: pointer;
    max-width: 100%;
}

.wp-mostify-chart-period:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 1px;
}

.wp-mostify-chart-container.is-loading .wp-mostify-chart-body {
    opacity: 0.45;
    pointer-events: none;
    transition: opacity .15s ease;
}

/* Editable bar inputs — only rendered in admin context with edit_post cap.
   Lives inside each .wp-mostify-chart-bar-group, between the bar and label. */
.wp-mostify-chart-bars-editable .wp-mostify-chart-bar-group {
    /* Give the flex column some extra breathing room so the input doesn't
       squeeze the bar. Default chart bars use height: 120px (public) or
       90px (metabox); adding ~24px for the input row fits comfortably. */
    min-height: 0;
}

.wp-mostify-chart-bar-input {
    width: 100%;
    max-width: 48px;
    margin: 2px auto 0;
    padding: 1px 2px;
    font: inherit;
    font-size: 10px;
    line-height: 1.3;
    text-align: center;
    color: #1d2327;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 2px;
    /* Strip number spinner on browsers that show it — at 48px wide the
       spinner eats all the room. Users can still type or paste. */
    -moz-appearance: textfield;
    appearance: textfield;
}
.wp-mostify-chart-bar-input::-webkit-outer-spin-button,
.wp-mostify-chart-bar-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wp-mostify-chart-bar-input:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 0;
    border-color: #2271b1;
}

.wp-mostify-chart-bar-input.is-saving {
    opacity: 0.6;
    cursor: wait;
}

.wp-mostify-chart-bar-input.is-saved {
    background: #e8f5e9;
    border-color: #4ab866;
    transition: background .5s ease, border-color .5s ease;
}

.wp-mostify-chart-bar-input.is-error {
    background: #fdeaea;
    border-color: #d63638;
    transition: background .3s ease, border-color .3s ease;
}

/* Total editor in the chart header (admin + edit_post only). Sits between
   the chart title and the period selector. */
.wp-mostify-chart-total {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #1d2327;
    flex: 0 0 auto;
}

.wp-mostify-chart-total-label {
    font-weight: 600;
}

.wp-mostify-chart-total-input {
    width: 80px;
    padding: 3px 6px;
    font: inherit;
    font-size: 12px;
    text-align: right;
    color: #1d2327;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 3px;
    -moz-appearance: textfield;
    appearance: textfield;
}
.wp-mostify-chart-total-input::-webkit-outer-spin-button,
.wp-mostify-chart-total-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.wp-mostify-chart-total-input:focus-visible {
    outline: 2px solid #2271b1;
    outline-offset: 0;
    border-color: #2271b1;
}

.wp-mostify-chart-total-input.is-saving {
    opacity: 0.6;
    cursor: wait;
}

.wp-mostify-chart-total-input.is-saved {
    background: #e8f5e9;
    border-color: #4ab866;
    transition: background .5s ease, border-color .5s ease;
}

.wp-mostify-chart-total-input.is-error {
    background: #fdeaea;
    border-color: #d63638;
    transition: background .3s ease, border-color .3s ease;
}

.wp-mostify-chart-title {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #1d2327;
}

.wp-mostify-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 120px;
    padding-bottom: 24px;
    position: relative;
}

.wp-mostify-chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.wp-mostify-chart-bar {
    width: 100%;
    max-width: 40px;
    min-height: 3px;
    background: linear-gradient(180deg, #4f46e5, #7c3aed);
    border-radius: 4px 4px 0 0;
    transition: opacity 0.2s;
    cursor: pointer;
}

.wp-mostify-chart-bar:hover {
    opacity: 0.8;
}

.wp-mostify-chart-bar-label {
    font-size: 10px;
    color: #888;
    margin-top: 6px;
    white-space: nowrap;
}

/* ---- Shared (combined) chart ---- */
/* Legend above the bar groups, one entry per counter series. */
.wp-mostify-chart-shared .wp-mostify-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed #e2e4e7;
    font-size: 12px;
}

.wp-mostify-chart-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #1d2327;
}

.wp-mostify-chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.wp-mostify-chart-legend-icon {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: inherit;
}

.wp-mostify-chart-legend-label {
    font-weight: 500;
}

/* Bars in the combined chart: each date has a row of side-by-side mini-bars. */
.wp-mostify-chart-bars-multi .wp-mostify-chart-bar-series-wrap {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    width: 100%;
    height: 100%;
}

.wp-mostify-chart-bar-series {
    flex: 1 1 0;
    max-width: 10px;
    min-height: 2px;
    background: #5B8DEF;
    border-radius: 3px 3px 0 0;
    transition: opacity 0.2s;
    cursor: pointer;
}

.wp-mostify-chart-bar-series:hover {
    opacity: 0.8;
}

/* Negative-delta marker — applies to both single and shared charts. An
   overlay diagonal stripe signals "down" regardless of the bar's base color
   (shared charts tint bars with inline styles, so a background override
   wouldn't stick). */
.wp-mostify-chart-bar-neg {
    position: relative;
}

.wp-mostify-chart-bar-neg::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        135deg,
        transparent 0 4px,
        rgba(0, 0, 0, 0.22) 4px 8px
    );
    border-radius: inherit;
    pointer-events: none;
}

/* ---- SVG chart bodies (line / area / stepped / lollipop / sparkline) ----
   All styles share a single SVG element with preserveAspectRatio="none" so
   the plot stretches to fill the container width. Markers (circles) may
   become slightly elliptical on very wide screens — acceptable trade-off
   for full-width responsiveness without a JS library.                     */
.wp-mostify-chart-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.wp-mostify-chart-svg {
    display: block;
    width: 100%;
}
.wp-mostify-chart-body--sparkline .wp-mostify-chart-svg {
    height: 40px;
}
.wp-mostify-chart-svg-line {
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: opacity .2s;
}
.wp-mostify-chart-svg-line:hover {
    opacity: .85;
}
.wp-mostify-chart-svg-area {
    fill-opacity: .22;
}
.wp-mostify-chart-svg-dot {
    transition: r .15s ease;
    cursor: pointer;
}
.wp-mostify-chart-svg-dot:hover {
    /* SVG attribute takes precedence over CSS on older browsers — we set
       both so Chrome and Safari both grow the dot on hover. */
    r: 5;
}
.wp-mostify-chart-svg-dot.neg {
    fill: #ef4444;
}
.wp-mostify-chart-svg-stem {
    stroke-width: 2;
    stroke-linecap: round;
}
.wp-mostify-chart-svg-stem.neg {
    stroke: #ef4444;
    stroke-dasharray: 3 3;
}
.wp-mostify-chart-svg-sparkline {
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* Labels row — mirrors the 40px-per-point pitch in the SVG so the
   centered labels approximately line up with their data points.         */
.wp-mostify-chart-svg-labels {
    display: flex;
    justify-content: space-between;
    padding: 0 2px;
    font-size: 10px;
    color: #888;
}
.wp-mostify-chart-svg-label {
    flex: 1;
    text-align: center;
    white-space: nowrap;
}

/* The shared (multi-series) SVG gets a thinner line for readability when
   several series are stacked. */
.wp-mostify-chart-svg--shared .wp-mostify-chart-svg-line {
    stroke-width: 1.75;
}
.wp-mostify-chart-svg--shared.wp-mostify-chart-svg--area .wp-mostify-chart-svg-area {
    /* With multiple overlapping fills, drop the alpha further so nothing
       gets lost under the top series. */
    fill-opacity: .14;
}


/* ============================================================
   NEW: Ranking Widget System — Frontend
   ============================================================ */

/* Design tokens (scoped to the widget so theme CSS doesn't leak in).
   --wpmostify-color-0..4 are injected per-instance by the renderer and drive
   tab/accent color. --wpmostify-item-color is set on each .wpmostify-item for
   palette cycling. */
.wp-mostify-ranking {
    --wpmostify-r-radius-lg: 12px;
    --wpmostify-r-radius: 8px;
    --wpmostify-r-radius-sm: 6px;
    --wpmostify-r-gap: 10px;
    --wpmostify-r-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --wpmostify-r-shadow-md: 0 4px 14px rgba(15, 23, 42, .08), 0 1px 3px rgba(15, 23, 42, .05);
    --wpmostify-r-shadow-badge: 0 2px 6px rgba(15, 23, 42, .18);
    --wpmostify-r-border: rgba(15, 23, 42, .08);
    --wpmostify-r-border-strong: rgba(15, 23, 42, .14);
    --wpmostify-r-text: #0f172a;
    --wpmostify-r-text-muted: #64748b;
    --wpmostify-r-text-soft: #94a3b8;
    --wpmostify-r-bg: #ffffff;
    --wpmostify-r-bg-soft: #f8fafc;
    --wpmostify-r-bg-hover: #f1f5f9;
    --wpmostify-r-accent: var(--wpmostify-color-0, #2563eb);
    --wpmostify-r-gold: #eab308;
    --wpmostify-r-silver: #94a3b8;
    --wpmostify-r-bronze: #c2410c;

    color: var(--wpmostify-r-text);
    font-size: 14px;
    line-height: 1.5;
    container-type: inline-size;
    container-name: wpmostify-ranking;
}

.wp-mostify-ranking *,
.wp-mostify-ranking *::before,
.wp-mostify-ranking *::after {
    box-sizing: border-box;
}

/* ============================================================
   Tab Navigation — horizontal pills
   ============================================================ */
.wp-mostify-tab-tabs-horizontal > .wpmostify-tab-nav {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    padding: 4px;
    margin: 0 0 14px;
    background: var(--wpmostify-r-bg-soft);
    border-radius: 999px;
    overflow-x: auto;
    scrollbar-width: none;
}

.wp-mostify-tab-tabs-horizontal > .wpmostify-tab-nav::-webkit-scrollbar {
    display: none;
}

.wpmostify-tab-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--wpmostify-r-text-muted);
    cursor: pointer;
    border-radius: 999px;
    white-space: nowrap;
    transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}

.wpmostify-tab-btn:hover {
    color: var(--wpmostify-r-text);
}

.wpmostify-tab-btn:focus-visible {
    outline: 2px solid var(--wpmostify-r-accent);
    outline-offset: 2px;
}

.wpmostify-tab-btn.wpmostify-active {
    background: var(--wpmostify-r-bg);
    color: var(--wpmostify-r-accent);
    box-shadow: var(--wpmostify-r-shadow-sm);
}

/* Tab Navigation — vertical
   Labels are rotated with writing-mode: vertical-rl (widely supported:
   all major browsers). Latin characters rotate 90° clockwise and the
   button's block/inline axes swap, so padding flips naturally. */
.wp-mostify-tab-tabs-vertical {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.wp-mostify-tab-tabs-vertical > .wpmostify-tab-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
    min-width: 44px;
    flex-shrink: 0;
    background: var(--wpmostify-r-bg-soft);
    border-radius: var(--wpmostify-r-radius);
}

.wp-mostify-tab-tabs-vertical .wpmostify-tab-btn {
    padding: 14px 6px;
    border-radius: var(--wpmostify-r-radius-sm);
    min-height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    letter-spacing: .02em;
}

/* Rotate just the label text, not the button — so active pill bg and
   shadow stay oriented normally. writing-mode:vertical-rl flips Latin
   chars 90° CW (top-down reading), then transform:rotate(180deg) turns
   the whole span upside-down giving the bottom-up reading convention
   used in Western sidebar tabs (tilt head left to read). This combo is
   cross-browser because sideways-lr is Firefox-only. */
.wp-mostify-tab-tabs-vertical .wpmostify-tab-btn-label {
    display: inline-block;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.wp-mostify-tab-tabs-vertical > .wpmostify-tab-panels {
    flex: 1;
    min-width: 0;
}

/* Tab panel visibility */
.wpmostify-tab-panel {
    display: none;
}

.wpmostify-tab-panel.wpmostify-active {
    display: block;
    animation: wpmostify-fade-in .25s ease;
}

@keyframes wpmostify-fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   Accordion — shared base (vertical + horizontal)
   ============================================================ */
.wpmostify-accordion-item {
    border: 1px solid var(--wpmostify-r-border);
    border-radius: var(--wpmostify-r-radius);
    margin: 0 0 8px;
    background: var(--wpmostify-r-bg);
    overflow: hidden;
    transition: box-shadow .15s ease, border-color .15s ease;
}

.wpmostify-accordion-item[open] {
    box-shadow: var(--wpmostify-r-shadow-sm);
    border-color: var(--wpmostify-r-border-strong);
}

.wpmostify-accordion-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--wpmostify-r-text);
    background: transparent;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background .15s ease;
}

.wpmostify-accordion-header:hover {
    background: var(--wpmostify-r-bg-hover);
}

.wpmostify-accordion-header::marker,
.wpmostify-accordion-header::-webkit-details-marker {
    display: none;
}

.wpmostify-accordion-header::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--wpmostify-r-text-muted);
    border-bottom: 2px solid var(--wpmostify-r-text-muted);
    transform: rotate(-45deg);
    transition: transform .2s ease;
    flex-shrink: 0;
}

details[open] > .wpmostify-accordion-header::before {
    transform: rotate(45deg);
}

.wpmostify-accordion-body {
    padding: 4px 14px 14px;
}

/* ---- Accordion VERTICAL — horizontal row layout ----
   Items arrange left-to-right instead of stacked. Each <details> is a
   flex row: narrow vertical-text header on the left, body on the right.
   Closed items collapse to just the header (spine). The opened item
   grows to fill available row space. */
.wp-mostify-tab-accordion-vertical .wpmostify-tab-panels {
    display: flex;
    flex-direction: row;
    gap: 6px;
    align-items: stretch;
    overflow-x: auto;
    scrollbar-width: thin;
}

.wp-mostify-tab-accordion-vertical .wpmostify-accordion-item {
    display: flex;
    flex-direction: row;
    flex: 0 0 44px;
    margin: 0;
    min-height: 220px;
    transition: flex-basis .25s ease, box-shadow .15s ease;
}

.wp-mostify-tab-accordion-vertical .wpmostify-accordion-item[open] {
    flex: 1 1 240px;
    min-width: 200px;
}

.wp-mostify-tab-accordion-vertical .wpmostify-accordion-header {
    padding: 14px 10px;
    min-width: 44px;
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    letter-spacing: .02em;
    background: var(--wpmostify-r-bg-soft);
    border-right: 1px solid var(--wpmostify-r-border);
    transition: background .15s ease, color .15s ease;
}

/* Rotate the label span only — bottom-to-top reading. Button padding
   and bg stay in their normal orientation. */
.wp-mostify-tab-accordion-vertical .wpmostify-accordion-title {
    display: inline-block;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.wp-mostify-tab-accordion-vertical .wpmostify-accordion-header:hover {
    background: var(--wpmostify-r-bg-hover);
    color: var(--wpmostify-r-text);
}

.wp-mostify-tab-accordion-vertical .wpmostify-accordion-item[open] > .wpmostify-accordion-header {
    background: var(--wpmostify-r-bg);
    color: var(--wpmostify-r-accent);
    box-shadow: inset 3px 0 0 var(--wpmostify-r-accent);
}

/* Chevron doesn't translate to a horizontal accordion — hide it */
.wp-mostify-tab-accordion-vertical .wpmostify-accordion-header::before {
    display: none;
}

.wp-mostify-tab-accordion-vertical .wpmostify-accordion-body {
    padding: 14px;
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    max-height: 560px;
}

/* ============================================================
   Shared item primitives (used by all list styles)
   ============================================================ */
.wp-mostify-ranking .wpmostify-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wp-mostify-ranking .wpmostify-item {
    display: flex;
    align-items: center;
    gap: var(--wpmostify-r-gap);
    padding: 10px;
    border-radius: var(--wpmostify-r-radius-sm);
    position: relative;
    transition: background .15s ease;
}

/* Rank badge */
.wp-mostify-ranking .wpmostify-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: var(--wpmostify-item-color, var(--wpmostify-r-accent));
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.wp-mostify-ranking .wpmostify-medal {
    background: none !important;
    color: inherit;
    font-size: 22px;
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .12));
}

/* Thumbnail + placeholder */
.wp-mostify-ranking .wpmostify-thumb {
    position: relative;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: var(--wpmostify-r-radius-sm);
    overflow: hidden;
    background: var(--wpmostify-r-bg-soft);
}

.wp-mostify-ranking .wpmostify-thumb a {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.wp-mostify-ranking .wpmostify-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wp-mostify-ranking .wpmostify-thumb--placeholder a {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
        var(--wpmostify-item-color, var(--wpmostify-r-accent)) 0%,
        rgba(255, 255, 255, .35) 140%);
    color: #fff;
}

.wp-mostify-ranking .wpmostify-thumb-initial {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: -.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}

/* Info column */
.wp-mostify-ranking .wpmostify-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Title — 2-line clamp with ellipsis */
.wp-mostify-ranking .wpmostify-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--wpmostify-r-text);
    text-decoration: none;
    transition: color .15s ease;
    word-break: break-word;
}

.wp-mostify-ranking .wpmostify-title:hover {
    color: var(--wpmostify-item-color, var(--wpmostify-r-accent));
}

/* Excerpt */
.wp-mostify-ranking .wpmostify-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
    font-size: 13px;
    line-height: 1.4;
    color: var(--wpmostify-r-text-muted);
}

/* Meta line */
.wp-mostify-ranking .wpmostify-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--wpmostify-r-text-muted);
    line-height: 1.3;
}

.wp-mostify-ranking .wpmostify-icon {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: var(--wpmostify-item-color, var(--wpmostify-r-accent));
}

.wp-mostify-ranking .wpmostify-icon-emoji {
    font-size: 14px;
    line-height: 1;
}

.wp-mostify-ranking .wpmostify-counter-val {
    font-weight: 700;
    color: var(--wpmostify-r-text);
    font-variant-numeric: tabular-nums;
}

.wp-mostify-ranking .wpmostify-counter-label {
    color: var(--wpmostify-r-text-soft);
}

.wp-mostify-ranking .wpmostify-comments {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* Empty state */
.wp-mostify-ranking .wp-mostify-empty {
    padding: 28px 16px;
    text-align: center;
    color: var(--wpmostify-r-text-muted);
    background: var(--wpmostify-r-bg-soft);
    border-radius: var(--wpmostify-r-radius);
    font-size: 13px;
    font-style: normal;
    margin: 0;
}

/* ============================================================
   LIST STYLE: SIMPLE — clean row list with hair separator
   Box-shadow separator instead of border so rounded hover bg
   doesn't fight a hard border edge when transitioning.
   ============================================================ */
.wp-mostify-list-simple .wpmostify-list {
    gap: 0;
}

.wp-mostify-list-simple .wpmostify-item {
    padding: 10px 8px;
    border-radius: var(--wpmostify-r-radius-sm);
}

.wp-mostify-list-simple .wpmostify-item:not(:last-child) {
    box-shadow: 0 1px 0 0 var(--wpmostify-r-border);
}

.wp-mostify-list-simple .wpmostify-item:hover {
    background: var(--wpmostify-r-bg-hover);
    box-shadow: none;
}

/* ============================================================
   LIST STYLE: BARS — gradient bar as background, subtle stripe
   ============================================================ */
.wp-mostify-list-bars .wpmostify-list {
    gap: 6px;
}

.wp-mostify-list-bars .wpmostify-item {
    padding: 10px 12px;
    background: var(--wpmostify-r-bg-soft);
    border-radius: var(--wpmostify-r-radius);
    overflow: hidden;
    isolation: isolate;
}

.wp-mostify-list-bars .wpmostify-item > * {
    position: relative;
    z-index: 1;
}

.wp-mostify-list-bars .wpmostify-bar-track {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    overflow: hidden;
    z-index: 0;
}

.wp-mostify-list-bars .wpmostify-bar-fill {
    height: 100%;
    background: linear-gradient(90deg,
        var(--wpmostify-item-color, var(--wpmostify-r-accent)) 0%,
        var(--wpmostify-item-color, var(--wpmostify-r-accent)) 100%);
    opacity: .16;
    border-radius: inherit;
    transition: width .6s cubic-bezier(.2, .8, .2, 1);
}

.wp-mostify-list-bars .wpmostify-thumb {
    width: 44px;
    height: 44px;
}

.wp-mostify-list-bars .wpmostify-rank {
    width: 24px;
    height: 24px;
    font-size: 11px;
    box-shadow: 0 0 0 2px var(--wpmostify-r-bg), var(--wpmostify-r-shadow-badge);
}

.wp-mostify-list-bars .wpmostify-title {
    -webkit-line-clamp: 1;
    font-size: 13.5px;
}

.wp-mostify-list-bars .wpmostify-meta {
    font-size: 11.5px;
}

/* ============================================================
   LIST STYLE: CARDS — vertical card grid with media on top
   ============================================================ */
.wp-mostify-list-cards .wpmostify-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.wp-mostify-list-cards .wpmostify-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0;
    background: var(--wpmostify-r-bg);
    border: 1px solid var(--wpmostify-r-border);
    border-radius: var(--wpmostify-r-radius-lg);
    overflow: hidden;
    box-shadow: var(--wpmostify-r-shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.wp-mostify-list-cards .wpmostify-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--wpmostify-r-shadow-md);
    border-color: var(--wpmostify-r-border-strong);
}

/* Rank badge floats on top-left corner */
.wp-mostify-list-cards .wpmostify-rank {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    width: 28px;
    height: 28px;
    font-size: 12px;
    font-weight: 800;
    box-shadow: var(--wpmostify-r-shadow-badge);
}

.wp-mostify-list-cards .wpmostify-medal {
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    font-size: 24px;
    box-shadow: none;
}

/* Thumb: 5:3 aspect ratio, reliable across containers */
.wp-mostify-list-cards .wpmostify-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 5 / 3;
    border-radius: 0;
    background: var(--wpmostify-r-bg-soft);
}

/* Fallback for browsers without aspect-ratio (Safari <15, all fine now) */
@supports not (aspect-ratio: 5 / 3) {
    .wp-mostify-list-cards .wpmostify-thumb {
        height: 140px;
    }
}

.wp-mostify-list-cards .wpmostify-thumb--placeholder a {
    border-radius: 0;
}

.wp-mostify-list-cards .wpmostify-thumb-initial {
    font-size: 36px;
}

.wp-mostify-list-cards .wpmostify-info {
    padding: 12px 14px 14px;
    gap: 6px;
}

.wp-mostify-list-cards .wpmostify-title {
    font-size: 14px;
    -webkit-line-clamp: 2;
}

.wp-mostify-list-cards .wpmostify-meta {
    margin-top: 2px;
    padding-top: 6px;
    border-top: 1px solid var(--wpmostify-r-border);
}

/* Cards without a thumbnail: the rank badge floats absolute at top-left
   10px, 28×28 — reserve a 46px strip on top via ::before so the title
   never sits under the badge. Strip uses the item's accent color for a
   subtle visual cue that replaces the missing image.
   NOTE: .wp-mostify-no-thumb and .wp-mostify-list-cards live on the SAME
   element (the ranking container), so these are compound selectors
   (no space between the two classes). */
.wp-mostify-no-thumb.wp-mostify-list-cards .wpmostify-item::before {
    content: '';
    display: block;
    height: 46px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--wpmostify-item-color, var(--wpmostify-r-accent)) 18%, transparent) 0%,
        color-mix(in srgb, var(--wpmostify-item-color, var(--wpmostify-r-accent)) 4%, transparent) 100%);
    border-bottom: 1px solid var(--wpmostify-r-border);
    flex-shrink: 0;
}

.wp-mostify-no-thumb.wp-mostify-list-cards .wpmostify-info {
    padding-top: 12px;
    min-height: 60px;
}

/* ============================================================
   LIST STYLE: MEDAL — spotlight top 3 with tinted background
   ============================================================ */
.wp-mostify-list-medal .wpmostify-list {
    gap: 4px;
}

.wp-mostify-list-medal .wpmostify-item {
    padding: 10px 12px 10px 14px;
    border-radius: var(--wpmostify-r-radius);
    border: 1px solid transparent;
    background: var(--wpmostify-r-bg);
    transition: background .15s ease, border-color .15s ease;
}

.wp-mostify-list-medal .wpmostify-item:hover {
    background: var(--wpmostify-r-bg-hover);
}

/* Top 3 — tinted background + accent left border + medal-colored meta */
.wp-mostify-list-medal .wpmostify-rank-1 {
    --wpmostify-medal-tint: var(--wpmostify-r-gold);
    background: linear-gradient(90deg,
        rgba(234, 179, 8, .12) 0%,
        rgba(234, 179, 8, .02) 100%);
    border-left: 3px solid var(--wpmostify-r-gold);
    padding-left: 11px;
}

.wp-mostify-list-medal .wpmostify-rank-2 {
    --wpmostify-medal-tint: var(--wpmostify-r-silver);
    background: linear-gradient(90deg,
        rgba(148, 163, 184, .14) 0%,
        rgba(148, 163, 184, .02) 100%);
    border-left: 3px solid var(--wpmostify-r-silver);
    padding-left: 11px;
}

.wp-mostify-list-medal .wpmostify-rank-3 {
    --wpmostify-medal-tint: var(--wpmostify-r-bronze);
    background: linear-gradient(90deg,
        rgba(194, 65, 12, .12) 0%,
        rgba(194, 65, 12, .02) 100%);
    border-left: 3px solid var(--wpmostify-r-bronze);
    padding-left: 11px;
}

.wp-mostify-list-medal .wpmostify-rank-1:hover,
.wp-mostify-list-medal .wpmostify-rank-2:hover,
.wp-mostify-list-medal .wpmostify-rank-3:hover {
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--wpmostify-medal-tint) 22%, transparent) 0%,
        color-mix(in srgb, var(--wpmostify-medal-tint) 4%, transparent) 100%);
}

/* Make medal emoji the hero for top 3 */
.wp-mostify-list-medal .wpmostify-medal {
    width: 34px;
    height: 34px;
    font-size: 26px;
}

/* Ranks 4+ keep clean look but indent to align with bordered top 3 */
.wp-mostify-list-medal .wpmostify-item:not(.wpmostify-rank-1):not(.wpmostify-rank-2):not(.wpmostify-rank-3) {
    padding-left: 14px;
}

.wp-mostify-list-medal .wpmostify-thumb {
    width: 52px;
    height: 52px;
}

.wp-mostify-list-medal .wpmostify-title {
    font-size: 14px;
}

/* ============================================================
   Responsive — container queries for widget-area width
   ============================================================ */
/* Cards collapse to 1 column in narrow sidebars */
@container wpmostify-ranking (max-width: 360px) {
    .wp-mostify-list-cards .wpmostify-list {
        grid-template-columns: 1fr;
    }
}

@container wpmostify-ranking (max-width: 320px) {
    .wp-mostify-ranking {
        font-size: 13px;
    }

    .wp-mostify-list-simple .wpmostify-thumb,
    .wp-mostify-list-medal .wpmostify-thumb {
        width: 48px;
        height: 48px;
    }
}

/* Fallback for older browsers without container-query support +
   narrow sidebar reset: rotated text collapses to horizontal so labels
   stay legible in cramped widget areas. */
@media (max-width: 360px) {
    .wp-mostify-list-cards .wpmostify-list {
        grid-template-columns: 1fr;
    }

    .wp-mostify-tab-tabs-vertical {
        flex-direction: column;
        gap: 10px;
    }

    .wp-mostify-tab-tabs-vertical > .wpmostify-tab-nav {
        flex-direction: row;
        min-width: 0;
        border-radius: 999px;
        overflow-x: auto;
    }

    .wp-mostify-tab-tabs-vertical .wpmostify-tab-btn {
        min-height: 0;
        padding: 6px 14px;
    }

    .wp-mostify-tab-tabs-vertical .wpmostify-tab-btn-label {
        writing-mode: horizontal-tb;
        transform: none;
    }

    .wp-mostify-tab-accordion-vertical .wpmostify-tab-panels {
        flex-direction: column;
        overflow-x: hidden;
    }

    .wp-mostify-tab-accordion-vertical .wpmostify-accordion-item {
        flex: 0 0 auto;
        flex-direction: column;
        min-height: 0;
    }

    .wp-mostify-tab-accordion-vertical .wpmostify-accordion-item[open] {
        min-width: 0;
    }

    .wp-mostify-tab-accordion-vertical .wpmostify-accordion-header {
        border-right: none;
        border-bottom: 1px solid var(--wpmostify-r-border);
    }

    .wp-mostify-tab-accordion-vertical .wpmostify-accordion-title {
        writing-mode: horizontal-tb;
        transform: none;
    }

    .wp-mostify-tab-accordion-vertical .wpmostify-accordion-item[open] > .wpmostify-accordion-header {
        box-shadow: inset 0 -3px 0 var(--wpmostify-r-accent);
    }
}

/* Reduced motion — honor user preference */
@media (prefers-reduced-motion: reduce) {
    .wp-mostify-ranking *,
    .wp-mostify-ranking *::before,
    .wp-mostify-ranking *::after {
        transition-duration: 0.001ms !important;
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
    }
}