/**
 * Aved Product Grid - Linear App Style
 */

:root {
    --aved-font: var(--wd-title-font, inherit);
    --aved-bg: #ffffff;
    --aved-bg-secondary: #f7f7f7;
    --aved-border: #e5e5e5;
    --aved-text: #1a1a1a;
    --aved-text-secondary: #6b7280;
    --aved-accent: #5e6ad2;
    --aved-success: #10b981;
    --aved-warning: #f59e0b;
    --aved-shadow: 0 1px 3px rgba(0,0,0,0.08);
    --aved-radius: 8px;
    --aved-gap: 12px;
}

.aved-grid { 
    width: 100%; 
    max-width: 1200px; 
    margin: 0 auto; 
    padding: 0; 
    font-family: var(--aved-font);
}

.aved-grid * { 
    box-sizing: border-box; 
}

/* Container & Layout */
.aved-grid .aved-products {
    display: block;
}

/* Grid Layout */
.aved-grid .aved-products-flex { 
    display: flex; 
    flex-wrap: wrap; 
    width: 100%;
    margin: -6px;
}

/* Slider Layout */
.aved-grid .aved-products-slider { 
    display: flex; 
    overflow-x: auto; 
    scroll-behavior: smooth; 
    -webkit-overflow-scrolling: touch; 
    scrollbar-width: none; 
    padding-bottom: 4px;
}

.aved-grid .aved-products-slider::-webkit-scrollbar { 
    display: none; 
}

.aved-grid .aved-slider-track { 
    display: flex; 
    flex-wrap: nowrap; 
    padding: 6px;
}

/* Card Column */
.aved-grid .aved-products-flex .aved-card-column,
.aved-grid .aved-products-slider .aved-slide {
    padding: 6px;
}

/* Desktop columns - from data-columns attribute */
@media (min-width: 769px) {
    .aved-grid .aved-products-flex.aved-cols-1 .aved-card-column { width: 100%; flex: 0 0 100%; }
    .aved-grid .aved-products-flex.aved-cols-2 .aved-card-column { width: 50%; flex: 0 0 50%; }
    .aved-grid .aved-products-flex.aved-cols-3 .aved-card-column { width: 33.333%; flex: 0 0 33.333%; }
    .aved-grid .aved-products-flex.aved-cols-4 .aved-card-column { width: 25%; flex: 0 0 25%; }
    .aved-grid .aved-products-flex.aved-cols-5 .aved-card-column { width: 20%; flex: 0 0 20%; }
    .aved-grid .aved-products-flex.aved-cols-6 .aved-card-column { width: 16.666%; flex: 0 0 16.666%; }
    
    /* Slider - desktop columns set by JS */
    .aved-products-slider .aved-slide.cols-1 { width: 100%; flex: 0 0 100%; }
    .aved-products-slider .aved-slide.cols-2 { width: 50%; flex: 0 0 50%; }
    .aved-products-slider .aved-slide.cols-3 { width: 33.333%; flex: 0 0 33.333%; }
    .aved-products-slider .aved-slide.cols-4 { width: 25%; flex: 0 0 25%; }
    .aved-products-slider .aved-slide.cols-5 { width: 20%; flex: 0 0 20%; }
    .aved-products-slider .aved-slide.cols-6 { width: 16.666%; flex: 0 0 16.666%; }
}

/* Mobile - uses data-mobile-columns */
@media (max-width: 768px) {
    .aved-grid .aved-products-flex .aved-card-column { width: 50%; flex: 0 0 50%; }
    
    /* Slider - mobile columns set by JS with decimal support */
    .aved-products-slider .aved-slide { width: 50%; flex: 0 0 50%; }
    .aved-products-slider .aved-slide.cols-mobile-1 { width: 100%; flex: 0 0 100%; }
    .aved-products-slider .aved-slide.cols-mobile-1\.5 { width: 66.666%; flex: 0 0 66.666%; }
    .aved-products-slider .aved-slide.cols-mobile-2 { width: 50%; flex: 0 0 50%; }
    .aved-products-slider .aved-slide.cols-mobile-2\.5 { width: 40%; flex: 0 0 40%; }
    .aved-products-slider .aved-slide.cols-mobile-3 { width: 33.333%; flex: 0 0 33.333%; }
}

/* Tabs */
.aved-grid .aved-tabs { 
    display: flex; 
    gap: 8px; 
    padding: 4px; 
    background: var(--aved-bg-secondary); 
    border-radius: 20px; 
    margin-bottom: 20px; 
    overflow-x: auto;
    scrollbar-width: none;
}

.aved-grid .aved-tabs::-webkit-scrollbar { 
    display: none; 
}

.aved-grid .aved-tab { 
    display: inline-flex;
    align-items: center;
    padding: 8px 16px; 
    background: transparent; 
    border: none; 
    border-radius: 16px; 
    cursor: pointer; 
    font-size: 13px; 
    font-weight: 500; 
    color: var(--aved-text-secondary); 
    white-space: nowrap;
    transition: all 0.15s ease;
    font-family: var(--aved-font);
}

.aved-grid .aved-tab:hover { 
    color: var(--aved-text);
}

.aved-grid .aved-tab.is-active { 
    background: var(--aved-bg); 
    color: var(--aved-text);
    box-shadow: var(--aved-shadow);
}

/* Card */
.aved-grid .aved-card { 
    background: var(--aved-bg); 
    border: 1px solid var(--aved-border); 
    border-radius: var(--aved-radius); 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    height: 100%;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.aved-grid .aved-card:hover { 
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

/* Card Image */
.aved-grid .aved-card-image { 
    position: relative; 
    width: 100%; 
    padding-bottom: 75%; 
    background: var(--aved-bg-secondary);
    overflow: hidden;
}

.aved-grid .aved-card-image img { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    object-fit: cover;
    transition: transform 0.3s ease;
}

.aved-grid .aved-card:hover .aved-card-image img {
    transform: scale(1.02);
}

/* Card Body */
.aved-grid .aved-card-body { 
    padding: 16px; 
    flex: 1; 
    display: flex; 
    flex-direction: column;
}

.aved-grid .aved-card-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start; 
    margin-bottom: 8px;
    gap: 8px;
}

.aved-grid .aved-card-badge { 
    display: inline-block; 
    padding: 4px 8px; 
    background: var(--aved-accent); 
    color: #fff; 
    font-size: 10px; 
    font-weight: 600; 
    border-radius: 4px; 
    text-transform: uppercase; 
    letter-spacing: 0.5px;
    font-family: var(--aved-font);
}

.aved-grid .aved-card-cat { 
    font-size: 11px; 
    font-weight: 500; 
    color: var(--aved-text-secondary); 
    font-family: var(--aved-font);
}

.aved-grid .aved-card-rating { 
    display: flex; 
    align-items: center; 
    gap: 4px;
}

.aved-grid .aved-star { 
    color: var(--aved-warning); 
    font-size: 13px;
}

.aved-grid .aved-rating-count { 
    font-size: 12px; 
    color: var(--aved-text-secondary); 
    font-family: var(--aved-font);
}

/* Card Title */
.aved-grid .aved-card-title { 
    font-size: 14px; 
    font-weight: 600; 
    line-height: 1.4; 
    margin: 0 0 6px; 
    font-family: var(--aved-font);
}

.aved-grid .aved-card-title a { 
    color: var(--aved-text); 
    text-decoration: none; 
}

.aved-grid .aved-card-title a:hover {
    color: var(--aved-accent);
}

/* Features */
.aved-grid .aved-card-feature { 
    display: inline-block; 
    padding: 4px 8px; 
    background: var(--aved-bg-secondary); 
    color: var(--aved-text); 
    font-size: 10px; 
    font-weight: 500; 
    border-radius: 4px; 
    font-family: var(--aved-font);
}

.aved-grid .aved-card-features { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 6px; 
    margin-top: 8px;
}

/* Excerpt */
.aved-grid .aved-card-excerpt { 
    font-size: 12px; 
    color: var(--aved-text-secondary); 
    line-height: 1.5; 
    margin: 0 0 12px; 
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-family: var(--aved-font);
}

/* Price */
.aved-grid .aved-card-price-row { 
    display: flex; 
    align-items: baseline; 
    gap: 8px; 
    margin-top: auto;
    margin-bottom: 8px;
}

.aved-grid .aved-card-sale-price { 
    font-size: 16px; 
    font-weight: 600; 
    color: var(--aved-text); 
    font-family: var(--aved-font);
}

.aved-grid .aved-card-regular-price { 
    font-size: 13px; 
    color: var(--aved-text-secondary); 
    text-decoration: line-through; 
    font-family: var(--aved-font);
}

.aved-grid .aved-card-save { 
    font-size: 11px; 
    font-weight: 600; 
    color: var(--aved-success); 
    font-family: var(--aved-font);
}

/* Button */
.aved-grid .aved-card-action { 
    margin-top: 4px;
}

.aved-grid .aved-btn { 
    display: block; 
    width: 100%; 
    padding: 10px 16px; 
    background: var(--aved-text); 
    color: #fff; 
    text-align: center; 
    text-decoration: none; 
    border-radius: 6px; 
    font-size: 12px; 
    font-weight: 600; 
    border: none; 
    transition: all 0.15s ease;
    font-family: var(--aved-font);
}

.aved-grid .aved-btn:hover { 
    background: #333;
    transform: translateY(-1px);
}

/* Empty State */
.aved-grid .aved-empty { 
    text-align: center; 
    padding: 40px 20px; 
    background: var(--aved-bg-secondary); 
    border-radius: var(--aved-radius); 
    color: var(--aved-text-secondary); 
    font-size: 14px;
    font-family: var(--aved-font);
}

/* Responsive - Desktop */
@media (min-width: 769px) {
    .aved-grid .aved-products-flex .aved-card-column { width: 25%; flex: 0 0 25%; }
    .aved-grid .aved-products-flex.aved-cols-1 .aved-card-column { width: 100%; flex: 0 0 100%; }
    .aved-grid .aved-products-flex.aved-cols-2 .aved-card-column { width: 50%; flex: 0 0 50%; }
    .aved-grid .aved-products-flex.aved-cols-3 .aved-card-column { width: 33.333%; flex: 0 0 33.333%; }
    .aved-grid .aved-products-flex.aved-cols-4 .aved-card-column { width: 25%; flex: 0 0 25%; }
    .aved-grid .aved-products-flex.aved-cols-5 .aved-card-column { width: 20%; flex: 0 0 20%; }
    .aved-grid .aved-products-flex.aved-cols-6 .aved-card-column { width: 16.666%; flex: 0 0 16.666%; }
    
    /* Slider */
    .aved-grid .aved-products-slider .aved-slide { width: 33.333%; flex: 0 0 33.333%; min-width: 33.333%; }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .aved-grid .aved-products-flex .aved-card-column { width: 50%; flex: 0 0 50%; }
    .aved-grid .aved-products-slider .aved-slide { width: 50%; flex: 0 0 50%; min-width: 50%; }
    
    .aved-grid .aved-card-body { padding: 12px; }
    .aved-grid .aved-card-title { font-size: 13px; }
    .aved-grid .aved-card-sale-price { font-size: 14px; }
}