/**
 * Default Product Loop Template Styles
 * Grid layout with 2 columns by default, supports column variations
 * Uses WooFood color palette CSS variables
 * Enhanced design with modern styling
 */

/* ============================================
   BASE CONTAINER & GRID LAYOUT
   ============================================ */

.wf-template-wrapper.wf-template-default-grid {
    width: 100%;
    background: transparent;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    padding: 0;
    margin: 0;
}

/* Column variations */
.wf-template-wrapper.wf-template-default-grid.wf-template-columns-1 {
    grid-template-columns: 1fr;
}

.wf-template-wrapper.wf-template-default-grid.wf-template-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.wf-template-wrapper.wf-template-default-grid.wf-template-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.wf-template-wrapper.wf-template-default-grid.wf-template-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

/* ============================================
   PRODUCTS LIST
   ============================================ */

.wf-template-wrapper.wf-template-default-grid .wf-template-products {
    margin: 0;
    padding: 0;
    list-style: none;
    display: contents; /* Allow grid items to flow directly */
}

/* ============================================
   PRODUCT ITEM
   ============================================ */

.wf-template-wrapper.wf-template-default-grid .wf-template-product {
    padding: 14px 12px;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #ffffff;
    box-sizing: border-box;
    transition: all 0.3s ease;
    position: relative;
}

/* Subtle hover effect on product item */
.wf-template-wrapper.wf-template-default-grid .wf-template-product:hover {
    background: #fafafa;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.wf-template-wrapper.wf-template-default-grid .wf-template-product.unavailable {
    opacity: 0.5;
    pointer-events: none;
    background: #f5f5f5;
}

.wf-template-wrapper.wf-template-default-grid .wf-template-product.unavailable::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    pointer-events: none;
}

/* ============================================
   PRODUCT IMAGE
   ============================================ */

.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-image {
    flex-shrink: 0;
    position: relative;
}

.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-image img {
    height: 70px;
    width: 70px;
    max-width: 70px;
    min-width: 70px;
    display: block;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    object-fit: cover;
    background: #f8f8f8;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Subtle image hover effect */
.wf-template-wrapper.wf-template-default-grid .wf-template-product:hover .product-image img {
    transform: scale(1.02);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.12);
}

/* ============================================
   PRODUCT TITLE & DESCRIPTION
   ============================================ */

.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-title {
    flex: 1;
    min-width: 0; /* Allow text truncation */
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
    font-size: 16px;
    font-weight: 500;
}

.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-title > span {
    font-size: 16px;
    font-weight: 500;
    color: var(--woofood-text-color, #333333);
    -webkit-text-fill-color: var(--woofood-text-color, #333333);
    display: block;
    line-height: 1.4;
    transition: color 0.2s ease;
}

.wf-template-wrapper.wf-template-default-grid .wf-template-product:hover .product-title > span {
    color: var(--woofood-primary-color, #333333);
}

.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-short-descr {
    margin-top: 6px;
}

.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-short-descr span {
    font-size: 11px;
    color: rgba(0, 0, 0, 0.6);
    display: block;
    line-height: 1.4;
    font-weight: 400;
}

/* ============================================
   PRODUCT PRICE
   ============================================ */

.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-price {
    flex-shrink: 0;
    line-height: 1.4;
    font-size: 15px;
    font-weight: 600;
    color: var(--woofood-secondary-color, #cc0000);
    white-space: nowrap;
    text-align: right;
    min-width: 60px;
}

.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-price ins {
    display: block;
    text-decoration: none;
    color: var(--woofood-secondary-color, #cc0000);
    font-weight: 600;
}

.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-price del {
    display: block;
    color: rgba(0, 0, 0, 0.4);
    font-size: 13px;
    font-weight: 400;
    margin-bottom: 2px;
}

/* ============================================
   PRODUCT BUTTON
   ============================================ */

.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button .cart {
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Enhanced button styles - all button types */
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button .button,
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button .woofood-quickview-button,
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button button {
    cursor: pointer;
    position: relative;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
    border-radius: 6px;
    display: inline-block;
    padding: 9px 18px;
    background: var(--woofood-secondary-color, #ffc600);
    color: var(--woofood-button-text-color, #5a460a) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    overflow: hidden;
    white-space: nowrap;
}

/* Button hover effect with smooth transition */
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button .button:hover,
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button .woofood-quickview-button:hover,
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button button:hover {
    background: var(--woofood-accent-color, #ffb645);
    color: var(--woofood-button-text-color, #5a460a) !important;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Button active state */
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button .button:active,
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button .woofood-quickview-button:active,
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Consolidated focus styles with better visibility */
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button .button:focus,
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button .woofood-quickview-button:focus,
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button button:focus,
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button .button:focus-visible,
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button .woofood-quickview-button:focus-visible,
.wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button button:focus-visible {
    outline: 2px solid var(--woofood-secondary-color, #ffc600);
    outline-offset: 3px;
    border-radius: 6px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Mobile: Single column layout */
@media screen and (max-width: 768px) {
    .wf-template-wrapper.wf-template-default-grid,
    .wf-template-wrapper.wf-template-default-grid.wf-template-columns-1,
    .wf-template-wrapper.wf-template-default-grid.wf-template-columns-2,
    .wf-template-wrapper.wf-template-default-grid.wf-template-columns-3,
    .wf-template-wrapper.wf-template-default-grid.wf-template-columns-4 {
        grid-template-columns: 1fr !important;
        gap: 0;
        padding: 0;
        background-color: transparent;
    }
    
    .wf-template-wrapper.wf-template-default-grid .wf-template-product {
        width: 100%;
        padding: 10px;
        margin-bottom: 0;
        gap: 8px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    }
    
    .wf-template-wrapper.wf-template-default-grid .wf-template-product:last-child {
        border-bottom: none;
    }
    
    .wf-template-wrapper.wf-template-default-grid .wf-template-product .product-image img {
        height: 65px;
        width: 65px;
        max-width: 65px;
        min-width: 65px;
    }
    
    .wf-template-wrapper.wf-template-default-grid .wf-template-product .product-title {
        font-size: 15px;
        line-height: 1.4;
    }
    
    .wf-template-wrapper.wf-template-default-grid .wf-template-product .product-title > span {
        font-size: 15px;
    }
    
    .wf-template-wrapper.wf-template-default-grid .wf-template-product .product-price {
        font-size: 14px;
        min-width: 55px;
    }
    
    .wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button .button,
    .wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button .woofood-quickview-button,
    .wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button button {
        font-size: 13px;
        padding: 10px 16px;
     
    }
}

/* Tablet: 2 columns for 3+ column layouts */
@media (min-width: 481px) and (max-width: 768px) {
    .wf-template-wrapper.wf-template-default-grid.wf-template-columns-3,
    .wf-template-wrapper.wf-template-default-grid.wf-template-columns-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large screens: Better spacing for 3+ columns */
@media (min-width: 1200px) {
    .wf-template-wrapper.wf-template-default-grid .wf-template-product {
        padding: 16px 14px;
        gap: 14px;
    }
    
    .wf-template-wrapper.wf-template-default-grid .wf-template-product .product-image img {
        height: 75px;
        width: 75px;
        max-width: 75px;
        min-width: 75px;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
    .wf-template-wrapper.wf-template-default-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        background-color: transparent;
    }
    
    .wf-template-wrapper.wf-template-default-grid .wf-template-product {
        border: 1px solid #000;
        break-inside: avoid;
        background: #fff;
        box-shadow: none;
    }
    
    .wf-template-wrapper.wf-template-default-grid .wf-template-product .product-button {
        display: none;
    }
    
    .wf-template-wrapper.wf-template-default-grid .wf-template-product .product-image img {
        border: 1px solid #000;
        box-shadow: none;
    }
}
