/* ==========================================================================
   PARTSZAR - Customizer "Additional CSS"
   Complete consolidated file. Delete everything in the Additional CSS box
   and paste this in its place.
   This file does NOT touch the Storefront child theme style.css.
   ========================================================================== */


/* ==========================================================================
   1. CATALOGUE / SEARCH TWEAKS
   ========================================================================== */

/* Hide category product count */
.woocommerce-loop-category__title mark {
    display: none;
}

/* Truncate long options in the category dropdown widget.
   Changed from the hardcoded ID product-categories-6447dca7a2597-select to an
   attribute match, because that ID is regenerated whenever the widget is
   re-saved, which silently kills the rule. */
select[id^="product-categories-"][id$="-select"] option {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

/* Hide product SKU in FiboSearch results */
.dgwt-wcas-details-product-sku {
    display: none !important;
}

/* WPC Grouped Products - h5 item text */
body .woosg-item-text-type-h5 > h5 {
    color: red !important;
    font-weight: bold !important;
}

/* Hide dates in related products tab */
.woocommerce-tabs .related.products time,
.woocommerce-tabs .related.products .date {
    display: none !important;
}

/* Hide the page title on the Get It On Credit page.
   The old .entry-title:contains("Get It On Credit") rule was removed:
   :contains is a jQuery selector, not CSS, so it never matched anything.
   The page-id rule below is what actually does the work. */
.page-id-13460 .entry-title {
    display: none !important;
}


/* ==========================================================================
   2. PRICE AND SALE BADGE COLOURS
   ========================================================================== */

.woocommerce span.onsale {
    background-color: #ff0000;
    color: #ffffff;
}

/* Sale price - green */
.woocommerce ul.products li.product .price ins,
.woocommerce div.product p.price ins,
.woocommerce div.product span.price ins {
    color: #28a745;
    font-weight: bold;
}

/* Original crossed-out price - red */
.woocommerce ul.products li.product .price del,
.woocommerce div.product p.price del,
.woocommerce div.product span.price del {
    color: #cc0000;
    text-decoration: line-through;
}


/* ==========================================================================
   3. CONTACT FORM 7
   ========================================================================== */

.wpcf7 {
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

.wpcf7 .form-row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -10px 20px;
}

.wpcf7 .form-column {
    flex: 1 1 calc(33.333% - 20px);
    margin: 0 10px;
}

.wpcf7 label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 select,
.wpcf7 textarea {
    width: 100%;
    padding: 10px 15px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.wpcf7 input:focus,
.wpcf7 select:focus,
.wpcf7 textarea:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 5px rgba(74, 144, 226, 0.5);
}

.wpcf7 textarea {
    height: 120px;
    resize: vertical;
}

.wpcf7 .form-full-width {
    flex-basis: 100%;
    margin: 0 10px 20px;
}

.wpcf7 input[type="submit"] {
    background-color: #4a90e2;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: background-color 0.3s ease;
    width: 100%;
}

.wpcf7 input[type="submit"]:hover {
    background-color: #3a7bc8;
}

.wpcf7 .wpcf7-not-valid-tip {
    color: #dc3232;
    font-size: 0.9em;
    margin-top: 5px;
}

.wpcf7 form .wpcf7-response-output {
    margin: 2em 0 1em;
    padding: 0.5em 1em;
    border: 2px solid #00a0d2;
    border-radius: 4px;
    text-align: center;
}

.wpcf7 form.sent .wpcf7-response-output {
    border-color: #46b450;
    background-color: #edfaef;
    color: #155724;
}

.wpcf7 form.failed .wpcf7-response-output,
.wpcf7 form.aborted .wpcf7-response-output {
    border-color: #dc3232;
    background-color: #fbeaea;
    color: #721c24;
}

/* VIN validation error message */
.vin-error {
    display: block;
    color: #dc3232;
    font-size: 0.9em;
    margin-top: 5px;
}

.wpcf7-form-title,
.wpcf7 h2,
.wpcf7 .wpcf7-form > h2:first-child {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 20px;
    line-height: 1.2;
    hyphens: auto;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 768px) {
    .wpcf7 {
        padding: 20px;
    }

    .wpcf7 .form-column {
        flex-basis: 100%;
    }
}

@media screen and (max-width: 767px) {
    .wpcf7-form-title,
    .wpcf7 h2,
    .wpcf7 .wpcf7-form > h2:first-child {
        font-size: 20px;
        display: flex;
        flex-direction: column;
    }

    .wpcf7-form-title span:first-child,
    .wpcf7 h2 span:first-child,
    .wpcf7 .wpcf7-form > h2:first-child span:first-child {
        display: block;
    }

    .wpcf7-form-title span:first-child::after,
    .wpcf7 h2 span:first-child::after,
    .wpcf7 .wpcf7-form > h2:first-child span:first-child::after {
        content: "& Acknowledgement";
        display: block;
        margin-top: 5px;
    }

    .wpcf7-form-title span:last-child,
    .wpcf7 h2 span:last-child,
    .wpcf7 .wpcf7-form > h2:first-child span:last-child {
        display: none;
    }
}

@media screen and (max-width: 360px) {
    .wpcf7-form-title,
    .wpcf7 h2,
    .wpcf7 .wpcf7-form > h2:first-child {
        font-size: 18px;
    }
}


/* ==========================================================================
   4. EQUAL-HEIGHT PRODUCT AND CATEGORY CARDS  (Storefront)
   Replaces Storefront's float layout with CSS grid so every card in a row
   is the same height. No fixed pixel heights anywhere.
   ========================================================================== */

:root {
    --pz-card-gap: 24px;
    --pz-image-ratio: 1 / 1;
    --pz-title-lines: 2;
    --pz-title-size: 1rem;
    --pz-title-leading: 1.4;
    --pz-card-pad: 20px 15px 15px;
    --pz-card-border: #e2e5e9;
    --pz-card-radius: 12px;
}

/* 4.1 The grid. Storefront floats li.product at 22.05% with .first/.last
   clearing classes. Grid replaces that wholesale; grid rows stretch by
   default, and that stretch is what equalises the heights. */
.woocommerce ul.products,
.woocommerce-page ul.products,
ul.products {
    display: grid !important;
    gap: var(--pz-card-gap);
    margin: 0 0 2em !important;
    padding: 0 !important;
    list-style: none !important;
}

/* Storefront's clearfix pseudo-elements would become phantom grid items */
.woocommerce ul.products::before,
.woocommerce ul.products::after,
ul.products::before,
ul.products::after {
    content: none !important;
    display: none !important;
}

ul.products.columns-1 { grid-template-columns: 1fr; }
ul.products.columns-2 { grid-template-columns: repeat(2, 1fr); }
ul.products.columns-3 { grid-template-columns: repeat(3, 1fr); }
ul.products.columns-4 { grid-template-columns: repeat(4, 1fr); }
ul.products.columns-5 { grid-template-columns: repeat(5, 1fr); }
ul.products.columns-6 { grid-template-columns: repeat(6, 1fr); }

/* Related-products and up-sell loops sometimes render without columns-N */
ul.products:not([class*="columns-"]) {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* 4.2 The card. Single source of truth for card chrome. */
.woocommerce ul.products li.product,
ul.products li.product,
ul.products li.product-category {
    float: none !important;
    clear: none !important;
    width: auto !important;
    margin: 0 !important;

    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;

    background: #fff;
    border: 1px solid var(--pz-card-border);
    border-radius: var(--pz-card-radius);
    padding: var(--pz-card-pad);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    text-align: center;
}

/* The anchor wrapping image + title + price must stretch, otherwise
   margin-top:auto on the price has nothing to push against */
ul.products li.product a.woocommerce-LoopProduct-link,
ul.products li.product-category > a {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    text-decoration: none;
}

/* 4.3 Images. One ratio for every tile. object-fit:contain letterboxes
   mixed-source supplier photos instead of stretching them. */
ul.products li.product img,
ul.products li.product-category img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: var(--pz-image-ratio);
    object-fit: contain;
    margin: 0 auto 12px !important;
    display: block;
}

/* 4.4 Titles. Reserve a fixed number of lines so a one-line part name
   occupies the same vertical space as a two-line one. Overflow clamps
   with an ellipsis rather than growing the card. */
ul.products li.product .woocommerce-loop-product__title,
ul.products li.product h2.woocommerce-loop-product__title,
ul.products li.product-category .woocommerce-loop-category__title {
    font-size: var(--pz-title-size) !important;
    line-height: var(--pz-title-leading) !important;
    min-height: calc(var(--pz-title-size) * var(--pz-title-leading) * var(--pz-title-lines));
    margin: 0 0 8px !important;
    padding: 0 !important;
    text-align: center;

    display: -webkit-box;
    -webkit-line-clamp: var(--pz-title-lines);
    line-clamp: var(--pz-title-lines);
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Keep the category count hidden. The rule in section 1 is lower
   specificity than the title rule above, so restate it here. */
ul.products li.product-category .woocommerce-loop-category__title mark,
ul.products li.product-category .woocommerce-loop-category__title .count {
    display: none !important;
}

/* 4.5 SALE badge lifted out of the document flow. This is the single
   biggest cause of unequal card heights in a mixed sale grid.
   Colours are set in section 2 and are not repeated here. */
ul.products li.product span.onsale,
ul.products li.product .onsale {
    position: absolute !important;
    top: 10px !important;
    left: 10px !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    min-height: 0 !important;
    min-width: 0 !important;
    line-height: 1.6 !important;
    padding: 2px 10px !important;
    border-radius: 4px;
    z-index: 5;
}

/* 4.6 Price row. Reserves one line so a single price and a
   struck-through pair occupy the same height, and the auto top margin
   pins everything below it to the bottom of the card. */
ul.products li.product .price {
    margin: auto 0 12px !important;
    min-height: 1.5rem;
    display: block;
}

ul.products li.product .price del,
ul.products li.product .price ins {
    display: inline-block;
    margin: 0 4px;
}

ul.products li.product .price ins {
    text-decoration: none;
}

/* 4.7 Buttons. Includes the WPC Smart Quick View button, which is not a
   standard WooCommerce .button in every render mode. */
ul.products li.product a.button,
ul.products li.product button.button,
ul.products li.product a.added_to_cart,
ul.products li.product .woosq-btn,
ul.products li.product a.woosq-btn,
ul.products li.product .add_to_cart_button {
    display: block !important;
    width: 100% !important;
    margin: 0 0 8px !important;
    padding: 10px 12px !important;
    box-sizing: border-box;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    float: none !important;
}

ul.products li.product a.button:last-child,
ul.products li.product button.button:last-child,
ul.products li.product .woosq-btn:last-child {
    margin-bottom: 0 !important;
}

/* View cart link appears after AJAX add-to-cart */
ul.products li.product a.added_to_cart {
    margin-top: 0 !important;
    font-size: 0.875rem;
}

/* 4.8 Hover. transform only, so it never reflows the grid. */
@media (hover: hover) {
    ul.products li.product,
    ul.products li.product-category {
        transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
    }

    ul.products li.product:hover,
    ul.products li.product-category:hover {
        border-color: #b9bfc7;
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
        transform: translateY(-3px);
    }
}

@media (prefers-reduced-motion: reduce) {
    ul.products li.product,
    ul.products li.product-category {
        transition: none;
    }

    ul.products li.product:hover,
    ul.products li.product-category:hover {
        transform: none;
    }
}

/* 4.9 Responsive. Two columns on phones rather than one, which suits a
   large parts catalogue. */
@media (max-width: 1024px) {
    ul.products.columns-4,
    ul.products.columns-5,
    ul.products.columns-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    :root {
        --pz-card-gap: 14px;
        --pz-card-pad: 14px 10px 12px;
    }

    ul.products.columns-3,
    ul.products.columns-4,
    ul.products.columns-5,
    ul.products.columns-6 {
        grid-template-columns: repeat(2, 1fr);
    }

    ul.products li.product .woocommerce-loop-product__title,
    ul.products li.product-category .woocommerce-loop-category__title {
        font-size: 0.875rem !important;
    }

    ul.products li.product a.button,
    ul.products li.product button.button,
    ul.products li.product .woosq-btn {
        font-size: 0.8125rem !important;
        padding: 9px 8px !important;
    }
}