/* ==========================================================================
   catalog-viewmode-custom.css
   Catalog View Mode Customization — SimplexTheme / nopCommerce 4.80

   Strategy: Both "grid" (3-col) and "list" (4-col) share the .product-grid
   container class. All existing CSS (product-box-aspect-ratio.css,
   tablet-grid-fix.css, swiper) applies automatically to BOTH modes.
   Only the Bootstrap column class differs:
     · Grid mode → col-xs-12 col-sm-4 col-md-4        (3 columns)
     · List mode → col-xs-6  col-sm-3 col-md-3 col-lg-3 (4 columns)
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. VIEW MODE TOGGLE BUTTONS — Lucide SVG Icon Styles
      Replaces legacy FontAwesome fa-th / fa-th-list icons
   -------------------------------------------------------------------------- */

.grid-list-icon {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

/* Button wrapper */
.viewmode-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 6px;
    border: 1px solid transparent;
    margin: 0 1px;
    text-decoration: none !important;
    color: inherit;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

/* SVG icon */
.viewmode-icon svg {
    display: block;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    stroke: #9ca3af;
    fill: none;
    transition: stroke 0.15s ease;
    pointer-events: none;
}

/* Hover */
.viewmode-icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    text-decoration: none !important;
}
.viewmode-icon:hover svg { stroke: #374151; }

/* Selected */
.viewmode-icon.selected {
    background-color: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.18);
}
.viewmode-icon.selected svg { stroke: #111827; }

/* Accessibility */
.viewmode-icon:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 1px;
}


/* --------------------------------------------------------------------------
   2. 4-COLUMN (LIST MODE) — col-md-3 item rules
      Mirrors tablet-grid-fix.css logic which handles col-md-4 (3-col grid).
      These rules give col-md-3 items the same flexbox sizing treatment.
   -------------------------------------------------------------------------- */

/* TABLET (768–1199px): 4-column layout for list mode items */
@media (min-width: 768px) and (max-width: 1199.98px) {

    .product-grid.viewmode-4col .item-grid .item-box.col-md-3 {
        flex: 0 0 25% !important;
        width: 25% !important;
        max-width: 25% !important;
        padding: 12px !important;
        margin-bottom: 25px !important;
        float: none !important;
        clear: none !important;
        box-sizing: border-box !important;
    }

    /* Clear every 4th item for clean row breaks */
    .product-grid.viewmode-4col .item-grid .item-box.col-md-3:nth-child(4n+1) {
        clear: left !important;
    }
}

/* DESKTOP (1200px+): 4-column layout for list mode items */
@media (min-width: 1200px) {

    .product-grid.viewmode-4col .item-grid .item-box.col-md-3 {
        display: block !important;
        width: 25% !important;
        flex: 0 0 25% !important;
        max-width: 25% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        margin-bottom: 30px !important;
        float: none !important;
        clear: none !important;
    }
}

/* MOBILE (< 768px): 2-column for list mode, 1-column for grid */
@media (max-width: 767.98px) {
    /* list: col-xs-6 → 2-col (Bootstrap handles this naturally) */
    .product-grid.viewmode-4col .item-grid .item-box.col-xs-6 {
        box-sizing: border-box;
    }
}

/* VERY SMALL (< 480px): both modes → 1 column */
@media (max-width: 479.98px) {
    .product-grid.viewmode-4col .item-grid .item-box,
    .product-grid.viewmode-3col .item-grid .item-box {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }
}
