/* AS&B Products Shortcode Styles */

.asb-products-container {
    margin: 20px 0;
    padding: 0;
}

.asb-products-title {
    margin: 0 0 20px 0;
    padding: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #feb900;
}

.asb-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.asb-product-item {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 15px 0;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.asb-product-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    border-color: #ccc;
}

.asb-product-image {
    position: relative;
    margin-bottom: 15px;
    overflow: hidden;
    border-radius: 6px;
}

.asb-product-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.asb-product-item:hover .asb-product-image img {
    transform: scale(1.05);
}

.asb-product-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.4;
    min-height: 50px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.asb-product-title a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

.asb-product-price {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
}

.asb-product-price .woocommerce-Price-amount {
    font-size: inherit;
}

.asb-product-price del {
    color: #999;
    font-weight: normal;
    margin-right: 8px;
}

.asb-product-price ins {
    text-decoration: none;
    color: #e74c3c;
}

.asb-product-button {
    display: inline-block;
    background: #2c5aa0;
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    border: none;
    cursor: pointer;
    min-width: 120px;
}

.asb-product-button:hover {
    background: #1e3f73;
    color: #fff;
}

.asb-product-button:visited {
    color: #fff;
}

.asb-product-stock-status {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: #fff;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.asb-product-stock-status.in-stock {
    background: #27ae60;
}

.asb-product-stock-status.out-of-stock {
    background: #e74c3c;
}

.asb-product-stock-status.on-backorder {
    background: #f39c12;
}

.asb-product-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #e74c3c;
    color: #fff;
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.asb-product-badge.sale {
    background: #e74c3c;
}

.asb-product-badge.featured {
    background: #f39c12;
}

.asb-product-badge.new {
    background: #27ae60;
}

.asb-products-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

.asb-products-loading {
    text-align: center;
    padding: 40px 20px;
}

.asb-products-error {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #f5c6cb;
    margin-bottom: 20px;
}

/* Mobile responsiveness */
@media (max-width: 1024px) {
    .asb-products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .asb-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .asb-product-item {
        padding: 12px;
    }
    
    .asb-product-image img {
        height: 150px;
    }
    
    .asb-product-title {
        font-size: 14px;
        min-height: 36px;
    }
    
    .asb-product-price {
        font-size: 16px;
    }
    
    .asb-product-button {
        padding: 8px 16px;
        font-size: 13px;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .asb-products-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .asb-product-item {
        padding: 15px;
    }
    
    .asb-product-image img {
        height: 200px;
    }
    
    .asb-product-title {
        font-size: 16px;
        min-height: auto;
    }
    
    .asb-product-price {
        font-size: 18px;
    }
    
    .asb-product-button {
        padding: 10px 20px;
        font-size: 14px;
        min-width: 120px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.asb-product-item {
    animation: fadeInUp 0.3s ease forwards;
}

/* Staggered animation delay */
.asb-product-item:nth-child(1) { animation-delay: 0.1s; }
.asb-product-item:nth-child(2) { animation-delay: 0.2s; }
.asb-product-item:nth-child(3) { animation-delay: 0.3s; }
.asb-product-item:nth-child(4) { animation-delay: 0.4s; }
.asb-product-item:nth-child(5) { animation-delay: 0.5s; }
.asb-product-item:nth-child(6) { animation-delay: 0.6s; }
.asb-product-item:nth-child(7) { animation-delay: 0.7s; }
.asb-product-item:nth-child(8) { animation-delay: 0.8s; }

/* Special columns support */
.asb-products-grid.columns-1 {
    grid-template-columns: 1fr;
}

.asb-products-grid.columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.asb-products-grid.columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.asb-products-grid.columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

.asb-products-grid.columns-5 {
    grid-template-columns: repeat(5, 1fr);
}

.asb-products-grid.columns-6 {
    grid-template-columns: repeat(6, 1fr);
}

/* Responsive overrides for custom columns */
@media (max-width: 1024px) {
    .asb-products-grid.columns-5,
    .asb-products-grid.columns-6 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .asb-products-grid.columns-3,
    .asb-products-grid.columns-4,
    .asb-products-grid.columns-5,
    .asb-products-grid.columns-6 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .asb-products-grid.columns-2,
    .asb-products-grid.columns-3,
    .asb-products-grid.columns-4,
    .asb-products-grid.columns-5,
    .asb-products-grid.columns-6 {
        grid-template-columns: 1fr;
    }
}

/* Loading animation */
.asb-products-loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2c5aa0;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* WooCommerce compatibility */
.woocommerce .asb-products-container,
.woocommerce-page .asb-products-container {
    margin: 20px 0;
}

/* Theme compatibility */
.asb-products-container * {
    box-sizing: border-box;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .asb-product-item {
        border-color: #000;
    }
    
    .asb-product-item:hover {
        border-color: #2c5aa0;
    }
    
    .asb-product-button {
        border: 2px solid #2c5aa0;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .asb-product-item,
    .asb-product-image img {
        animation: none;
        transition: none;
    }
    
    .asb-product-item:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    .asb-product-button {
        display: none;
    }
    
    .asb-product-item {
        border: 1px solid #000;
        box-shadow: none;
        break-inside: avoid;
    }
    
    .asb-products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}