/* Parts Poa catalogue (p_view.css): product listings, mobile first.
   Same tokens as home-sections.css. Every rule is scoped to #left_column / #center_column,
   so nothing here can touch admin.css or the home page.
   Sections: 1 frame, 2 heading, 3 product grid, 4 pagination, 5 breadcrumb + part number search */
:root {
    --pp-ink: #1b2430;
    --pp-muted: #5f6b79;
    --pp-line: #e3e8ee;
    --pp-surface: #ffffff;
    --pp-wash: #f4f6f9;
    --pp-radius: 14px;
    --pp-gap: clamp(10px, 2vw, 18px);
    --pp-space: clamp(20px, 4vw, 44px);
}

/* ---------- 1. Page frame ----------
   The listing's .row sits straight in the page with no .container around it,
   so Bootstrap's negative margins push it past the screen edge. */
.row:has(> #center_column) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);      /* phone: one column, filters first */
    gap: var(--pp-gap);
    width: 100%;
    max-width: 1170px;
    margin: 8px auto var(--pp-space);           /* small gap under the menu */
    padding: 0 15px;
}
/* Bootstrap's clearfix pseudo-elements would become empty grid cells */
.row:has(> #center_column)::before,
.row:has(> #center_column)::after { display: none; }

#left_column,
#center_column { float: none; width: auto; min-width: 0; padding: 0; }
#center_column { display: flow-root; }          /* contains the theme's floated pagination */

#left_column {
    padding: 12px;
    background: var(--pp-wash);
    border-radius: var(--pp-radius);
}
#left_column img { max-width: 100%; height: auto; }

@media (min-width: 900px) {
    .row:has(> #center_column) {
        grid-template-columns: 250px minmax(0, 1fr);   /* filters left, products right */
        align-items: start;
    }
}

/* ---------- 2. Heading ---------- */
#center_column .page-heading {
    margin: 0 0 var(--pp-gap);
    padding: 0;
    border: 0;
}
#center_column .page-heading-title {
    padding: 0;
    background: none;
    border: 0;
    color: var(--pp-ink);
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 700;
    line-height: 1.15;
    text-transform: none;
}
#center_column .alert { border-radius: var(--pp-radius); }

/* ---------- 3. Product grid ---------- */
#center_column .product-list.grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));   /* phone: 2 cards */
    gap: var(--pp-gap);
    margin: 0;
    padding: 0;
    list-style: none;
}
#center_column .product-list.grid::before,
#center_column .product-list.grid::after { display: none; }

@media (min-width: 600px)  { #center_column .product-list.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1200px) { #center_column .product-list.grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

#center_column .product-list.grid > li {
    float: none;
    width: auto;
    margin: 0;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    background: var(--pp-surface);
    border: 1px solid var(--pp-line);
    border-radius: var(--pp-radius);
    transition: border-color .15s;
}
#center_column .product-list.grid > li:hover,
#center_column .product-list.grid > li:focus-within { border-color: var(--pp-ink); }

#center_column .product-list.grid > li img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: var(--pp-wash);
    border-radius: calc(var(--pp-radius) - 6px);
}
#center_column .product-list.grid > li a { color: var(--pp-ink); text-decoration: none; }
#center_column .product-list.grid > li a:focus-visible { outline: 3px solid var(--pp-ink); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    #center_column .product-list.grid > li { transition: none; }
}

/* ---------- 4. Pagination: fluid on phones (theme markup untouched) ---------- */
@media (max-width: 767px) {
    #center_column .sortPagiBar .bottom-pagination { float: none; width: 100%; margin: 0; text-align: center; }
    #center_column .sortPagiBar .pagination { display: flex; flex-wrap: wrap; justify-content: center; }
}

/* ---------- 5. Breadcrumb (left) + part number search (right) ---------- */
#center_column .pp-find {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    margin: 0 0 var(--pp-gap);
    text-align: left;
}
#center_column .pp-find__crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 13px;
    color: var(--pp-muted);
}
#center_column .pp-find__crumbs li + li::before { content: "\203A"; margin-right: 6px; }
#center_column .pp-find__crumbs a { color: var(--pp-ink); text-decoration: none; }

#center_column .pp-find__form { display: flex; gap: 8px; flex: 1 1 280px; max-width: 420px; margin: 0; }
#center_column .pp-find__form input[type="search"] {
    flex: 1;
    min-width: 0;
    height: 40px;
    padding: 0 14px;
    font: inherit;
    font-size: 16px;                            /* 16px stops iOS zooming into the field */
    color: var(--pp-ink);
    background: var(--pp-surface);
    border: 1px solid var(--pp-line);
    border-radius: 999px;
}
#center_column .pp-find__form button {
    flex: none;
    min-height: 40px;
    padding: 0 18px;
    font: inherit;
    font-weight: 600;
    color: var(--pp-ink);
    background: var(--pp-accent, #f2b705);
    border: 1px solid var(--pp-accent, #f2b705);
    border-radius: 999px;
    cursor: pointer;
}
#center_column .pp-find__form input:focus-visible,
#center_column .pp-find__form button:focus-visible { outline: 3px solid var(--pp-ink); outline-offset: 2px; }
