/* --------------------------------------------
   1. TRIGGER ICON
-------------------------------------------- */
.wc-slide-cart-trigger-container {
    display: inline-block;
    vertical-align: middle;
}

.wc-slide-cart-trigger {
    position: relative;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    text-decoration: none;
    transition: transform 0.2s, opacity 0.2s;
    vertical-align: middle;
}

.wc-slide-cart-trigger:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

/* Divi slide / fullscreen header cart */
.et_slide_menu_top .wc-slide-cart-trigger.et-cart-info,
.et_slide_in_menu_container .wc-slide-cart-trigger.et-cart-info {
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 0;
}

/* Hide Divi’s default cart icon glyph when our SVG is used */
a.et-cart-info.wc-slide-cart-trigger:before,
a.et-cart-info.wc-slide-cart-trigger span:before,
.et_pb_menu__cart-button.wc-slide-cart-trigger:before {
    display: none !important;
    content: none !important;
}

.et_slide_menu_top .wc-slide-cart-trigger .wc-slide-cart-icon,
.et_pb_menu__cart-button.wc-slide-cart-trigger .wc-slide-cart-icon {
    display: block;
}

.et_slide_menu_top .wc-slide-cart-trigger span:not(.wc-cart-count),
.et_pb_menu__cart-button.wc-slide-cart-trigger .et_pb_menu__cart-count {
    display: none;
}

.et_pb_menu__cart-button.wc-slide-cart-trigger {
    text-decoration: none;
}

.wc-sc-cart-trigger-prototype {
    display: none !important;
}

.wc-cart-count {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #e53e3e;
    color: #fff;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* --------------------------------------------
   2. SLIDE CART SIDEBAR
-------------------------------------------- */
.wc-slide-cart-sidebar {
    position: fixed;
    top: 0;
    right: -450px; /* Hidden by default */
    width: 400px;
    max-width: 100%;
    height: 100vh;
    background: #fff;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15);
    z-index: 1000001; /* Above Divi slide/fullscreen menu (999999) */
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

.wc-slide-cart-sidebar.active {
    right: 0;
}

/* Header */
.wc-cart-header {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
}

.wc-cart-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.wc-cart-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
    transition: color 0.2s;
}

.wc-cart-close:hover {
    color: #333;
}

/* Content Area */
.wc-cart-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
}

.wc-cart-empty {
    text-align: center;
    padding-top: 50px;
    color: #888;
}

/* Cart Item */
.wc-cart-item {
    background: #fff;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    gap: 15px;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    border: 1px solid #eee;
    transition: transform 0.2s, box-shadow 0.2s;
}

.wc-cart-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.wc-item-thumb img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 6px;
}

.wc-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.wc-item-name a {
    text-decoration: none;
    color: #333;
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wc-item-meta {
    font-size: 12px;
    color: #777;
    margin-top: 4px;
}

.wc-item-price {
    font-weight: bold;
    color: #555;
    margin-top: 5px;
    font-size: 14px;
}

/* Quantity Controls */
.wc-item-qty-control {
    display: flex;
    align-items: center;
    margin-top: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    width: fit-content;
}

.wc-qty-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    font-weight: bold;
    color: #555;
}

.wc-qty-btn:hover {
    background: #e0e0e0;
}

.wc-qty-input {
    width: 35px;
    height: 28px;
    text-align: center;
    border: none;
    background: transparent;
    font-size: 13px;
    padding: 0;
    -moz-appearance: textfield;
}

.wc-qty-input::-webkit-outer-spin-button,
.wc-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Remove Button */
.wc-remove-item {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    line-height: 1;
}

.wc-remove-item:hover {
    color: #e53e3e;
}

/* Footer */
.wc-cart-footer {
    padding: 20px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}

.wc-cart-subtotal {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.wc-cart-actions {
    display: flex;
    gap: 10px;
}

.wc-btn {
    flex: 1;
    text-align: center;
    padding: 12px;
    text-decoration: none;
    border-radius: 15px;
    font-family: poppins, sans-serif;
    font-weight: 500;
    transition: background 0.2s, filter 0.2s, color 0.2s;
}

.wc-btn-view {
    background: #f1f1f1;
    color: #333;
}

.wc-btn-view:hover {
    background: #e1e1e1;
}

.wc-btn-checkout {
    background: var(--gcid-primary-color, #dd4a26);
    color: #fff;
}

.wc-btn-checkout:hover {
    filter: brightness(0.9);
    color: #fff;
}

/* Overlay */
.wc-slide-cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000000; /* Above Divi slide/fullscreen menu (999999) */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    backdrop-filter: blur(2px);
}

.wc-slide-cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Mobile */
@media (max-width: 480px) {
    .wc-slide-cart-sidebar {
        width: 100%;
        right: -100%;
    }
}

/* --------------------------------------------
   3. AJAX SEARCH
-------------------------------------------- */
.wc-ajax-search-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.wc-search-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.wc-ajax-search-form .search-field {
    width: 100%;
    padding: 12px 40px 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.wc-ajax-search-form .search-field:focus {
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05);
}

.wc-search-submit {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #666;
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
}

.wc-search-submit:hover {
    background: #f5f5f5;
    color: #333;
}

.wc-search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #fff;
    margin-top: 10px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 1000;
    overflow: hidden;
    display: none;
    border: 1px solid #f0f0f0;
}

.wc-search-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.wc-search-list li {
    border-bottom: 1px solid #f9f9f9;
}

.wc-search-list li a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
}

.wc-search-list li a:hover {
    background: #f9f9f9;
}

.wc-search-thumb img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 15px;
}

.wc-search-info {
    display: flex;
    flex-direction: column;
}

.wc-search-info .title {
    font-weight: 500;
    font-size: 14px;
}

.wc-search-info .price {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.wc-view-all-results {
    display: block;
    text-align: center;
    padding: 10px;
    background: #f5f5f5;
    color: #666;
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
}

.wc-view-all-results:hover {
    background: #eee;
    color: #333;
}

.wc-no-results {
    padding: 20px;
    text-align: center;
    color: #888;
    font-size: 14px;
}

/* --------------------------------------------
   4. BARCODE
-------------------------------------------- */
.wc-product-barcode-wrapper {
    margin-top: 15px;
    padding: 10px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    display: inline-block;
}

.wc-product-barcode-wrapper img {
    max-width: 100%;
    height: auto;
    display: block;
}

.wc-product-barcode-wrapper .code-text {
    text-align: center;
    font-family: monospace;
    margin-top: 5px;
    font-size: 12px;
    color: #555;
}

/* --------------------------------------------
   5. AJAX ADD TO CART (SHORTCODE & LOOP)
-------------------------------------------- */
.wc-atc-wrapper {
    display: flex;
    align-items: stretch;
    gap: 8px;
    margin: 15px 0;
    flex-wrap: nowrap; /* Prevent wrapping */
}

/* Center in loops */
.wc-atc-wrapper.in-loop {
    width: 100%;
    justify-content: stretch;
    align-items: stretch;
    margin: 10px 0 0 0;
}

/* Qty Wrapper */
.wc-atc-qty-wrapper {
    display: flex;
    align-items: center;
    background: #f1f1f1;
    border-radius: 6px;
    height: 44px;
    border: 1px solid #ddd;
    overflow: hidden;
}

.wc-atc-qty-btn {
    width: 35px;
    height: 100%;
    border: none;
    background: #f8f8f8;
    cursor: pointer;
    font-size: 16px;
    color: #555;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wc-atc-qty-btn:hover {
    background: #e0e0e0;
}

.wc-atc-qty-input {
    width: 40px;
    height: 100%;
    border: none;
    background: #fff;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    padding: 0;
    -moz-appearance: textfield;
}
.wc-atc-qty-input::-webkit-outer-spin-button,
.wc-atc-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* The Button (shortcode / non-loop only) */
.wc-atc-wrapper:not(.in-loop) .wc-atc-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #333;
    color: #fff;
    border: none;
    padding: 0 20px;
    height: 44px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    min-width: 100px;
    white-space: nowrap;
}

.wc-atc-wrapper:not(.in-loop) .wc-atc-submit:hover {
    background: #000;
}

.wc-atc-wrapper:not(.in-loop) .wc-atc-submit:active {
    transform: translateY(1px);
}

/* Icon Mode */
.wc-atc-wrapper:not(.in-loop) .wc-atc-submit.icon-mode {
    min-width: 44px;
    width: 44px;
    padding: 0;
}

/* Loading State — keep label visible */
.wc-atc-submit.loading {
    opacity: 0.75;
    cursor: wait;
    pointer-events: none;
}
.wc-atc-submit.loading::after {
    content: none;
}

@keyframes wc-spin {
    to { transform: rotate(360deg); }
}

/* Variable product loop layout */
.wc-atc-wrapper.is-variable {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
}

.wc-atc-wrapper.in-loop .wc-atc-controls {
    display: flex;
    align-items: stretch;
    gap: 8px;
    width: 100%;
}

.wc-atc-wrapper.in-loop .wc-atc-controls.no-qty {
    width: 100%;
}

/* Loop: WooCommerce shop grid — full width */
.woocommerce ul.products li.product .wc-atc-wrapper.in-loop .wc-atc-submit.button {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
    margin-top: 0;
}

/* Loop button brand styling — lock typography so enabled/disabled match */
.wc-atc-wrapper.in-loop .wc-atc-submit.button {
    background: #570229 !important;
    color: #fff !important;
    border: 2px solid #570229 !important;
    cursor: pointer;
    font-size: 16px !important;
    font-weight: 500 !important;
    line-height: 1.7em !important;
    transition: background 0.2s, border-color 0.2s, opacity 0.2s;
}

.wc-atc-wrapper.in-loop .wc-atc-submit.button:hover:not(:disabled) {
    background: #3d011d !important;
    border-color: #3d011d !important;
    cursor: pointer;
}

/* Divi 5 Loop Builder — centered layout, auto-width button */
.wc-sc-divi5-atc-module {
    width: 100%;
}

.wc-sc-divi5-atc-module .wc-atc-wrapper.in-loop {
    width: 100%;
    max-width: 100%;
    margin-top: 8px;
    justify-content: stretch;
    align-items: stretch;
}

.wc-sc-divi5-atc-module .wc-atc-wrapper.is-variable {
    align-items: center;
}

.wc-sc-divi5-atc-module .wc-atc-wrapper.in-loop .wc-atc-controls,
.wc-sc-divi5-atc-module .wc-atc-wrapper.in-loop .wc-atc-controls.no-qty {
    width: 100%;
    justify-content: center;
}

.wc-sc-divi5-atc-module .wc-atc-wrapper.in-loop .wc-atc-submit.button {
    display: inline-block;
    width: auto;
    min-width: 9em;
    box-sizing: border-box;
    text-align: center;
    margin-top: 0;
}

.wc-atc-wrapper:not(.in-loop) .wc-atc-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wc-atc-wrapper.in-loop .wc-atc-submit.button:disabled {
    background: #f5f5f5 !important;
    color: #999 !important;
    border-color: #ddd !important;
    cursor: not-allowed;
    opacity: 1 !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    line-height: 1.7em !important;
}

.wc-atc-wrapper:not(.in-loop) .wc-atc-submit:disabled:hover {
    background: #333;
}

/* Loop attribute swatches */
.wc-loop-attributes {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.wc-loop-attr-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.wc-loop-swatch {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 2px solid #ddd;
    border-radius: 50%;
    background: #f5f5f5;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
    overflow: hidden;
    flex-shrink: 0;
}

.wc-loop-swatch.is-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wc-loop-swatch .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.wc-loop-swatch.selected,
.wc-loop-pill.selected {
    border-color: #333;
    box-shadow: 0 0 0 1px #333;
}

.wc-loop-swatch.is-unavailable,
.wc-loop-pill.is-unavailable {
    opacity: 0.35;
    cursor: not-allowed;
    position: relative;
}

.wc-loop-swatch.is-unavailable::after,
.wc-loop-pill.is-unavailable::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    background: #999;
    transform: rotate(-45deg);
}

.wc-loop-pill {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, opacity 0.2s;
    position: relative;
}

.wc-loop-pill:hover:not(.is-unavailable) {
    border-color: #999;
    background: #f8f8f8;
}

.wc-loop-attr-more {
    font-size: 11px;
    color: #888;
    padding: 0 4px;
}

/* --------------------------------------------
   6. MOBILE OPTIMIZATIONS (Max Width 480px)
-------------------------------------------- */
@media (max-width: 480px) {
    /* Container: make sure it fits */
    .wc-atc-wrapper {
        gap: 5px;
        align-items: flex-end; /* Align bottom */
    }

    /* Qty Wrapper: Vertical Stack */
    .wc-atc-qty-wrapper {
        flex-direction: column-reverse; /* Minus bottom, Plus top */
        width: 30px;
        height: auto;
        border-radius: 4px;
    }

    /* Input: Middle */
    .wc-atc-qty-input {
        width: 100%;
        height: 24px;
        font-size: 12px;
        border-top: 1px solid #ddd;
        border-bottom: 1px solid #ddd;
    }

    /* Buttons: Top/Bottom */
    .wc-atc-qty-btn {
        width: 100%;
        height: 20px;
        font-size: 12px;
        line-height: 1;
    }

    /* Submit Button: Compact (shortcode / non-loop only) */
    .wc-atc-wrapper:not(.in-loop) .wc-atc-submit {
        height: 64px; /* Match the vertical stack height */
        font-size: 13px;
        padding: 0 15px;
        min-width: auto;
    }
    
    /* If it's icon mode on mobile, keep it square-ish */
    .wc-atc-wrapper:not(.in-loop) .wc-atc-submit.icon-mode {
        width: 64px; 
    }

    .wc-atc-wrapper.in-loop .wc-atc-submit.button,
    .wc-atc-wrapper.in-loop .wc-atc-submit.button:disabled {
        font-size: 16px !important;
        line-height: 1.7em !important;
    }
    
    /* In Loop specific mobile tweaks */
    .wc-atc-wrapper.in-loop {
        transform: scale(0.9); /* Slight scale down to fit tight grids */
    }

    .wc-loop-swatch {
        width: 22px;
        height: 22px;
    }

    .wc-loop-pill {
        min-width: 24px;
        height: 24px;
        font-size: 11px;
        padding: 0 6px;
    }

    .wc-atc-wrapper.is-variable .wc-atc-controls {
        gap: 5px;
    }
}

/* --------------------------------------------
   7. PRODUCT GALLERY THUMB SLIDER
-------------------------------------------- */
body.wc-sc-gallery-slider .wc-sc-thumb-slider {
    position: relative;
    width: 100%;
    margin-top: 10px;
}

body.wc-sc-gallery-slider.et-db #et-boc .et-l .et_pb_wc_images ol.flex-control-thumbs.flex-control-nav,
body.wc-sc-gallery-slider .wc-sc-thumb-slider .flex-control-thumbs,
body.wc-sc-gallery-slider .et_pb_wc_images .woocommerce-product-gallery ol.flex-control-thumbs,
body.wc-sc-gallery-slider .woocommerce div.product div.images ol.flex-control-thumbs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: hidden;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 0 4px !important;
    gap: 8px !important;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    --column-count: auto !important;
    --horizontal-gap: 8px !important;
    --vertical-gap: 0px !important;
}

body.wc-sc-gallery-slider.et-db #et-boc .et-l .et_pb_wc_images ol.flex-control-thumbs.flex-control-nav::-webkit-scrollbar,
body.wc-sc-gallery-slider .wc-sc-thumb-slider .flex-control-thumbs::-webkit-scrollbar,
body.wc-sc-gallery-slider .et_pb_wc_images .woocommerce-product-gallery ol.flex-control-thumbs::-webkit-scrollbar,
body.wc-sc-gallery-slider .woocommerce div.product div.images ol.flex-control-thumbs::-webkit-scrollbar {
    display: none;
}

body.wc-sc-gallery-slider.et-db #et-boc .et-l .et_pb_wc_images ol.flex-control-thumbs.flex-control-nav > li,
body.wc-sc-gallery-slider .wc-sc-thumb-slider .flex-control-thumbs > li,
body.wc-sc-gallery-slider .et_pb_wc_images .woocommerce-product-gallery ol.flex-control-thumbs > li,
body.wc-sc-gallery-slider .woocommerce div.product div.images ol.flex-control-thumbs > li {
    flex: 0 0 calc(25% - 6px) !important;
    width: calc(25% - 6px) !important;
    min-width: calc(25% - 6px) !important;
    max-width: calc(25% - 6px) !important;
    float: none !important;
    clear: none !important;
    margin: 0 !important;
    scroll-snap-align: start;
    box-sizing: border-box;
}

body.wc-sc-gallery-slider .woocommerce-product-gallery--columns-3 .flex-control-thumbs li:nth-child(3n + 1),
body.wc-sc-gallery-slider .woocommerce-product-gallery--columns-4 .flex-control-thumbs li:nth-child(4n + 1),
body.wc-sc-gallery-slider .woocommerce-product-gallery--columns-5 .flex-control-thumbs li:nth-child(5n + 1) {
    clear: none !important;
}

body.wc-sc-gallery-slider .wc-sc-thumb-slider .flex-control-thumbs img {
    width: 100% !important;
    height: auto !important;
    display: block;
}

body.wc-sc-gallery-slider .wc-sc-thumb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(87, 2, 41, 0.85);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

body.wc-sc-gallery-slider .wc-sc-thumb-nav:disabled {
    opacity: 0.35;
    cursor: default;
}

body.wc-sc-gallery-slider .wc-sc-thumb-prev {
    left: 4px;
}

body.wc-sc-gallery-slider .wc-sc-thumb-next {
    right: 4px;
}