/* ================================================================
   EXPLODED VIEWS — Card-based parts list
   ================================================================ */

/* Use full screen width on exploded view pages, capped at 1920px */
body.has-exploded-view .col-full {
    max-width: 1920px !important;
    padding-left: 30px !important;
    padding-right: 30px !important;
}

/* Hide empty storefront-sorting wrappers on exploded view pages */
.storefront-sorting:empty {
    display: none;
}

/* Side-by-side layout: image left, parts list right */
.acties-exploded-view-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 20px;
    align-items: start;
    margin: 0;
    grid-column: 1 / -1;
    max-width: 100%;
    overflow: hidden;
}

.acties-exploded-view-header {
    background: #fff;
    padding: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    box-sizing: border-box;
    position: sticky;
    top: 20px;
    z-index: 1;
    max-width: 100%;
}

.acties-exploded-view-img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

/* Parts list container */
.acties-parts-list {
    min-width: 0;
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    overflow: visible;
    position: relative;
    z-index: 2;
}

/* Individual part card */
.acties-part-card {
    display: grid;
    grid-template-columns: 36px 80px minmax(0, 1fr) auto auto auto;
    grid-template-rows: auto;
    gap: 0 12px;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid #eee;
}

.acties-part-card:last-child {
    border-bottom: none;
}

.acties-part-card:hover {
    background: #fafafa;
}

/* Reference number */
.acties-part-card .part-ref {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--accent-primary);
    text-align: center;
}

/* Product image */
.acties-part-card .part-img {
    position: relative;
}

.acties-part-card .part-img img {
    display: block;
    width: 72px;
    height: 72px;
    object-fit: contain;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 2px;
    background: #fff;
    cursor: zoom-in;
    transition: none;
}

.acties-part-card .part-img .part-img-zoom {
    display: none;
    position: fixed;
    z-index: 99999;
    background: #fff;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 6px;
    pointer-events: none;
}

.acties-part-card .part-img .part-img-zoom img {
    display: block;
    width: 400px;
    height: auto;
    border: none;
    padding: 0;
    cursor: default;
}

/* Hide list-item bullets on part cards */
.acties-part-card {
    list-style: none !important;
}

.acties-parts-list {
    list-style: none !important;
}

/* product zoom popup shown/positioned via JS */

/* ── Colour swatches ── */
.part-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.part-swatch {
    padding: 2px 8px !important;
    border: 1px solid #ddd !important;
    border-radius: 12px !important;
    background: #f5f5f5 !important;
    cursor: pointer !important;
    font-size: 0.65rem !important;
    font-weight: 600 !important;
    color: var(--text-muted) !important;
    line-height: 1.4 !important;
    white-space: nowrap !important;
    transition: border-color 0.15s, background 0.15s !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.part-swatch:hover {
    border-color: var(--accent-primary) !important;
    background: #fff !important;
    color: var(--text-primary) !important;
}

.part-swatch.active {
    border-color: var(--accent-primary) !important;
    background: #fff !important;
    color: var(--accent-primary) !important;
    font-weight: 700 !important;
}

/* ── Sub-row grouping (different parts, same ref) ── */
.acties-part-group {
    border: 1px solid #ddd;
    border-radius: 6px;
    margin: 4px 0;
    overflow: hidden;
}

.acties-part-group__header {
    background: #f8f8f8;
    padding: 4px 12px;
    border-bottom: 1px solid #eee;
}

.acties-part-group__header .part-ref {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--accent-primary);
}

.acties-part-card--grouped {
    grid-template-columns: 80px 1fr auto auto auto;
    border-bottom: 1px dashed #eee;
    padding-left: 12px;
}

.acties-part-card--grouped:last-child {
    border-bottom: none;
}

/* Info block: name + SKU */
.acties-part-card .part-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.acties-part-card .part-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    text-decoration: none;
    line-height: 1.3;
}

.acties-part-card .part-name:hover {
    color: var(--accent-primary);
}

.acties-part-card .part-sku {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Price */
.acties-part-card .part-price {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    text-align: right;
    padding: 0 8px;
}

/* Cart icon button */
.acties-part-card .part-action {
    display: flex;
    align-items: center;
}

.acties-part-card .button {
    background: var(--accent-primary) !important;
    color: #fff !important;
    padding: 0 !important;
    font-size: 0 !important;
    line-height: 1 !important;
    border-radius: 4px !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 32px !important;
    height: 32px !important;
}

.acties-part-card .button::before {
    content: '';
    display: block;
    width: 16px;
    height: 16px;
    background: #fff;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E") no-repeat center / contain;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E") no-repeat center / contain;
}

.acties-part-card .button:hover {
    background: #e64500 !important;
}

/* Medium screens: SKU below name, equal split layout */
@media (max-width: 1500px) {
    .acties-exploded-view-layout {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .acties-part-card {
        grid-template-columns: 28px 64px minmax(0, 1fr) auto auto;
        grid-template-rows: auto auto;
    }

    /* SKU moves below the name, spanning the info column */
    .acties-part-card .part-sku {
        grid-column: 3;
    }

    /* Ref and img span both rows */
    .acties-part-card .part-ref { grid-row: 1 / 3; align-self: center; }
    .acties-part-card .part-img { grid-row: 1 / 3; align-self: center; }

    /* Grouped cards: no ref column, SKU under name */
    .acties-part-card--grouped {
        grid-template-columns: 64px minmax(0, 1fr) auto auto;
        grid-template-rows: auto auto;
    }
    .acties-part-card--grouped .part-sku { grid-column: 2; }
    .acties-part-card--grouped .part-img { grid-row: 1 / 3; }

    .acties-part-card .part-img img {
        width: 56px;
        height: 56px;
    }
}

/* Tablet/small: stack image above list */
@media (max-width: 1050px) {
    .acties-exploded-view-layout {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .acties-exploded-view-header {
        position: static;
    }
}

/* Mobile: tighter card layout */
@media (max-width: 768px) {
    .acties-parts-list {
        display: block !important;
        width: 100% !important;
    }

    .acties-part-card {
        display: grid !important;
        grid-template-columns: 56px minmax(0, 1fr) auto !important;
        grid-template-areas:
            "img ref ref"
            "img info info"
            "sku sku sku"
            "price price action";
        gap: 4px 12px !important;
        align-items: start !important;
        width: 100% !important;
        padding: 12px;
    }

    .acties-part-card--grouped {
        grid-template-areas:
            "img info info"
            "sku sku sku"
            "price price action";
    }

    .acties-part-card .part-img {
        grid-area: img;
        float: none !important;
        margin: 0 !important;
        align-self: start;
    }

    .acties-part-card .part-ref {
        grid-area: ref;
        display: block;
        text-align: left;
        line-height: 1;
        align-self: end;
    }

    .acties-part-card .part-info {
        grid-area: info;
        min-width: 0;
    }

    .acties-part-card .part-sku {
        grid-area: sku;
        white-space: normal !important;
        overflow-wrap: anywhere;
    }

    .acties-part-card .part-price {
        grid-area: price;
        text-align: left !important;
        padding: 0 !important;
    }

    .acties-part-card .part-action {
        grid-area: action;
        float: none !important;
        justify-self: end;
        align-self: center;
    }

    .acties-part-card::after {
        content: none !important;
        display: none !important;
    }
}

@media (max-width: 750px) {
    .acties-part-card:not(.acties-part-card--grouped) {
        grid-template-columns: 56px minmax(0, 1fr) auto auto !important;
        grid-template-areas:
            "img ref price action"
            "img info info info"
            "img sku sku sku" !important;
        gap: 4px 10px !important;
    }

    .acties-part-card:not(.acties-part-card--grouped) .part-ref,
    .acties-part-card:not(.acties-part-card--grouped) .part-price,
    .acties-part-card:not(.acties-part-card--grouped) .part-action {
        align-self: start;
    }

    .acties-part-card:not(.acties-part-card--grouped) .part-price,
    .acties-part-card:not(.acties-part-card--grouped) .part-action {
        justify-self: end;
    }
}

/* ── Mobile Overrides ── */
@media (max-width: 768px) {
    /* The archive grid can size this section to max-content width on small
       screens, which clips the exploded-view image inside the viewport. */
    body.has-exploded-view .site-main {
        display: block !important;
    }

    body.has-exploded-view .col-full {
        width: 100% !important;
        max-width: 100vw !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .acties-exploded-view-layout {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        overflow: hidden;
    }

    .acties-exploded-view-header,
    .acties-parts-list {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }
}
