/* ============================================================================
   PKV Ranking Page — /vergelijken/{type}/
   Product leaderboard with sidebar filters, AJAX product cards, score rings.
   Depends on: base.css (pkv-card, pkv-score, pkv-btn, etc.)
   Design: Premium polish — generous whitespace, layered shadows, data-forward
   ============================================================================ */


/* ============================================================================
   1. RANKING LAYOUT — Sidebar + Main
   Desktop: 260px sidebar, fluid main. Tablet: drawer. Mobile: stacked.
   ============================================================================ */

.pkv-ranking-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: clamp(2rem, 3.5vw + 0.5rem, 3rem);
    align-items: start;
}

.pkv-ranking-main {
    min-width: 0;
}

@media (max-width: 1024px) {
    .pkv-ranking-layout {
        grid-template-columns: 1fr;
    }
}

/* No-sidebar variant */
.pkv-ranking-layout--no-sidebar {
    grid-template-columns: 1fr;
}


/* ============================================================================
   2. SIDEBAR — Sticky on Desktop, Slide-in Drawer on Mobile
   ============================================================================ */

.pkv-sidebar {
    position: sticky;
    top: 1.5rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: clamp(1.25rem, 2.5vw, 1.75rem);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 2px 4px -2px rgba(0, 0, 0, 0.05);
    max-height: calc(100vh - 3rem);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.pkv-sidebar::-webkit-scrollbar {
    width: 4px;
}

.pkv-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.pkv-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.pkv-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* --- Sidebar header --- */

.pkv-sidebar__header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.pkv-sidebar__header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    letter-spacing: -0.01em;
}

.pkv-sidebar__clear {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0;
    font-family: inherit;
    white-space: nowrap;
    transition: color 0.15s ease;
}

.pkv-sidebar__clear:hover {
    color: var(--accent-hover);
}

.pkv-sidebar__clear:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Close button: hidden on desktop, 36px circle on mobile */
.pkv-sidebar__close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.pkv-sidebar__close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.pkv-sidebar__close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

/* --- Mobile sidebar drawer --- */

@media (max-width: 1024px) {
    .pkv-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(320px, 85vw);
        max-height: 100vh;
        border: none;
        border-right: 1px solid var(--border);
        border-radius: 0;
        z-index: 500;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
        box-shadow: none;
    }

    .pkv-sidebar--open {
        transform: translateX(0);
        box-shadow: 8px 0 32px -8px rgba(0, 0, 0, 0.2);
        background: rgba(255, 255, 255, 0.95);
    }

    html.dark .pkv-sidebar--open {
        box-shadow: 8px 0 32px -8px rgba(0, 0, 0, 0.5);
        background: rgba(30, 30, 30, 0.95);
    }

    .pkv-sidebar__close {
        display: flex;
    }
}


/* ============================================================================
   3. SIDEBAR OVERLAY — Mobile backdrop with blur when sidebar is open
   ============================================================================ */

.pkv-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 499;
    cursor: pointer;
}

html.dark .pkv-sidebar-overlay {
    background: rgba(0, 0, 0, 0.7);
}

@media (max-width: 1024px) {
    .pkv-sidebar-overlay--visible {
        display: block;
    }
}


/* ============================================================================
   4. FILTER SECTIONS — Collapsible groups within the sidebar
   ============================================================================ */

.pkv-filter-section {
    padding: clamp(1rem, 2vw + 0.125rem, 1.25rem) 0;
    margin-bottom: clamp(0.25rem, 0.5vw, 0.5rem);
    border-top: 1px solid var(--border);
}

.pkv-filter-section:first-of-type {
    border-top: none;
}

/* --- Section title with chevron indicator --- */

.pkv-filter-section__title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.5rem 0;
    margin: 0 0 0.75rem;
    text-align: left;
    font-family: inherit;
    transition: color 0.15s ease;
}

.pkv-filter-section__title:hover {
    color: var(--accent);
}

/* SVG chevron icon inside section title */
.pkv-filter-section__chevron {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    margin-left: auto;
    transition: transform 0.2s ease;
    color: var(--text-muted);
}

.pkv-filter-section__chevron--open {
    transform: rotate(180deg);
}

.pkv-filter-section__title:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Non-collapsible section titles (score, price) - render as h4, no chevron */
.pkv-filter-section__title--static {
    cursor: default;
}

.pkv-filter-section__title--static:hover {
    color: var(--text-primary);
}

.pkv-filter-section__title--static .pkv-filter-section__chevron {
    display: none;
}

h4.pkv-filter-section__title {
    cursor: default;
}

h4.pkv-filter-section__title:hover {
    color: var(--text-primary);
}

/* --- Active count badge next to section title --- */

.pkv-filter-section__active {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    margin-left: auto;
    margin-right: 0.5rem;
    min-width: 20px;
    text-align: center;
}

/* --- Section body (filter options list) --- */

.pkv-filter-section__body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: hidden;
}


/* ============================================================================
   5. FILTER OPTIONS — Individual filter items (checkbox-style)
   ============================================================================ */

.pkv-filter-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4375rem 0.5rem;
    margin: 0.125rem 0;
    border-radius: var(--radius-sm);
    border: none;
    border-left: 2px solid transparent;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    cursor: pointer;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    transition: background-color 0.15s ease, color 0.15s ease,
        border-color 0.15s ease;
}

.pkv-filter-option:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.pkv-filter-option:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    border-radius: var(--radius-sm);
}

/* Active state: accent left border + tinted background */
.pkv-filter-option--active {
    background: rgba(var(--accent-rgb), 0.08);
    color: var(--accent);
    font-weight: 600;
    border-left-color: var(--accent);
}

.pkv-filter-option--active:hover {
    background: rgba(var(--accent-rgb), 0.12);
}

/* Label text (truncated) */
.pkv-filter-option__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Count badge */
.pkv-filter-option__count {
    font-size: 0.6875rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
    margin-left: 0.5rem;
    font-weight: 500;
}

.pkv-filter-option--active .pkv-filter-option__count {
    background: rgba(var(--accent-rgb), 0.15);
    color: var(--accent);
}

/* "Show more" toggle link */
.pkv-filter-more {
    display: block;
    font-size: 0.75rem;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin-top: 0.25rem;
    font-weight: 500;
    font-family: inherit;
    transition: color 0.15s ease;
}

.pkv-filter-more:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

.pkv-filter-more:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}


/* ============================================================================
   6. FILTER SWITCH — In-stock toggle (pill toggle button)
   ============================================================================ */

.pkv-filter-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-family: inherit;
    transition: background-color 0.15s ease, color 0.15s ease,
        border-color 0.15s ease, box-shadow 0.15s ease;
}

.pkv-filter-switch:hover {
    border-color: var(--accent);
    color: var(--text-secondary);
}

.pkv-filter-switch:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Active: accent bg, white text, subtle inset glow */
.pkv-filter-switch--active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(var(--accent-rgb), 0.3);
}

.pkv-filter-switch--active:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #ffffff;
}


/* ============================================================================
   6b. FILTER PILLS — Quick-filter pill buttons (e.g. core count, VRAM)
   ============================================================================ */

.pkv-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.pkv-filter-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-secondary);
    background: transparent;
    cursor: pointer;
    min-height: 36px;
    transition: border-color 0.15s ease, color 0.15s ease,
        background-color 0.15s ease;
}

.pkv-filter-pill:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.06);
}

.pkv-filter-pill:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Active pill: solid accent fill */
.pkv-filter-pill--active {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    font-weight: 600;
}

.pkv-filter-pill--active:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #ffffff;
}


/* ============================================================================
   7. RANGE SLIDER — Dual-handle price/score inputs
   ============================================================================ */

.pkv-range-slider {
    margin-bottom: 0.25rem;
}

.pkv-range-slider__inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.pkv-range-slider label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.pkv-range-slider label span {
    font-weight: 500;
}

.pkv-range-slider input[type="number"] {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-primary);
    text-align: center;
    min-height: 36px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -moz-appearance: textfield;
    appearance: textfield;
}

.pkv-range-slider input[type="number"]::-webkit-inner-spin-button,
.pkv-range-slider input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.pkv-range-slider input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.15);
}

.pkv-range-slider__separator {
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 0.8125rem;
    align-self: flex-end;
    padding-bottom: 0.625rem;
    font-weight: 500;
}


/* ============================================================================
   8. ACTIVE FILTER CHIPS — Removable tags within sidebar
   ============================================================================ */

.pkv-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: clamp(0.75rem, 1.5vw + 0.25rem, 1rem);
}

.pkv-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3125rem 0.75rem;
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--accent);
    border: 1px solid rgba(var(--accent-rgb), 0.2);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease,
        border-color 0.15s ease;
}

.pkv-filter-chip:hover {
    background: rgba(var(--accent-rgb), 0.2);
    border-color: rgba(var(--accent-rgb), 0.35);
    color: var(--accent-hover);
}

.pkv-filter-chip:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}


/* ============================================================================
   9. SCORE RING — Conic-gradient donut chart (Hero Element)
   ============================================================================ */

.pkv-score-ring {
    --ring-color: var(--text-muted);
    --ring-size: 72px;
    flex-shrink: 0;
    margin: 0 clamp(0.125rem, 0.5vw, 0.375rem);
}

.pkv-score-ring__circle {
    position: relative;
    width: var(--ring-size);
    height: var(--ring-size);
    border-radius: 50%;
    background: conic-gradient(var(--ring-color) calc(var(--score) * 3.6deg),
            var(--bg-tertiary) 0);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Inner cutout for donut effect */
.pkv-score-ring__circle::before {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: var(--bg-primary);
}

.pkv-score-ring__value {
    position: relative;
    z-index: 1;
    font-size: clamp(1rem, 1.25vw + 0.25rem, 1.125rem);
    font-weight: 800;
    color: var(--ring-color);
    line-height: 1;
}

/* --- Tier: Excellent (green) + glow --- */
.pkv-score-ring--excellent {
    --ring-color: #16a34a;
}

.pkv-score-ring--excellent .pkv-score-ring__circle {
    box-shadow: 0 0 12px -2px rgba(22, 163, 74, 0.25);
}

html.dark .pkv-score-ring--excellent {
    --ring-color: #4ade80;
}

html.dark .pkv-score-ring--excellent .pkv-score-ring__circle {
    box-shadow: 0 0 12px -2px rgba(74, 222, 128, 0.3);
}

/* --- Tier: Good (blue) + glow --- */
.pkv-score-ring--good {
    --ring-color: #2563eb;
}

.pkv-score-ring--good .pkv-score-ring__circle {
    box-shadow: 0 0 12px -2px rgba(37, 99, 235, 0.25);
}

html.dark .pkv-score-ring--good {
    --ring-color: #60a5fa;
}

html.dark .pkv-score-ring--good .pkv-score-ring__circle {
    box-shadow: 0 0 12px -2px rgba(96, 165, 250, 0.3);
}

/* --- Tier: Average (amber) + glow --- */
.pkv-score-ring--average {
    --ring-color: #d97706;
}

.pkv-score-ring--average .pkv-score-ring__circle {
    box-shadow: 0 0 12px -2px rgba(217, 119, 6, 0.25);
}

html.dark .pkv-score-ring--average {
    --ring-color: #fbbf24;
}

html.dark .pkv-score-ring--average .pkv-score-ring__circle {
    box-shadow: 0 0 12px -2px rgba(251, 191, 36, 0.3);
}

/* --- Tier: Poor (red) + glow --- */
.pkv-score-ring--poor {
    --ring-color: #dc2626;
}

.pkv-score-ring--poor .pkv-score-ring__circle {
    box-shadow: 0 0 12px -2px rgba(220, 38, 38, 0.25);
}

html.dark .pkv-score-ring--poor {
    --ring-color: #f87171;
}

html.dark .pkv-score-ring--poor .pkv-score-ring__circle {
    box-shadow: 0 0 12px -2px rgba(248, 113, 113, 0.3);
}


/* ============================================================================
   10. RANKING LIST — Container for product cards
   ============================================================================ */

.pkv-ranking-list {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 2vw + 0.25rem, 1.5rem);
}


/* ============================================================================
   11. RANKING CARD — Horizontal product row (Most Important)
   Rank | Score Ring | Image | Body (flex:1) | Aside (price + compare)
   ============================================================================ */

.pkv-ranking-card {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2vw + 0.125rem, 1.5rem);
    padding: clamp(1.25rem, 2.5vw + 0.25rem, 1.75rem);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow:
        0 2px 4px -1px rgba(0, 0, 0, 0.03),
        0 1px 2px -1px rgba(0, 0, 0, 0.03);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.pkv-ranking-card:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--accent-rgb), 0.2);
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.06),
        0 8px 16px rgba(0, 0, 0, 0.06),
        0 16px 32px rgba(0, 0, 0, 0.04);
}

html.dark .pkv-ranking-card {
    background: rgba(30, 30, 30, 0.75);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow:
        0 2px 4px -1px rgba(0, 0, 0, 0.1),
        0 1px 2px -1px rgba(0, 0, 0, 0.08);
}

html.dark .pkv-ranking-card:hover {
    box-shadow:
        0 2px 4px rgba(0, 0, 0, 0.25),
        0 8px 16px rgba(0, 0, 0, 0.15),
        0 16px 32px rgba(0, 0, 0, 0.12);
}

/* --- Sidebar extra dark mode override to be safe --- */
html.dark .pkv-sidebar {
    background: rgba(30, 30, 30, 0.75);
    border-color: rgba(255, 255, 255, 0.08);
}

/* --- Top 3 cards: left border accent matching medal color --- */
.pkv-ranking-card--rank-1 {
    border-left: 3px solid #d4a017;
}

.pkv-ranking-card--rank-2 {
    border-left: 3px solid #94a3b8;
}

.pkv-ranking-card--rank-3 {
    border-left: 3px solid #cd7f32;
}


/* ============================================================================
   12. RANK NUMBER + PODIUM COLORS
   ============================================================================ */

.pkv-ranking-card__rank {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.125rem;
    width: clamp(2rem, 3.5vw, 2.5rem);
    height: clamp(2rem, 3.5vw, 2.5rem);
    text-align: center;
    flex-shrink: 0;
}

.pkv-ranking-card__rank span {
    font-size: clamp(1.25rem, 2.5vw + 0.25rem, 1.625rem);
    font-weight: 800;
    color: var(--text-muted);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

/* Medal colors */
.pkv-ranking-card--rank-1 .pkv-ranking-card__rank span {
    color: #d4a017;
    text-shadow: 0 2px 8px rgba(212, 160, 23, 0.4);
}

.pkv-ranking-card--rank-2 .pkv-ranking-card__rank span {
    color: #94a3b8;
    text-shadow: 0 2px 6px rgba(148, 163, 184, 0.35);
}

.pkv-ranking-card--rank-3 .pkv-ranking-card__rank span {
    color: #cd7f32;
    text-shadow: 0 2px 6px rgba(205, 127, 50, 0.35);
}

/* Crown icon for #1 */
.pkv-ranking-card__crown {
    display: block;
    width: 22px;
    height: 22px;
    margin: 0 auto 0.25rem;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(212, 160, 23, 0.5));
}


/* ============================================================================
   12b. SCORE BLOCK — Stacked label + badge between rank and image
   ============================================================================ */

.pkv-ranking-card__score-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    flex-shrink: 0;
}

.pkv-ranking-card__score-label {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    white-space: nowrap;
}


/* ============================================================================
   13. PRODUCT IMAGE
   ============================================================================ */

.pkv-ranking-card__image {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-secondary);
}

.pkv-ranking-card__image a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.pkv-ranking-card__image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

html.dark .pkv-ranking-card__image img {
    filter: brightness(0.95);
}


/* ============================================================================
   14. CARD BODY — Name + Specs (flex: 1)
   ============================================================================ */

.pkv-ranking-card__body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pkv-ranking-card__name {
    font-size: clamp(0.9375rem, 1.5vw + 0.2rem, 1.0625rem);
    font-weight: 600;
    margin: 0 0 0.25rem;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

.pkv-ranking-card__name a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.pkv-ranking-card__name a:hover {
    color: var(--accent);
}

.pkv-ranking-card__name a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* --- Inline specs --- */

.pkv-ranking-card__specs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.375rem;
}

.pkv-ranking-card__spec {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    background: var(--bg-secondary);
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
}

.pkv-ranking-card__spec svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--text-muted);
}


/* ============================================================================
   15. CARD ASIDE — Price + Compare toggle (right-aligned)
   ============================================================================ */

.pkv-ranking-card__aside {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.625rem;
    text-align: right;
    flex-shrink: 0;
}

.pkv-ranking-card__price {
    font-size: clamp(1rem, 2vw + 0.2rem, 1.25rem);
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.pkv-ranking-card__price-offers {
    font-size: 0.6875rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.pkv-ranking-card__price--unavailable {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    font-style: italic;
}


/* ============================================================================
   15b. SPEC CHIPS — Pill-shaped key spec indicators on cards
   ============================================================================ */

.pkv-spec-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    line-height: 1.4;
}

.pkv-spec-chip svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--text-muted);
}


/* ============================================================================
   15c. MOBILE DRAWER FOOTER — Sticky action bar inside sidebar on mobile
   ============================================================================ */

.pkv-mobile-drawer__footer {
    display: none;
}

@media (max-width: 1024px) {
    .pkv-mobile-drawer__footer {
        position: sticky;
        bottom: 0;
        display: flex;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        background: var(--bg-primary);
        border-top: 1px solid var(--border);
        margin: 1rem -1.25rem -1.25rem;
        padding-inline: 1.25rem;
    }

    .pkv-mobile-drawer__footer .pkv-btn {
        flex: 1;
    }
}


/* ============================================================================
   16. SORT DROPDOWN
   ============================================================================ */

.pkv-sort-select {
    appearance: none;
    -webkit-appearance: none;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 16px;
    min-height: 36px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.pkv-sort-select:hover {
    border-color: var(--accent);
}

.pkv-sort-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.15);
}

html.dark .pkv-sort-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}


/* ============================================================================
   17. PAGE HEADER ACTIONS — Sort + Filter toggle row
   ============================================================================ */

.pkv-page-header__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}


/* ============================================================================
   18. MOBILE FILTER BUTTON — Opens sidebar drawer on mobile
   ============================================================================ */

.pkv-mobile-filter-btn {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: 1px solid var(--accent);
    border-radius: 9999px;
    background: transparent;
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    min-height: 44px;
    transition: background-color 0.15s ease, color 0.15s ease,
        box-shadow 0.15s ease;
}

.pkv-mobile-filter-btn:hover {
    background: rgba(var(--accent-rgb), 0.08);
    box-shadow: 0 2px 8px -2px rgba(var(--accent-rgb), 0.2);
}

.pkv-mobile-filter-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.pkv-mobile-filter-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Filter count badge inside button */
.pkv-filter-count {
    background: var(--accent);
    color: #ffffff;
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    min-width: 18px;
    text-align: center;
    line-height: 1.3;
}

@media (max-width: 1024px) {
    .pkv-mobile-filter-btn {
        display: inline-flex;
    }
}


/* ============================================================================
   19. PAGINATION
   ============================================================================ */

.pkv-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.375rem;
    margin-top: clamp(2rem, 4vw, 3rem);
    padding-top: clamp(1.25rem, 2.5vw + 0.25rem, 1.75rem);
    border-top: 1px solid var(--border);
}

.pkv-pagination__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    font-variant-numeric: tabular-nums;
    transition: border-color 0.15s ease, color 0.15s ease,
        background-color 0.15s ease;
}

.pkv-pagination__btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.06);
}

.pkv-pagination__btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Active page */
.pkv-pagination__btn--active {
    background: linear-gradient(135deg, var(--accent), var(--brand-primary-dark));
    border-color: transparent;
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.3);
}

.pkv-pagination__btn--active:hover {
    background: linear-gradient(135deg, var(--accent-hover), var(--brand-primary-dark));
    color: #ffffff;
}

/* Disabled state */
.pkv-pagination__btn--disabled,
.pkv-pagination__btn:disabled {
    opacity: 0.3;
    pointer-events: none;
}

.pkv-pagination__btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.pkv-pagination__ellipsis {
    color: var(--text-muted);
    padding: 0 0.25rem;
    font-size: 0.875rem;
    user-select: none;
}


/* ============================================================================
   20. LOADING & SKELETON STATES
   ============================================================================ */

/* --- Spinner (CSS-only rotating circle) --- */

.pkv-ranking-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: clamp(2rem, 4vw + 0.5rem, 3rem);
    min-height: 200px;
}

.pkv-ranking-loading span {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

.pkv-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: pkv-spin 0.7s linear infinite;
}

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

/* --- Skeleton card: shimmer placeholder matching card dimensions --- */

.pkv-skeleton--card {
    height: 96px;
    border-radius: 0.75rem;
    background: linear-gradient(90deg,
            var(--bg-secondary) 25%,
            var(--bg-tertiary) 50%,
            var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: pkv-shimmer 1.5s ease-in-out infinite;
}

@keyframes pkv-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* --- Semi-transparent overlay during AJAX reload (not initial load) --- */

.pkv-ranking-list--loading {
    position: relative;
}

.pkv-ranking-list--loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(var(--bg-secondary-rgb), 0.5);
    border-radius: 0.75rem;
    z-index: 10;
    pointer-events: none;
}


/* ============================================================================
   21. BACK LINK
   ============================================================================ */

.pkv-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
    transition: color 0.15s ease, gap 0.15s ease;
}

.pkv-back-link:hover {
    color: var(--accent);
    gap: 0.5rem;
}

.pkv-back-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.pkv-back-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}


/* ============================================================================
   22. RESPONSIVE — Tablet (card layout adjustments)
   ============================================================================ */

@media (max-width: 640px) {

    /* Stack card content vertically on mobile */
    .pkv-ranking-card {
        flex-wrap: wrap;
        padding: clamp(1rem, 3vw, 1.25rem);
    }

    /* Body gets full width (order: 2) */
    .pkv-ranking-card__body {
        flex-basis: 100%;
        order: 2;
    }

    .pkv-ranking-card__rank {
        min-width: 2rem;
    }

    .pkv-ranking-card__rank span {
        font-size: clamp(1rem, 2vw + 0.25rem, 1.25rem);
    }

    .pkv-ranking-card__image {
        width: 60px;
        height: 60px;
    }

    .pkv-score-ring {
        --ring-size: 56px;
        margin: 0;
    }

    .pkv-score-ring__value {
        font-size: 0.875rem;
    }

    /* Aside spans full width (order: 3) with separator */
    .pkv-ranking-card__aside {
        flex-basis: 100%;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
        order: 3;
        padding-top: 0.5rem;
        border-top: 1px solid var(--border);
        margin-top: 0.25rem;
    }

    .pkv-page-header__actions {
        width: 100%;
        justify-content: space-between;
    }

    /* Top 3 left-border still works on mobile */
    .pkv-ranking-card--rank-1,
    .pkv-ranking-card--rank-2,
    .pkv-ranking-card--rank-3 {
        border-left-width: 3px;
    }
}


/* ============================================================================
   23. RESPONSIVE — Small mobile (image hidden)
   ============================================================================ */

@media (max-width: 420px) {
    .pkv-ranking-card__image {
        display: none;
    }

    .pkv-ranking-card__specs {
        gap: 0.25rem;
    }

    .pkv-ranking-card__spec {
        font-size: 0.75rem;
        padding: 0.1875rem 0.5rem;
    }

    .pkv-ranking-card__name {
        font-size: 0.875rem;
    }
}


/* ============================================================================
   24. REDUCED MOTION — Disable all transitions and animations
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {

    .pkv-sidebar,
    .pkv-sidebar__clear,
    .pkv-sidebar__close,
    .pkv-filter-section__title,
    .pkv-filter-section__chevron,
    .pkv-filter-option,
    .pkv-filter-switch,
    .pkv-filter-pill,
    .pkv-filter-chip,
    .pkv-filter-more,
    .pkv-mobile-filter-btn,
    .pkv-ranking-card,
    .pkv-ranking-card__name a,
    .pkv-sort-select,
    .pkv-back-link,
    .pkv-pagination__btn,
    .pkv-range-slider input[type="number"],
    .pkv-mobile-drawer__footer .pkv-btn {
        transition: none !important;
    }

    .pkv-spinner {
        animation: none;
    }

    .pkv-skeleton--card {
        animation: none;
        background: var(--bg-secondary);
    }

    .pkv-ranking-list--loading::after {
        transition: none;
    }

    .pkv-sidebar-overlay {
        transition: none;
    }

    .pkv-ranking-card:hover {
        transform: none;
    }

    .pkv-back-link:hover {
        gap: 0.375rem;
    }
}


/* ============================================================================
   14. NOSCRIPT FALLBACK
   ============================================================================ */

noscript .pkv-ranking-list {
    display: flex;
    flex-direction: column;
    gap: clamp(1rem, 2vw + 0.25rem, 1.5rem);
}