/*
 * Plist1 — Static structural CSS (browser-cached)
 * Dynamic admin styles are in per-instance generated CSS (stored in DB)
 */

/* ===================== Container ===================== */
.plist1 {
    /* NOTE: display is intentionally 'block' (default). Do NOT add display:flex here.
       .cl_filter_and_list (child) is the flex container that handles all filter layout
       directions (row/column). Adding flex here creates a competing row context that
       breaks carousel width calculations and horizontal product_box_layout. */
    margin-top: 10px;
}
.plist1 .cl_list_and_pagination {
    display: flex;
    flex-grow: 1;
    gap: 10px;
    position: relative;
}
.plist1 a, .plist1 button {
    text-decoration: none !important;
    cursor: pointer;
}
.plist1 .cl_product {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: box-shadow 0.25s ease, border-color 0.25s ease, background-color 0.25s ease, transform 0.25s ease;
}

/* ===================== Grid (default layout) ===================== */
.plist1 .cl_list {
    display: grid;
    width: 100%;
    margin: auto;
    overflow-x: hidden;
    overflow-y: hidden;
}

/* ===================== Layout Horizontal ===================== */
.plist1 .layout-horizontal {
    flex-direction: row;
}
.plist1 .layout-horizontal > div:nth-child(2) {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-grow: 1;
}
.plist1 .layout-horizontal .cl_image {
    height: auto;
    max-width: 40%;
}

/* ===================== Entry Animation ===================== */
@keyframes cl-fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===================== Pagination ===================== */
.plist1 .list-load-more-wrapper {
    text-align: center;
    margin-top: 20px;
}
.plist1 .list-load-more-btn {
    cursor: pointer;
    transition: opacity 0.3s ease;
}
.plist1 .list-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}
.plist1 .list-loading {
    margin-top: 10px;
    color: #6b7280;
}
.plist1 .list-pagination-numbers {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.plist1 .cl-pagination-number {
    min-width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
.plist1 .cl-pagination-number:disabled {
    cursor: not-allowed;
}
.plist1 .pagination-ellipsis {
    color: #9ca3af;
    font-weight: 500;
    padding: 0 4px;
    user-select: none;
}

/* ===================== Filter ===================== */
.plist1 .list-filter-groups {
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
}
.plist1 .list-filter-group {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: auto;
    min-width: 260px;
}
.plist1 .list-filter-group .cl_toggle_body {
    padding-top: 10px;
}
.plist1 .list-filter-group .cl_toggle_header {
    padding: 0px;
}
.plist1 ul.list-filter-group-items {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
    list-style: none;
    gap: 8px;
}
.plist1 .list-filter-show-more-item {
    /* Wrapper <li> for the Show More / Show Less button — sits inside the
       chips UL as the last item so the chip gap handles spacing automatically.
       Previously the button was a sibling of the UL with width:100% +
       margin-top:15px, which forced it onto its own row. */
    display: inline-flex;
}
/* Force own-row for non-chip display types — radio/checkbox have full-text
   labels that wrap differently than chips. On wide viewports with short
   labels, an inline show-more button can visually merge with the last
   item's row, looking like just another option. flex-basis:100% breaks
   the flex row so the button stays clearly distinct. Buttons + switch
   display types keep the inline-flow design (no override here). */
.plist1 .list-filter-display-radio .list-filter-show-more-item,
.plist1 .list-filter-display-checkbox .list-filter-show-more-item {
    flex-basis: 100%;
}
.plist1 .list-filter-show-more-btn {
    justify-content: center;
}
.plist1 .cl_filter_reset_buttons button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s ease;
}
.plist1 .cl_filter_reset_buttons button:hover {
    opacity: 0.8;
    transform: translateY(-1px);
}

@media (max-width: 767px) {
    .plist1 .list-filter-container {
        width: 100%;
    }
    .plist1 .list-filter-group .cl_toggle_body {
        width: 100%;
    }
}

/* ===================== Filter Modal Animation ===================== */
.plist1 .plist1-animated-modal.cl_modal {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.plist1 .plist1-animated-modal.cl_modal .cl_modal_container {
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.plist1 .plist1-animated-modal.cl_modal.cl_modal_open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}
.plist1 .plist1-animated-modal.cl_modal_center .cl_modal_container { transform: translate(-50%, -50%) translateY(20px) scale(0.98); opacity: 0; }
.plist1 .plist1-animated-modal.cl_modal_center.cl_modal_open .cl_modal_container { transform: translate(-50%, -50%); opacity: 1; }
.plist1 .plist1-animated-modal.cl_modal_left .cl_modal_container { transform: translateX(-100%); }
.plist1 .plist1-animated-modal.cl_modal_left.cl_modal_open .cl_modal_container { transform: translateX(0); }
.plist1 .plist1-animated-modal.cl_modal_right .cl_modal_container { transform: translateX(100%); }
.plist1 .plist1-animated-modal.cl_modal_right.cl_modal_open .cl_modal_container { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) {
    .plist1 .plist1-animated-modal.cl_modal,
    .plist1 .plist1-animated-modal .cl_modal_container { transition: none; }
}

/* ===================== Product Card ===================== */
.plist1 .cl_image {
    position: relative;
    width: 100%;
}
.plist1 .cl_image img {
    position: relative;
    height: 100%;
    width: 100%;
    object-fit: cover;
    object-position: center center;
}
.plist1 .cl_title a {
    display: block;
}
.plist1 .cl_prices {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.plist1 .cl_currency {
    display: flex;
}
.plist1 .prices_part {
    display: flex;
    gap: 10px;
    flex-direction: row;
    align-items: center;
    float: inline-start;
}
.plist1 .regular_price {
    display: flex;
    gap: 2px;
    text-decoration: line-through;
}
.plist1 .sale_price {
    display: flex;
    gap: 2px;
}
.plist1 .product_discount {
    display: flex;
    gap: 2px;
}
/* Stock scarcity badge (D2 polish) — image-corner overlay. Skin comes from the
   design preset (.cl-preset-{id}); this only anchors it. inset-inline-start
   keeps the corner logical in RTL. z-index sits above gallery slides/arrows. */
.plist1 .cl_image .cl-stock-badge {
    position: absolute;
    top: 8px;
    inset-inline-start: 8px;
    z-index: 3;
    pointer-events: none;
}
.plist1 .cl_actions {
    display: flex;
    flex-wrap: wrap;
}
.plist1 .product-link-button, .plist1 .add-to-cart-bt-button {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* ===================== Variations ===================== */
/*
 * Simplified variation styles — mirrors the filter variation look
 * (compact, clean, minimal). JS behavior is unchanged (single-select,
 * vr-is-selected, price calculation, cart integration).
 */
.plist1 .cl_variations {
    padding: 8px 16px;
}
.plist1 .cl-hide-vr-titles .cl-vr-title {
    display: none;
}
.plist1 .cl-vr-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}
.plist1 .cl-vr-parent {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}
.plist1 .cl-vr-title {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
}
.plist1 .cl-vr-title .selected-value {
    font-weight: 400;
    opacity: 0.7;
}
.plist1 .cl-vr-error-msg {
    font-size: 12px;
}
.plist1 .cl-vr-items ul {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}
.plist1 .cl-vr-items ul li {
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

/* --- Buttons type: compact pills --- */
.plist1 .cl-vr-buttons ul li {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border: 1px solid var(--cl-border-color1);
    border-radius: 4px;
    font-size: 13px;
    background: transparent;
}
.plist1 .cl-vr-buttons ul li:hover {
    border-color: var(--cl-border-color2);
}
.plist1 .cl-vr-buttons ul li.vr-is-selected {
    border-color: var(--cl-border-color2);
    background-color: var(--cl-bg-color3);
}

/* --- Colorbox type: small circles like filter swatches --- */
.plist1 .cl-vr-colorbox ul li {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.plist1 .cl-vr-colorbox ul li span:nth-child(1) {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
    flex-shrink: 0;
}
.plist1 .cl-vr-colorbox ul li:hover span:nth-child(1) {
    border-color: rgba(0,0,0,0.3);
}
.plist1 .cl-vr-colorbox ul li.vr-is-selected span:nth-child(1) {
    box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--cl-border-color2);
}
.plist1 .cl-vr-colorbox ul li span:nth-child(2) {
    font-size: 12px;
    line-height: 1;
}

/* --- Images type: small thumbnails --- */
.plist1 .cl-vr-images ul li {
    display: inline-flex;
    align-items: center;
    flex-direction: column;
    gap: 4px;
}
.plist1 .cl-vr-images ul li img {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--cl-border-color1);
}
.plist1 .cl-vr-images ul li:hover img {
    border-color: var(--cl-border-color2);
}
.plist1 .cl-vr-images ul li.vr-is-selected img {
    border-color: var(--cl-border-color2);
    box-shadow: 0 0 0 1px var(--cl-border-color2);
}
.plist1 .cl-vr-images ul li span {
    font-size: 11px;
    line-height: 1;
}

/* --- Selectbox type --- */
.plist1 .cl-vr-selectbox select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--cl-border-color1);
    border-radius: 4px;
    font-size: 13px;
    background: transparent;
}
.plist1 img {
    max-width: 100%;
}

/* ===================== Price Filter Slider ===================== */
.plist1 .price-range-slider {
    position: relative;
    height: 6px;
    margin-bottom: 18px;
    margin-top: 8px;
}
.plist1 .price-range-slider input[type="range"] {
    position: absolute;
    height: 6px;
    width: 100%;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    z-index: 1;
}
.plist1 .price-range-slider input[type="range"]::-webkit-slider-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #1a1a2e;
    pointer-events: auto;
    -webkit-appearance: none;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    transition: transform 0.15s ease;
}
.plist1 .price-range-slider input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
.plist1 .price-range-slider input[type="range"]::-moz-range-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid #1a1a2e;
    pointer-events: auto;
    cursor: pointer;
    -moz-appearance: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    transition: transform 0.15s ease;
}
.plist1 .price-range-slider input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.15);
}
.plist1 .slider-track {
    position: absolute;
    top: 0;
    left: 0;
    height: 6px;
    width: 100%;
    background: #e5e7eb;
    border-radius: 3px;
}
.plist1 .slider-range {
    position: absolute;
    top: 0;
    height: 6px;
    background: #1a1a2e;
    border-radius: 3px;
}
.plist1 .price-inputs-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.plist1 .price-input-group {
    display: flex;
    align-items: center;
    gap: 5px;
    border: solid 1px #e0e0e0;
    border-radius: 25px;
    padding: 6px 10px;
    transition: border-color 0.2s ease;
}
/* FIX: Prevent multi-character currency labels (e.g. "MAD") from wrapping
   vertically when the price input group is narrow (e.g. inside a 200px dropdown). */
.plist1 .price-input-group .currency-symbol {
    white-space: nowrap;
    font-size: 10px;
}
.plist1 .price-input-group:focus-within {
    border-color: #1a1a2e;
}
.plist1 .price-input-group input,
.plist1 .price-input-group input:hover,
.plist1 .price-input-group input:focus {
    width: 100%;
    height: auto !important;
    border: 0 !important;
    padding: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    text-align: end;
}

/* ============================================
   Product card image modes — hover_swap + gallery (3 variants)
   ============================================
   Driven by the `product_card_image_mode` setting on the plist1 product
   card. featured_only (default) needs no special CSS — it's just one
   <img> wrapped in <a>. */

/* --- hover_swap: featured + 2nd-gallery image stacked, swap on hover --- */
.plist1 .cl_image_hover_swap {
    position: relative;
}

.plist1 .cl_image_hover_swap a {
    position: relative;
    display: block;
    overflow: hidden;
}

.plist1 .cl_image_hover_swap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease;
}

.plist1 .cl_image_hover_swap .cl_image_secondary {
    position: absolute;
    inset: 0;
    opacity: 0;
}

/* Hover state — fade in the 2nd image, fade out the 1st. Triggered on
   the entire product card so users hovering anywhere on the card see
   the swap, not just the image area. */
.plist1 .cl_product:hover .cl_image_hover_swap .cl_image_primary {
    opacity: 0;
}

.plist1 .cl_product:hover .cl_image_hover_swap .cl_image_secondary {
    opacity: 1;
}

/* --- gallery / gallery_only_arrows / gallery_only_lightbox: embedded
       Gallery_cl on the product card. The base .cl_image_gallery rules
       below apply to all three; conditional UI (arrows / lightbox icon /
       video play overlay) is controlled by image.php — no per-variant
       CSS branching needed. --- */
.plist1 .cl_image_gallery {
    position: relative;
}

.plist1 .cl_image_gallery .cl_image_link {
    display: block;
    /* The anchor wraps the mini-gallery so click on the image area
       still navigates to the product page. Arrows + lightbox icon
       inside have their own click handlers that stopPropagation. */
}

.plist1 .cl_image_gallery .cl_gallery {
    width: 100%;
}

.plist1 .cl_image_gallery .cl-slides-container {
    aspect-ratio: 1 / 1;
    background: var(--cl-bg-color2, #f3f3f3);
    border-radius: 4px;
    overflow: hidden;
}

.plist1 .cl_image_gallery .cl-gallery-slide.active {
    align-items: center;
}

.plist1 .cl_image_gallery .cl-gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
}

/* Smaller arrows (matches reviewlist's compact-mode override) */
.plist1 .cl_image_gallery .cl-slide-arrows {
    width: 28px;
    height: 28px;
    font-size: 14px;
}

/* Smaller lightbox icon */
.plist1 .cl_image_gallery .cl-lightbox-trigger-icon {
    width: 26px;
    height: 26px;
    top: 6px;
    right: 6px;
}


/* ============================================
   Product card layout modes — 5 variants of $settings['product_box_layout']
   ============================================
   Mirrors p_upsell's layout system (comps/product/.../p_upsell/v1/generated_css.php)
   with plist1's own selectors swapped in. Selectors: outer card .cl_product;
   image .cl_image; title .cl_title; prices .cl_prices; variations .cl_variations;
   buttons .cl_actions. Row + content wrappers introduced for horizontal-with-
   full-width modes: .cl-card-row (flex row holding image + content) and
   .cl-card-content (right-side flex column inside the row).

   Layout-specific rules only — vertical uses the default flex column inherited
   from list.css / plist1.css base rules. */

/* --- horizontal: image left, rest stacked right --- */
.plist1 .cl_product.layout-horizontal {
    display: flex;
    flex-direction: row;
    gap: 5px;
}
.plist1 .cl_product.layout-horizontal .cl_image {
    flex: 0 0 40%;
    max-width: 40%;
}
.plist1 .cl_product.layout-horizontal > div:last-child {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    row-gap: 6px;
}

/* --- h_bt_full: image+content row + buttons full-width below --- */
.plist1 .cl_product.layout-h-bt-full {
    display: flex;
    flex-direction: column;
}
.plist1 .cl_product.layout-h-bt-full .cl-card-row {
    display: flex;
    flex-direction: row;
    gap: 5px;
    flex: 1;
}
.plist1 .cl_product.layout-h-bt-full .cl-card-row .cl_image {
    flex: 0 0 40%;
    max-width: 40%;
}
.plist1 .cl_product.layout-h-bt-full .cl-card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    row-gap: 6px;
}

/* --- h_vr_bt_full: image+content row + variations + buttons each full-width --- */
.plist1 .cl_product.layout-h-vr-bt-full {
    display: flex;
    flex-direction: column;
}
.plist1 .cl_product.layout-h-vr-bt-full .cl-card-row {
    display: flex;
    flex-direction: row;
    gap: 5px;
    flex: 1;
}
.plist1 .cl_product.layout-h-vr-bt-full .cl-card-row .cl_image {
    flex: 0 0 40%;
    max-width: 40%;
}
.plist1 .cl_product.layout-h-vr-bt-full .cl-card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    row-gap: 6px;
}
.plist1 .cl_product.layout-h-vr-bt-full > .cl_variations {
    flex-direction: row;
    flex-wrap: wrap;
}
.plist1 .cl_product.layout-h-vr-bt-full > .cl_variations > .cl-vr-parent {
    flex-grow: 1;
}

/* --- h_pr_vr_bt_full: image+content row + prices + variations + buttons each full-width --- */
.plist1 .cl_product.layout-h-pr-vr-bt-full {
    display: flex;
    flex-direction: column;
}
.plist1 .cl_product.layout-h-pr-vr-bt-full .cl-card-row {
    display: flex;
    flex-direction: row;
    gap: 5px;
    flex: 1;
}
.plist1 .cl_product.layout-h-pr-vr-bt-full .cl-card-row .cl_image {
    flex: 0 0 40%;
    max-width: 40%;
}
.plist1 .cl_product.layout-h-pr-vr-bt-full .cl-card-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    row-gap: 6px;
}
.plist1 .cl_product.layout-h-pr-vr-bt-full > .cl_variations {
    flex-direction: row;
    flex-wrap: wrap;
}
.plist1 .cl_product.layout-h-pr-vr-bt-full > .cl_variations > .cl-vr-parent {
    flex-grow: 1;
}

