﻿/* ========================================================================
   PATTERN PAGE (pp-) — aligned with HJULGUIDE Fitment UI tokens & style
   ===================================================================== */

/* ---------- Theme tokens (mirror fitment.css) ---------- */
:root {
    --bg: #f7f8fb;
    --card: #ffffff;
    --text: #121417;
    --muted: #6b7280;
    --border: #e5e7eb;
    --ring: #9ad72c; /* focus + accent */
    --primary: #b7ea29; /* lime button bg */
    --primary-ink: #0f172a;
    --chip-bg: #f3f4f6;
    --chip-on: #e8f7c4;
    --chip-ink: #0f172a;
    --badge: #eef2ff;
    --badge-wheels: #e6f0ff;
    --badge-tires: #e7ffe6;
    --badge-both: #fff6e6;
    --danger: #ef4444;
    --ok: #059669;
    --low: #ca8a04;
}

/* ---------- Resets / helpers ---------- */
html, body {
    background: var(--bg);
    color: var(--text);
}

a:focus-visible, button:focus-visible, select:focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
    border-radius: 10px;
}

.pp-subtle {
    color: var(--muted);
}

.pp-muted {
    color: var(--muted);
}

/* ---------- Page wrapper ---------- */
.pp-wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 12px 16px 32px;
}

/* ---------- Hero ---------- */
.pp-hero {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
}

.pp-hero-img {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--border);
}

.pp-hero-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 900;
    color: #0f172a;
    line-height: 1.2;
}

.pp-hero-sub {
    margin-top: 2px;
    color: var(--muted);
}

.pp-hero-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
    color: #334155;
}

.pp-chip {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 9999px;
    background: #fff;
    font-size: .85rem;
    font-weight: 700;
}

/* ---------- Toolbar / Filters ---------- */
.pp-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 16px 0 10px;
}

.pp-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 12px;
}

.pp-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pp-label {
    font-weight: 700;
    color: #0f172a;
}

.pp-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    border: 1px solid var(--border);
    background: var(--chip-bg);
    color: var(--chip-ink);
    padding: 8px 12px;
    border-radius: 9999px;
    cursor: pointer;
    font-weight: 700;
    transition: background .15s ease, border-color .15s ease, transform .02s ease;
}

    .chip:hover {
        background: #e9ecef;
    }

    .chip[aria-pressed="true"] {
        background: var(--chip-on);
        border-color: #cce79a;
    }

.pp-select, .pp-reset {
    min-width: 160px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    font: inherit;
}

.pp-reset {
    cursor: pointer;
}

    .pp-reset:hover {
        background: #f1f5f9;
    }

/* ---------- Grid (cards) ---------- */
.pp-grid {
    --min: 320px;
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(var(--min), 1fr));
}

/* Pattern tiles variant for /dack/{brand} */
.pp-grid--patterns {
    --min: 260px;
}

/* ---------- Card ---------- */
.pp-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--card);
    box-shadow: 0 10px 30px rgba(16,24,40,.05);
    padding: 14px;
}

.pp-top {
    display: flex;
    gap: 12px;
}

.pp-img {
    width: 84px;
    height: 84px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f9fafb;
    object-fit: contain;
}

.pp-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pp-name {
    font-weight: 800;
    color: #0b4aa2;
    text-decoration: none;
}

    .pp-name:hover {
        text-decoration: underline;
    }

.pp-meta {
    font-size: .92rem;
    color: var(--muted);
}

/* Badges inside a product card */
.pp-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.pp-badge {
    font-size: .75rem;
    padding: 3px 8px;
    border-radius: 9999px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #334155;
}

    .pp-badge.ok {
        background: #ecfdf5;
        border-color: #10b981;
        color: #065f46;
    }

    .pp-badge.ext {
        background: #eff6ff;
        border-color: #60a5fa;
        color: #1e3a8a;
    }

/* Pattern-card bottom row */
.pp-bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
}

/* Price block */
.pp-price {
    font-size: 1.25rem;
    font-weight: 900;
    color: #0f172a;
}

    .pp-price small {
        display: block;
        font-weight: 600;
        color: #64748b;
    }

/* CTA (aligned with fitment buttons but more compact) */
.pp-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid #1f2937;
    background: #fff;
    color: #1f2937;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .06s ease, background .15s ease, border-color .15s ease;
}

    .pp-cta:hover {
        background: #1f2937;
        color: #fff;
        border-color: #1f2937;
        transform: translateY(-1px);
    }

/* Variant for pattern tiles (brand landing) */
.pp-card--pattern .pp-img {
    width: 96px;
    height: 96px;
}

.pp-card--pattern .pp-price {
    font-size: 1.1rem;
}

/* ---------- Empty state ---------- */
.pp-empty {
    border: 1px dashed var(--border);
    border-radius: 16px;
    padding: 28px;
    text-align: center;
    color: #64748b;
    background: #fff;
    margin-top: 12px;
}

/* ---------- Pagination ---------- */
.pp-pag {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pp-page {
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    text-decoration: none;
    color: #0f172a;
    font-weight: 700;
}

    .pp-page[aria-current="page"] {
        background: #0b4aa2;
        border-color: #0b4aa2;
        color: #fff;
    }

    .pp-page:hover {
        filter: brightness(1.02);
    }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .pp-hero {
        align-items: flex-start;
    }

    .pp-grid {
        --min: 280px;
    }
}

@media (max-width: 560px) {
    .pp-hero-img {
        width: 60px;
        height: 60px;
    }

    .pp-grid {
        --min: 240px;
    }
}
