/**
 * RHT PEWC Spare Parts — Frontend Styles
 */

/* ----------------------------------------------------------------
 * Enquiry-only spare-parts product pages
 *
 * On enquiry-only products the base price is £0.00, which is
 * misleading. We hide the WC price element entirely with
 * `display: none !important`, then JS injects a "Price on enquiry"
 * label in its place.
 *
 * `display: none` is more robust than a content-replace because PEWC
 * re-renders the .price element's HTML on every option change. We let
 * PEWC keep updating its internal element (it stays in the DOM); we
 * just never show it to the customer.
 * ---------------------------------------------------------------- */

body.rht-psp-enquiry-only-product .summary > p.price,
body.rht-psp-enquiry-only-product .entry-summary > p.price,
body.rht-psp-enquiry-only-product .summary > .price.pewc-main-price,
body.rht-psp-enquiry-only-product .entry-summary > .price.pewc-main-price {
    display: none !important;
}

/* Hide the price-hide plugin's "Make selection" placeholder on
   enquiry-only pages — it doesn't apply when there's no price to
   reveal in the first place. */
body.rht-psp-enquiry-only-product .rht-pewc-ph-placeholder-wrap {
    display: none !important;
}

/* Also hide PEWC's running totals area on enquiry-only pages — the
   "Product total / Options total / Grand total" block is just zeros. */
body.rht-psp-enquiry-only-product .pewc-total-field-wrapper {
    display: none !important;
}

/* The "Price on enquiry" label injected by JS — sits where the price
   would normally render. Styled to match a typical price element so
   it occupies the same visual slot. */
.rht-psp-poe-label {
    display: block;
    font-size: 1.4em;
    font-weight: 600;
    color: #b8202e;
    margin: 0 0 1em;
    line-height: 1.4;
}

/* Inline / small-context variant (cart line item displays, search
   result rows, etc.). */
.rht-psp-poe {
    display: inline-block;
    font-style: italic;
    font-weight: 500;
    color: #555;
}

/* ----------------------------------------------------------------
 * The "Add to Enquiry List" button keeps the theme's default styling.
 * No colour override is applied here — only the button TEXT is changed
 * by the cart class via the woocommerce_product_single_add_to_cart_text
 * filter, so it visually matches the customer's expectations on the rest
 * of the site.
 * ---------------------------------------------------------------- */

/* ---------------------------------------------------------------- */
/* Cross-product CTAs                                                */
/* ---------------------------------------------------------------- */

.rht-psp-cta {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    margin: 16px 0;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-left: 4px solid #b8202e;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.rht-psp-cta-icon {
    flex-shrink: 0;
    width: 36px; height: 36px;
    background: #b8202e;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rht-psp-cta-body { flex: 1; min-width: 0; }

.rht-psp-cta-title { font-weight: 700; font-size: 15px; color: #1d2327; line-height: 1.3; }
.rht-psp-cta-subtitle { font-size: 13px; color: #555; margin-top: 2px; }

.rht-psp-cta-extra-list {
    list-style: none;
    margin: 4px 0 0;
    padding: 0;
    font-size: 13px;
}

.rht-psp-cta-extra-list li { margin: 2px 0; }
.rht-psp-cta-extra-list a { color: #b8202e; text-decoration: none; }
.rht-psp-cta-extra-list a:hover { text-decoration: underline; }

.rht-psp-cta-action { flex-shrink: 0; }

.rht-psp-cta-button {
    display: inline-block;
    padding: 8px 14px;
    background: #b8202e;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.rht-psp-cta-button:hover { background: #97121f; color: #fff; }

.rht-psp-cta-fits { border-left-color: #2271b1; }
.rht-psp-cta-fits .rht-psp-cta-icon { background: #2271b1; }
.rht-psp-cta-fits .rht-psp-cta-extra-list a { color: #2271b1; }

@media (max-width: 600px) {
    .rht-psp-cta { flex-direction: column; align-items: flex-start; }
    .rht-psp-cta-action { align-self: stretch; }
    .rht-psp-cta-button { display: block; text-align: center; }
}

/* ---------------------------------------------------------------- */
/* Search shortcode — landing-page experience                        */
/* ---------------------------------------------------------------- */

.rht-psp-search-page {
    max-width: 1200px;
    margin: 0 auto;
}

.rht-psp-search-intro {
    text-align: center;
    margin: 0 auto 28px;
    max-width: 760px;
    padding: 0 16px;
}

.rht-psp-search-intro-heading {
    font-size: clamp(1.6rem, 2.4vw, 2.2rem);
    font-weight: 700;
    margin: 0 0 12px;
    color: #1d2329;
    line-height: 1.2;
}

.rht-psp-search-intro-text {
    font-size: 1rem;
    line-height: 1.55;
    color: #555;
    margin: 0;
}

/* ---------------------------------------------------------------- */
/* Search shortcode — search bar                                     */
/* ---------------------------------------------------------------- */

.rht-psp-search { max-width: 100%; }

.rht-psp-search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.rht-psp-search-input {
    flex: 1;
    padding: 10px 14px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.rht-psp-search-button {
    padding: 10px 20px;
    background: #b8202e;
    color: #fff;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}

.rht-psp-search-button:hover { background: #97121f; }

.rht-psp-search-status {
    font-size: 13px;
    color: #555;
    margin-bottom: 12px;
}

/* ---------------------------------------------------------------- */
/* Category tiles (empty-state browse-by-brand grid)                 */
/* ---------------------------------------------------------------- */

.rht-psp-category-tiles {
    margin: 32px 0 0;
}

.rht-psp-category-tiles-heading {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #555;
    margin: 0 0 16px;
    font-weight: 600;
}

.rht-psp-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.rht-psp-category-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 16px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    text-decoration: none !important;
    color: #1d2329;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    min-height: 180px;
    text-align: center;
}

.rht-psp-category-tile:hover,
.rht-psp-category-tile:focus {
    transform: translateY(-2px);
    border-color: #b8202e;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    color: #1d2329;
    text-decoration: none !important;
}

.rht-psp-category-tile-img {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    overflow: hidden;
    border-radius: 4px;
}

.rht-psp-category-tile-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.rht-psp-category-tile-img--placeholder {
    background: linear-gradient(135deg, #f4f4f4, #e8e8e8);
    position: relative;
}

.rht-psp-category-tile-img--placeholder::before {
    content: '';
    position: absolute;
    inset: 30%;
    background: #d0d0d0;
    border-radius: 4px;
}

.rht-psp-category-tile-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1d2329;
    line-height: 1.3;
}

.rht-psp-category-tile-count {
    font-size: 0.78rem;
    color: #888;
    font-weight: 500;
}

/* ---------------------------------------------------------------- */
/* Grouped result blocks                                             */
/* ---------------------------------------------------------------- */

.rht-psp-search-results {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.rht-psp-group {
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.rht-psp-group-header {
    background: #1f2329;
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.rht-psp-group-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: #fff;
}

.rht-psp-group-title a {
    color: #fff;
    text-decoration: none;
}

.rht-psp-group-title a:hover {
    color: #fff;
    text-decoration: underline;
}

.rht-psp-group-view {
    background: #fff;
    color: #1f2329;
    padding: 6px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    border: 0;
}

.rht-psp-group-view:hover {
    background: #b8202e;
    color: #fff;
}

.rht-psp-group-empty {
    padding: 16px 18px;
}

/* Model block */

.rht-psp-model-block {
    border-top: 1px solid #f0f0f0;
}

.rht-psp-model-block:first-of-type {
    border-top: 0;
}

.rht-psp-model-header {
    background: #f6f7f8;
    color: #1d2327;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Parts table */

.rht-psp-parts-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: #fff;
}

.rht-psp-parts-table thead th {
    background: #fafafa;
    padding: 8px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #555;
    border-bottom: 1px solid #ececec;
}

.rht-psp-col-sku { width: 1%; white-space: nowrap; }
.rht-psp-col-price { width: 100px; text-align: right; }
.rht-psp-col-qty { width: 80px; }
.rht-psp-col-actions { width: 1%; white-space: nowrap; text-align: right; }

.rht-psp-parts-table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid #f3f3f3;
    vertical-align: middle;
    font-size: 13px;
    color: #1d2327;
}

.rht-psp-parts-table tbody tr:last-child td {
    border-bottom: 0;
}

.rht-psp-parts-table tbody tr:hover {
    background: #fafbfc;
}

.rht-psp-sku-chip {
    display: inline-block;
    background: #eef0f2;
    color: #1d2329;
    padding: 3px 8px;
    border-radius: 3px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.rht-psp-col-price {
    text-align: right;
    font-weight: 600;
    color: #b8202e;
}

.rht-psp-row-qty {
    width: 56px;
    padding: 4px 6px;
    border: 1px solid #ccc;
    border-radius: 3px;
    text-align: center;
}

.rht-psp-col-actions {
    text-align: right;
}

.rht-psp-row-enquire,
.rht-psp-row-cart {
    padding: 7px 12px;
    background: #b8202e;
    color: #fff;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    margin-right: 4px;
}

.rht-psp-row-enquire:hover,
.rht-psp-row-cart:hover {
    background: #97121f;
}

.rht-psp-row-enquire[disabled],
.rht-psp-row-cart[disabled] {
    opacity: 0.75;
    cursor: wait;
}

.rht-psp-row-view {
    padding: 7px 10px;
    background: transparent;
    color: #1f2329;
    border: 1px solid #c8ccd0;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}

.rht-psp-row-view:hover {
    background: #1f2329;
    color: #fff;
    border-color: #1f2329;
    text-decoration: none;
}

/* Pagination */

.rht-psp-search-pagination {
    margin-top: 20px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.rht-psp-page-btn {
    padding: 6px 12px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
    border-radius: 3px;
}

.rht-psp-page-btn.is-current {
    background: #b8202e;
    color: #fff;
    border-color: #b8202e;
}

/* Responsive — collapse table to stacked rows */

@media (max-width: 720px) {
    .rht-psp-parts-table thead {
        display: none;
    }
    .rht-psp-parts-table,
    .rht-psp-parts-table tbody,
    .rht-psp-parts-table tr,
    .rht-psp-parts-table td {
        display: block;
        width: 100%;
    }
    .rht-psp-parts-table tr {
        padding: 12px 12px 14px;
        border-bottom: 1px solid #eee;
    }
    .rht-psp-parts-table td {
        padding: 4px 0;
        text-align: left !important;
        white-space: normal !important;
    }
    .rht-psp-col-actions {
        margin-top: 8px;
        display: flex !important;
        gap: 6px;
        flex-wrap: wrap;
    }
    .rht-psp-row-view {
        flex: 1;
        text-align: center;
    }
    .rht-psp-row-enquire,
    .rht-psp-row-cart {
        flex: 1;
    }
}

/* ---------------------------------------------------------------- */
/* Enquiry list shortcode                                            */
/* ---------------------------------------------------------------- */

.rht-psp-enquiry-list { margin: 20px 0; }

.rht-psp-enquiry-empty {
    padding: 20px;
    background: #f6f7f7;
    border-radius: 6px;
    color: #666;
    text-align: center;
}

.rht-psp-enquiry-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.rht-psp-enquiry-table th,
.rht-psp-enquiry-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #eee;
    text-align: left;
    vertical-align: top;
}

.rht-psp-enquiry-table th {
    background: #fafafa;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #555;
}

.rht-psp-list-qty {
    width: 70px;
    padding: 4px 6px;
    text-align: center;
}

.rht-psp-list-remove {
    color: #b8202e;
    cursor: pointer;
    background: none;
    border: 0;
    text-decoration: underline;
}

.rht-psp-list-remove:hover { color: #97121f; }

.rht-psp-enquiry-form label { display: block; font-weight: 600; margin-bottom: 4px; }

.rht-psp-enquiry-form input[type="text"],
.rht-psp-enquiry-form input[type="email"],
.rht-psp-enquiry-form input[type="tel"],
.rht-psp-enquiry-form textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.rht-psp-submit-enquiry {
    padding: 10px 22px;
    background: #b8202e;
    color: #fff;
    border: 0;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.rht-psp-submit-enquiry:hover { background: #97121f; }
.rht-psp-submit-enquiry[disabled] { opacity: 0.6; cursor: not-allowed; }

.rht-psp-form-status { margin-top: 12px; font-size: 14px; }
.rht-psp-form-status.success { color: #1b5e20; }
.rht-psp-form-status.error { color: #b8202e; }

/* ---------------------------------------------------------------- */
/* Floating badge                                                    */
/* ---------------------------------------------------------------- */

/* ---------------------------------------------------------------- */
/* Floating Enquiry List badge                                       */
/*                                                                   */
/* Uses an ID selector (#rht-psp-floating-badge) for higher          */
/* specificity than typical theme/builder `a` styling (e.g.          */
/* Elementor's `.elementor-kit-N a` rules). ID specificity is        */
/* (1,0,0) which beats any class-based rule even without !important. */
/* ---------------------------------------------------------------- */

#rht-psp-floating-badge,
#rht-psp-floating-badge:link,
#rht-psp-floating-badge:visited {
    position: fixed;
    right: 16px;
    bottom: 16px;
    background: #b8202e;
    color: #ffffff !important;
    padding: 12px 18px;
    border-radius: 28px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.18);
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    line-height: 1;
    border: 0;
}

#rht-psp-floating-badge:hover,
#rht-psp-floating-badge:focus,
#rht-psp-floating-badge:active {
    transform: translateY(-2px);
    color: #ffffff !important;
    background: #97121f;
    box-shadow: 0 8px 20px rgba(0,0,0,0.22);
    text-decoration: none !important;
}

#rht-psp-floating-badge svg {
    flex-shrink: 0;
    stroke: #ffffff;
    color: #ffffff;
}

#rht-psp-floating-badge .rht-psp-badge-label {
    white-space: nowrap;
    color: #ffffff !important;
}

#rht-psp-floating-badge .rht-psp-badge-count {
    background: #ffffff;
    color: #b8202e !important;
    border-radius: 12px;
    padding: 2px 9px;
    font-weight: 700;
    font-size: 12px;
    min-width: 18px;
    text-align: center;
    line-height: 1.3;
}

@media (max-width: 600px) {
    #rht-psp-floating-badge {
        padding: 10px 14px;
        font-size: 13px;
    }
    #rht-psp-floating-badge .rht-psp-badge-label {
        display: none; /* collapse to icon + count on mobile */
    }
}
