/* ==========================================================================
   ADI Gadget - Shop Catalog & Product Card Stylesheet
   Premium WoodMart-like design with micro-interactions, full RTL, and mobile tuning.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. PRODUCT GRID LAYOUTS
   -------------------------------------------------------------------------- */

.products-grid,
ul.products {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 24px !important;
    list-style: none !important;
    padding: 0 !important;
    margin: 0 0 40px 0 !important;
}

/* Clear standard float styles from WooCommerce parent themes if any */
ul.products::before,
ul.products::after {
    display: none !important;
}

ul.products li.product {
    float: none !important;
    width: auto !important;
    margin: 0 !important;
}

/* --------------------------------------------------------------------------
   2. PRODUCT CARD CONTAINER & INNER FRAME
   -------------------------------------------------------------------------- */

ul.products li.product {
    position: relative;
    box-sizing: border-box;
}

.product-card-item,
ul.products li.product {
    position: relative;
    background-color: var(--color-white, #ffffff) !important;
    border-radius: var(--radius-xl, 16px) !important;
    border: 2px solid var(--color-border-light, #e2e8f0) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    direction: rtl;
    text-align: right;
}

[data-theme="dark"] .product-card-item,
[data-theme="dark"] ul.products li.product {
    background-color: #151823 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2) !important;
}

/* Hover Accent Border Highlight Effect (Matching site identity color) */
.product-card-item:hover,
ul.products li.product:hover {
    transform: translateY(-6px) !important;
    border-color: var(--color-accent, var(--adigadget-primary-color, #2563eb)) !important;
    box-shadow: 0 12px 28px -4px rgba(37, 99, 235, 0.2) !important;
}

[data-theme="dark"] .product-card-item:hover,
[data-theme="dark"] ul.products li.product:hover {
    border-color: var(--color-accent, #38bdf8) !important;
    box-shadow: 0 12px 28px -4px rgba(56, 189, 248, 0.25) !important;
}

/* --------------------------------------------------------------------------
   3. SMART CORNER BADGES (Top Right in RTL)
   -------------------------------------------------------------------------- */

.product-badge-wrapper,
ul.products li.product .onsale-wrapper {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 6px;
    pointer-events: none;
}

.product-badge,
ul.products li.product span.onsale {
    font-family: var(--font-secondary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    padding: 5px 12px;
    border-radius: 4px;
    color: var(--color-white);
    box-shadow: var(--shadow-xs);
    line-height: 1;
    display: inline-block;
    white-space: nowrap;
}

.badge-sale,
ul.products li.product span.onsale {
    background: linear-gradient(135deg, var(--color-price), var(--color-price-dark));
}

.badge-new {
    background: linear-gradient(135deg, var(--color-success), #27ae60);
}

/* --------------------------------------------------------------------------
   4. WISHLIST BUTTON (Top Left in RTL)
   -------------------------------------------------------------------------- */

.product-wishlist-wrapper {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.product-action-btn {
    background: var(--color-white);
    border: none;
    border-radius: var(--radius-full);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-secondary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-bounce), box-shadow var(--transition-fast);
}

.product-action-btn:hover {
    color: var(--color-price);
    background-color: var(--color-white);
    transform: scale(1.1);
    box-shadow: var(--shadow-md);
}

.product-action-btn svg {
    transition: transform var(--transition-fast);
}

.product-action-btn:active svg {
    transform: scale(0.85);
}

/* --------------------------------------------------------------------------
   5. IMAGE WRAPPER & HOVER ACTIONS
   -------------------------------------------------------------------------- */

.product-image-wrapper {
    position: relative;
    padding-top: 100%; /* Perfect 1:1 Square layout */
    overflow: hidden;
    background-color: #fafafa;
    width: 100%;
}

.product-image-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.product-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.15, 0.75, 0.5, 1);
    display: block;
}

/* Smooth zoom-in on card hover */
@media (min-width: 992px) {
    .product-card-item:hover .product-card-image,
    ul.products li.product:hover img {
        transform: scale(1.06);
    }
}

/* Action Overlay panel */
.product-card-overlay-actions {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translate(-50%, 15px);
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-base), transform var(--transition-base);
    display: flex;
    gap: 8px;
}

@media (min-width: 992px) {
    .product-card-item:hover .product-card-overlay-actions,
    ul.products li.product:hover .product-card-overlay-actions {
        opacity: 1;
        transform: translate(-50%, 0);
        pointer-events: auto;
    }
}

.btn-quick-view {
    background-color: var(--color-bg-dark);
    color: var(--color-white);
}

.btn-quick-view:hover {
    background-color: var(--color-price);
    color: var(--color-white);
}

/* Premium Tooltip styling */
.action-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translate(-50%, -8px) scale(0.95);
    background-color: rgba(26, 26, 46, 0.95);
    color: var(--color-white);
    font-size: var(--font-size-xs);
    font-family: var(--font-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    box-shadow: var(--shadow-md);
}

.action-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: rgba(26, 26, 46, 0.95) transparent transparent transparent;
}

.btn-quick-view:hover .action-tooltip {
    opacity: 1;
    transform: translate(-50%, -8px) scale(1);
}

/* --------------------------------------------------------------------------
   6. DETAILS WRAPPER (Rating, Title, Price, Action)
   -------------------------------------------------------------------------- */

.product-details-wrapper {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    z-index: 2;
    background-color: var(--color-white);
}

/* WooCommerce Rating */
.product-rating {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.star-rating {
    display: inline-block;
    font-family: "star", sans-serif;
    font-size: 11px;
    line-height: 1;
    position: relative;
    width: 65px;
    height: 12px;
    letter-spacing: 2px;
    color: #e0e0e0;
}

.star-rating::before {
    content: "★★★★★";
    position: absolute;
    top: 0;
    right: 0;
    color: #e0e0e0;
}

.star-rating span {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    text-indent: -9999px;
}

.star-rating span::before {
    content: "★★★★★";
    text-indent: 0;
    position: absolute;
    top: 0;
    right: 0;
    color: #f1c40f;
}

/* Title Styling */
.product-title {
    margin: 0 0 10px 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    font-family: var(--font-primary);
    min-height: 2.4em; /* Preserves vertical grid symmetry */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-title a {
    color: var(--color-text-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.product-title a:hover {
    color: var(--color-price);
}

/* Price Section */
.product-price {
    font-family: var(--font-secondary);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    min-height: 24px;
}

.product-price del {
    text-decoration: line-through !important;
    opacity: 0.55 !important;
    font-size: var(--font-size-xs) !important;
    color: var(--color-old-price) !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 4px !important;
    background: none !important;
    position: static !important;
    display: inline !important;
    line-height: normal !important;
}

.product-price ins {
    text-decoration: none;
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-md);
    color: var(--color-price);
}

.product-price .woocommerce-Price-amount {
    font-weight: var(--font-weight-bold);
    color: var(--color-price);
    font-size: var(--font-size-md);
}

.product-price del .woocommerce-Price-amount {
    font-weight: var(--font-weight-regular) !important;
    color: var(--color-old-price) !important;
    font-size: var(--font-size-xs) !important;
    text-decoration: line-through !important;
    border: none !important;
    background: none !important;
}

.product-price del::before,
.product-price del::after,
.product-price del *::before,
.product-price del *::after {
    display: none !important;
    content: none !important;
    border: none !important;
}

/* --------------------------------------------------------------------------
   7. ADD TO CART / LOOP ACTIONS
   -------------------------------------------------------------------------- */

.product-add-to-cart-wrapper {
    margin-top: auto;
}

.product-add-to-cart-wrapper .button,
ul.products li.product .button {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--color-bg-dark);
    color: var(--color-white);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    font-family: var(--font-secondary);
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
    box-sizing: border-box;
}

.product-add-to-cart-wrapper .button:hover,
ul.products li.product .button:hover {
    background-color: var(--color-price);
    color: var(--color-white);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.25);
}

.product-add-to-cart-wrapper .button:active,
ul.products li.product .button:active {
    transform: translateY(0);
}

/* Cart Icon layout fallback */
.product-add-to-cart-wrapper .button .cart-icon {
    flex-shrink: 0;
}

/* WooCommerce AJAX Loading & Added triggers */
.product-add-to-cart-wrapper .button.loading::after,
ul.products li.product .button.loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid var(--color-white);
    border-top-color: transparent;
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 4px;
}

.product-add-to-cart-wrapper .added_to_cart,
ul.products li.product .added_to_cart {
    width: 100% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    padding: 10px 14px !important;
    margin-top: 6px !important;
    border-radius: var(--radius-sm, 6px) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    transition: all 0.2s ease !important;
    background-color: var(--color-success-light, #ecfdf5) !important;
    color: var(--color-success, #10b981) !important;
    border: 1px solid var(--color-success, #10b981) !important;
    text-align: center !important;
    text-decoration: none !important;
}

.product-add-to-cart-wrapper .added_to_cart::before,
ul.products li.product .added_to_cart::before {
    content: '✓' !important;
    font-weight: bold !important;
}

.product-add-to-cart-wrapper .added_to_cart:hover,
ul.products li.product .added_to_cart:hover {
    background-color: var(--color-success, #10b981) !important;
    color: var(--color-white, #ffffff) !important;
}

/* Style WooCommerce Cart Remove button */
.woocommerce-cart-form__cart-item a.remove {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    color: #ef4444 !important;
    font-size: 22px !important;
    line-height: 1 !important;
    visibility: visible !important;
    opacity: 1 !important;
    border: 1px solid #ef4444 !important;
    border-radius: 50% !important;
    text-decoration: none !important;
    margin-top: 8px;
}

.woocommerce-cart-form__cart-item a.remove:hover {
    background-color: #ef4444 !important;
    color: #ffffff !important;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   8. RESPONSIVE BREAKPOINTS (Desktop vs Mobile layout tuning)
   -------------------------------------------------------------------------- */

@media (max-width: 1200px) {
    .products-grid,
    ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 20px !important;
    }
}

@media (max-width: 991px) {
    .products-grid,
    ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
    }

    .product-card-inner,
    ul.products li.product .product-inner {
        box-shadow: var(--shadow-sm);
        transform: none !important;
    }

    /* Keep Action buttons and overlays permanently visible on touch displays */
    .product-card-overlay-actions {
        opacity: 1 !important;
        transform: translate(-50%, 0) !important;
        pointer-events: auto !important;
        bottom: 8px;
    }

    .product-wishlist-wrapper {
        opacity: 1 !important;
        transform: none !important;
    }
}

@media (max-width: 576px) {
    .products-grid,
    ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .product-details-wrapper {
        padding: 10px;
    }

    .product-rating {
        margin-bottom: 6px;
    }

    .star-rating {
        font-size: 9px;
        width: 55px;
    }

    .product-title {
        font-size: var(--font-size-xs);
        min-height: 2.6em;
        margin-bottom: 6px;
    }

    .product-price {
        font-size: var(--font-size-sm);
        margin-bottom: 10px;
        min-height: auto;
    }

    .product-price ins,
    .product-price .woocommerce-Price-amount {
        font-size: var(--font-size-sm);
    }

    .product-price del,
    .product-price del .woocommerce-Price-amount {
        font-size: 10px;
    }

    .product-badge-wrapper {
        top: 8px;
        right: 8px;
    }

    .product-badge {
        padding: 3px 8px;
        font-size: 9px;
    }

    .btn-wishlist {
        width: 30px;
        height: 30px;
        top: 8px;
        left: 8px;
    }

    .btn-wishlist svg {
        width: 14px;
        height: 14px;
    }

    .btn-quick-view {
        width: 32px;
        height: 32px;
    }

    .btn-quick-view svg {
        width: 14px;
        height: 14px;
    }

    .product-add-to-cart-wrapper .button,
    ul.products li.product .button {
        padding: 8px 10px;
        font-size: 10px;
        border-radius: var(--radius-sm);
    }

    .product-add-to-cart-wrapper .button svg,
    ul.products li.product .button svg {
        width: 12px;
        height: 12px;
    }
}

/* ==========================================================================
   9. WOOCOMMERCE CATALOG ARCHIVE OVERRIDES
   ========================================================================== */

/* --------------------------------------------------------------------------
   9a. Shop Main Structural Container
   -------------------------------------------------------------------------- */
.adigadget-shop-container {
    max-width: 1400px !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding-top: 0 !important;
    padding-bottom: var(--space-16);
    direction: rtl;
    text-align: right;
}

.adigadget-shop-layout {
    display: block !important;
    width: 100% !important;
    margin-top: 0 !important;
}

.adigadget-shop-content {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* --------------------------------------------------------------------------
   9b. Off-Canvas Sidebar (Drawer on All Screens)
   -------------------------------------------------------------------------- */
.adigadget-shop-sidebar {
    position: fixed !important;
    top: 0 !important;
    bottom: 0 !important;
    right: -360px !important;
    width: 320px !important;
    max-width: 85vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    background-color: var(--color-white) !important;
    box-shadow: -5px 0 25px rgba(0,0,0,0.15) !important;
    transition: right 0.3s ease, visibility 0.3s ease !important;
    overflow-y: auto !important;
    visibility: hidden !important;
    padding: 24px !important;
    border-radius: 0 !important;
}

.adigadget-shop-sidebar.is-open {
    right: 0 !important;
    visibility: visible !important;
}
    flex-shrink: 0;
    background-color: var(--color-white);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-card);
    height: fit-content;
}

.sidebar-desktop-title {
    font-family: var(--font-primary);
    font-size: var(--font-size-md);
    font-weight: var(--font-weight-black);
    color: var(--color-text-primary);
    margin: 0 0 var(--space-6) 0;
    padding-bottom: var(--space-3);
    border-bottom: 2px solid var(--color-border-light);
    position: relative;
}

.sidebar-desktop-title::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 60px;
    height: 2px;
    background-color: var(--color-price);
}

.sidebar-header-mobile {
    display: none; /* Desktop hidden */
}

/* --------------------------------------------------------------------------
   9c. Sidebar Filters Widgets Styling
   -------------------------------------------------------------------------- */
.adigadget-shop-sidebar .widget {
    margin-bottom: 36px;
}

.adigadget-shop-sidebar .widget:last-child {
    margin-bottom: 0;
}

.adigadget-shop-sidebar .widget-title {
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    color: var(--color-text-primary);
    margin: 0 0 16px 0;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--color-border-light);
}

/* Categories List widget */
.adigadget-shop-sidebar ul.product-categories,
.adigadget-shop-sidebar ul.wc-layered-nav-rating {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.adigadget-shop-sidebar ul.product-categories li,
.adigadget-shop-sidebar ul.wc-layered-nav-rating li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-secondary);
    font-size: var(--font-size-sm);
}

.adigadget-shop-sidebar ul.product-categories li a,
.adigadget-shop-sidebar ul.wc-layered-nav-rating li a {
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.adigadget-shop-sidebar ul.product-categories li a:hover,
.adigadget-shop-sidebar ul.wc-layered-nav-rating li a:hover {
    color: var(--color-price);
}

.adigadget-shop-sidebar .count {
    font-size: var(--font-size-xs);
    color: var(--color-text-muted);
    background-color: var(--color-bg-secondary);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: var(--font-weight-semibold);
}

/* Price Filter widget */
.price_slider_wrapper .price_slider {
    margin-top: var(--space-3);
    margin-bottom: var(--space-4);
}

/* Ratings widget layout */
.wc-layered-nav-rating .star-rating {
    font-size: 11px;
}

/* --------------------------------------------------------------------------
   9d. Top Toolbar Above Products
   -------------------------------------------------------------------------- */
.adigadget-shop-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background-color: var(--color-white);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    gap: var(--space-4);
}

.toolbar-results-count {
    font-family: var(--font-secondary);
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    margin: 0;
}

.toolbar-results-count p {
    margin: 0;
}

.toolbar-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Grid/List switchers */
.layout-switcher {
    display: flex;
    gap: 6px;
    border-left: 1px solid var(--color-border-light);
    padding-left: 16px;
}

.switcher-btn {
    background-color: var(--color-bg-secondary);
    border: 1px solid var(--color-border-light);
    color: var(--color-text-secondary);
    width: 34px;
    height: 34px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-all-fast);
}

.switcher-btn:hover,
.switcher-btn.is-active {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: var(--color-white);
}

/* Catalog sorting select dropdown */
.toolbar-ordering select.orderby {
    font-family: var(--font-secondary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 8px 16px 8px 32px;
    background-color: var(--color-white);
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%236c757d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
}

.toolbar-ordering select.orderby:focus {
    border-color: var(--color-accent);
}

/* --------------------------------------------------------------------------
   9e. Mobile Filter Button Trigger
   -------------------------------------------------------------------------- */
.mobile-filter-toggle-wrapper {
    display: none; /* Desktop hidden */
}

.btn-filter-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--color-accent);
    color: var(--color-white);
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-family: var(--font-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    width: 100%;
    transition: background-color var(--transition-fast), box-shadow var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-filter-toggle:hover {
    background-color: var(--color-price);
    box-shadow: var(--shadow-md);
}

.btn-filter-toggle .toggle-text-hide {
    display: none;
}

.btn-filter-toggle.is-active .toggle-text-show {
    display: none;
}

.btn-filter-toggle.is-active .toggle-text-hide {
    display: inline;
}

/* --------------------------------------------------------------------------
   9f. Grid Columns Custom Archiving
   -------------------------------------------------------------------------- */
.products-grid-view ul.products {
    grid-template-columns: repeat(4, 1fr) !important;
}

/* --------------------------------------------------------------------------
   9g. List View Mode CSS Layout
   -------------------------------------------------------------------------- */
.products-list-view ul.products {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
}

.products-list-view ul.products li.product .product-inner,
.products-list-view .product-card-inner {
    flex-direction: row !important;
    align-items: center !important;
    height: auto !important;
    text-align: right !important;
}

.products-list-view .product-badge-wrapper {
    right: 12px !important;
    top: 12px !important;
}

.products-list-view .product-wishlist-wrapper {
    left: 12px !important;
    top: 12px !important;
}

.products-list-view .product-image-wrapper {
    width: 220px !important;
    padding-top: 220px !important; /* Square but fixed width constraints */
    flex-shrink: 0 !important;
}

.products-list-view .product-details-wrapper {
    padding: 24px !important;
    flex-grow: 1 !important;
    display: flex;
    flex-direction: column;
}

.products-list-view .product-add-to-cart-wrapper {
    margin-top: 16px !important;
}

.products-list-view .product-add-to-cart-wrapper .button,
.products-list-view ul.products li.product .button {
    width: auto !important;
    padding: 10px 32px !important;
}

/* --------------------------------------------------------------------------
   9h. Pagination Styling
   -------------------------------------------------------------------------- */
.adigadget-shop-pagination {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.adigadget-shop-pagination nav.woocommerce-pagination {
    border: none;
    padding: 0;
    margin: 0;
}

.adigadget-shop-pagination nav.woocommerce-pagination ul {
    display: flex;
    gap: 8px;
    list-style: none;
    padding: 0;
    margin: 0;
    border: none;
}

.adigadget-shop-pagination nav.woocommerce-pagination ul li {
    border: none;
    margin: 0;
    padding: 0;
    float: none;
    display: inline-block;
}

.adigadget-shop-pagination nav.woocommerce-pagination ul li span,
.adigadget-shop-pagination nav.woocommerce-pagination ul li a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-family: var(--font-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    transition: var(--transition-all-fast);
    background-color: var(--color-white);
}

.adigadget-shop-pagination nav.woocommerce-pagination ul li span.current {
    background-color: var(--color-accent) !important;
    color: var(--color-white) !important;
    border-color: var(--color-accent) !important;
}

.adigadget-shop-pagination nav.woocommerce-pagination ul li a:hover {
    background-color: var(--color-price) !important;
    color: var(--color-white) !important;
    border-color: var(--color-price) !important;
}

/* --------------------------------------------------------------------------
   9i. Off-canvas Drawer & Backdrop styles
   -------------------------------------------------------------------------- */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: var(--color-overlay-dark);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

/* --------------------------------------------------------------------------
   9j. Shop Archiving Responsive Breaks
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
    .adigadget-shop-layout {
        flex-direction: column;
        gap: 24px;
    }

    .mobile-filter-toggle-wrapper {
        display: block;
        margin-bottom: 20px;
    }

    /* Transform left/right sidebar to off-canvas responsive sliding drawer */
    .adigadget-shop-sidebar {
        position: fixed;
        top: 0;
        right: -320px; /* Slides in from the right edge in RTL layout */
        width: 300px;
        height: 100vh;
        z-index: 9999;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
        transition: right 0.3s ease,
                    visibility 0.3s ease,
                    opacity 0.3s ease;
        overflow-y: auto;
        border: none;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        padding: 24px;

        /* Bulletproof invisibility when inactive */
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }

    .adigadget-shop-sidebar.is-open {
        right: 0;
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-desktop-title {
        display: none; /* Hide on mobile drawers */
    }

    .sidebar-header-mobile {
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid var(--color-border-light);
        padding-bottom: 16px;
        margin-bottom: 24px;
        flex-shrink: 0;
    }

    .sidebar-mobile-title {
        font-family: var(--font-primary);
        font-size: var(--font-size-md);
        font-weight: var(--font-weight-black);
        color: var(--color-text-primary);
        margin: 0;
    }

    .btn-sidebar-close {
        background: none;
        border: none;
        font-size: 28px;
        font-weight: 300;
        color: var(--color-text-secondary);
        cursor: pointer;
        line-height: 1;
        padding: 0;
        transition: color var(--transition-fast);
    }

    .btn-sidebar-close:hover {
        color: var(--color-price);
    }

    .sidebar-inner {
        flex-grow: 1;
    }

    /* Catalog grid columns */
    .products-grid-view ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 767px) {
    .products-list-view ul.products li.product .product-inner,
    .products-list-view .product-card-inner {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .products-list-view .product-image-wrapper {
        width: 100% !important;
        padding-top: 100% !important;
    }

    .products-list-view .product-details-wrapper {
        width: 100% !important;
        box-sizing: border-box;
    }

    .products-list-view .product-add-to-cart-wrapper .button,
    .products-list-view ul.products li.product .button {
        width: 100% !important;
    }
}

@media (max-width: 576px) {
    /* 1 Column for standard catalog grids on phones as requested */
    .products-grid-view ul.products {
        grid-template-columns: 1fr !important;
    }

    .adigadget-shop-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 14px;
        gap: 12px;
    }

    .toolbar-results-count {
        text-align: center;
    }

    .toolbar-controls {
        justify-content: space-between;
    }

    .layout-switcher {
        border-left: none;
        padding-left: 0;
    }
}

/* ──── Dynamic Customizer Layout Styles ──── */

/* Sidebar Position Options */
.adigadget-shop-layout.sidebar-left {
    flex-direction: row-reverse; /* In RTL layout, this puts sidebar on the left and content on the right */
}

.adigadget-shop-layout.sidebar-none {
    display: block; /* Flex layout not needed */
}

.adigadget-shop-layout.sidebar-none .adigadget-shop-sidebar {
    display: none !important; /* Fully hide sidebar */
}

.adigadget-shop-layout.sidebar-none .mobile-filter-toggle-wrapper {
    display: none !important; /* Hide filter drawer button since filters are disabled */
}

/* Grid Columns Options */
@media (min-width: 1201px) {
    /* 4 columns grid */
    .products-grid-view.cols-4 ul.products {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 24px !important;
    }
    
    /* 3 columns grid */
    .products-grid-view.cols-3 ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 1200px) and (min-width: 992px) {
    .products-grid-view.cols-4 ul.products {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ──────────────────────────────────────────────────────────────────────────
   10. PRODUCT CARD DUAL BUTTONS LAYOUT (BUY NOW & ADD TO CART)
   ────────────────────────────────────────────────────────────────────────── */
.product-card-buttons-wrapper {
    display: flex !important;
    gap: 8px !important;
    margin-top: auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Primary Button: Buy Now / الشراء */
.product-card-buttons-wrapper .btn-main-buy {
    flex: 1.3 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    background-color: var(--color-price, #e63946) !important;
    color: var(--color-white, #ffffff) !important;
    padding: 10px 14px !important;
    border-radius: var(--radius-sm, 6px) !important;
    font-size: var(--font-size-xs, 12px) !important;
    font-weight: var(--font-weight-bold, 700) !important;
    font-family: var(--font-secondary, 'Cairo', sans-serif) !important;
    text-decoration: none !important;
    transition: all var(--transition-fast, 0.2s) !important;
    border: 1px solid transparent !important;
    box-sizing: border-box !important;
    text-align: center !important;
}

.product-card-buttons-wrapper .btn-main-buy:hover {
    background-color: var(--color-price-light, #ff8787) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3) !important;
    color: var(--color-white, #ffffff) !important;
}

.product-card-buttons-wrapper .btn-main-buy:active {
    transform: translateY(0) !important;
}

/* Secondary Button Wrapper: Add to Cart / أضف إلى السلة */
.product-card-buttons-wrapper .product-secondary-cart-wrapper {
    flex: 1 !important;
    display: block !important;
    min-width: 0 !important;
}

.product-card-buttons-wrapper .product-secondary-cart-wrapper .button {
    width: 100% !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    background-color: var(--color-bg-dark, #1a1a2e) !important;
    color: var(--color-white, #ffffff) !important;
    padding: 10px 14px !important;
    border-radius: var(--radius-sm, 6px) !important;
    font-size: var(--font-size-xs, 12px) !important;
    font-weight: var(--font-weight-bold, 700) !important;
    font-family: var(--font-secondary, 'Cairo', sans-serif) !important;
    text-decoration: none !important;
    transition: all var(--transition-fast, 0.2s) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-sizing: border-box !important;
}

.product-card-buttons-wrapper .product-secondary-cart-wrapper .button:hover {
    background-color: #2d3748 !important;
    border-color: #2d3748 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    color: var(--color-white, #ffffff) !important;
}

/* Dark Mode Support overrides */
[data-theme="dark"] .product-card-buttons-wrapper .btn-main-buy {
    background-color: var(--color-accent, #e63946) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .product-card-buttons-wrapper .btn-main-buy:hover {
    background-color: var(--color-price-light, #ff8787) !important;
}

[data-theme="dark"] .product-card-buttons-wrapper .product-secondary-cart-wrapper .button {
    background-color: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: var(--color-text, #ffffff) !important;
}

[data-theme="dark"] .product-card-buttons-wrapper .product-secondary-cart-wrapper .button:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

/* Mobile Stack Layout */
@media (max-width: 767px) {
    .product-card-buttons-wrapper {
        flex-direction: column !important;
        gap: 6px !important;
    }
    .product-card-buttons-wrapper .btn-main-buy,
    .product-card-buttons-wrapper .product-secondary-cart-wrapper {
        flex: none !important;
        width: 100% !important;
    }
}

/* ==========================================================================
   ULTIMATE SHOP OVERRIDES (FULL 100% WIDTH, 4 COLUMNS, ZERO TOP MARGINS)
   ========================================================================== */

/* 1. Collapse Hero Section & Top Whitespaces completely */
.site-main,
#main,
main.site-main,
[data-hero],
.hero-section,
.ct-page-title,
.woocommerce-products-header,
.woocommerce-products-header__title,
.post-type-archive-product .site-main,
.tax-product_cat .site-main,
.woocommerce-shop .site-main {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

[data-hero],
.hero-section,
.ct-page-title,
.woocommerce-products-header,
.woocommerce-products-header__title,
header.page-header {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    max-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* 2. Container & Layout Full Width */
.adigadget-shop-container {
    max-width: 1400px !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding-top: 0 !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
}

.adigadget-shop-layout {
    display: block !important;
    width: 100% !important;
    margin-top: 0 !important;
}

.adigadget-shop-content {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* 3. Force 4 Columns Grid across Desktop */
@media (min-width: 992px) {
    .products-grid-view,
    .products-grid-view.cols-3,
    .products-grid-view.cols-4 {
        width: 100% !important;
    }

    .products-grid-view ul.products,
    .products-grid-view.cols-3 ul.products,
    .products-grid-view.cols-4 ul.products {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 24px !important;
        width: 100% !important;
    }
}

@media (max-width: 991px) and (min-width: 640px) {
    .products-grid-view ul.products,
    .products-grid-view.cols-3 ul.products,
    .products-grid-view.cols-4 ul.products {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 16px !important;
        width: 100% !important;
    }
}


/* --------------------------------------------------------------------------
   CART TOTALS TABLE - RTL Fix
   -------------------------------------------------------------------------- */

.cart_totals table.shop_table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

/* Force normal table layout - prevent responsive mode from hiding th */
.cart_totals table.shop_table tr {
    display: table-row !important;
    border-bottom: 1px solid #f3f4f6 !important;
}

.cart_totals table.shop_table th,
.cart_totals table.shop_table td {
    display: table-cell !important;
    padding: 14px 16px !important;
    vertical-align: middle !important;
}

.cart_totals table.shop_table th {
    text-align: right !important;
    font-weight: 600 !important;
    color: #374151 !important;
    white-space: nowrap !important;
    width: 50% !important;
}

.cart_totals table.shop_table td {
    text-align: left !important;
    font-weight: 700 !important;
    color: #1f2937 !important;
    white-space: nowrap !important;
}

/* Hide the ::before pseudo-element that duplicates the label inside td */
.cart_totals table.shop_table td::before {
    display: none !important;
}

.cart_totals table.shop_table tr.order-total td {
    font-size: 1.1rem !important;
    color: #2563eb !important;
    font-weight: 800 !important;
}
