/**
 * IPHOXY B2B Theme - Product Catalog Styles
 */

/* ============================================
   Catalog Layout
   ============================================ */
.catalog-page {
    padding: var(--spacing-2xl) 0;
    background-color: var(--color-gray-100);
    min-height: calc(100vh - 200px);
}

.catalog-header {
    margin-bottom: var(--spacing-xl);
}

.catalog-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-black);
    margin-bottom: var(--spacing-sm);
}

.catalog-subtitle {
    color: var(--color-gray-600);
    font-size: 1rem;
}

/* ============================================
   Category Navigation
   ============================================ */
.category-nav {
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
}

.category-nav-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-md);
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.category-tab {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    background-color: var(--color-gray-100);
    color: var(--color-gray-700);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.category-tab:hover {
    background-color: var(--color-gray-200);
    color: var(--color-gray-800);
}

.category-tab.active {
    background-color: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}

.category-tab .count {
    margin-left: var(--spacing-sm);
    padding: 2px 8px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
}

.category-tab.active .count {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Sub-categories */
.subcategory-nav {
    margin-top: var(--spacing-md);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-gray-200);
}

.subcategory-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
}

.subcategory-tab {
    padding: 6px 14px;
    background-color: transparent;
    color: var(--color-gray-600);
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.subcategory-tab:hover {
    background-color: var(--color-gray-100);
    color: var(--color-gray-800);
}

.subcategory-tab.active {
    background-color: var(--color-gray-800);
    color: var(--color-white);
}

/* ============================================
   Search & Filters
   ============================================ */
.catalog-filters {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    min-width: 300px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 14px 20px 14px 50px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background-color: var(--color-white);
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(232, 32, 40, 0.1);
}

.search-box svg {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-gray-400);
}

.filter-dropdown {
    position: relative;
}

.filter-dropdown select {
    appearance: none;
    padding: 14px 45px 14px 20px;
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    background-color: var(--color-white);
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
}

/* ============================================
   Product Grid - Standard Layout
   ============================================ */
.products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
}

/* ============================================
   Bento Grid Layout - Modern Apple-Style
   ============================================ */
.products-grid.bento-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: minmax(200px, auto);
    gap: var(--spacing-lg);
}

/* Bento Grid Item Sizes */
.bento-grid .product-card {
    grid-column: span 3;
    grid-row: span 1;
}

/* Featured/Large Items - First 2 items span more */
.bento-grid .product-card:nth-child(1) {
    grid-column: span 6;
    grid-row: span 2;
}

.bento-grid .product-card:nth-child(2) {
    grid-column: span 6;
    grid-row: span 2;
}

/* Medium Items */
.bento-grid .product-card:nth-child(3),
.bento-grid .product-card:nth-child(4) {
    grid-column: span 4;
    grid-row: span 1;
}

.bento-grid .product-card:nth-child(5) {
    grid-column: span 4;
    grid-row: span 1;
}

/* Every 7th item is large */
.bento-grid .product-card:nth-child(7n) {
    grid-column: span 6;
    grid-row: span 2;
}

/* Every 11th item spans full width */
.bento-grid .product-card:nth-child(11n) {
    grid-column: span 8;
    grid-row: span 1;
}

/* Bento Large Card Styling */
.bento-grid .product-card:nth-child(1) .product-image,
.bento-grid .product-card:nth-child(2) .product-image,
.bento-grid .product-card:nth-child(7n) .product-image {
    aspect-ratio: auto;
    height: 100%;
    min-height: 280px;
}

.bento-grid .product-card:nth-child(1) .product-image img,
.bento-grid .product-card:nth-child(2) .product-image img,
.bento-grid .product-card:nth-child(7n) .product-image img {
    padding: var(--spacing-xl);
}

.bento-grid .product-card:nth-child(1) .product-name,
.bento-grid .product-card:nth-child(2) .product-name,
.bento-grid .product-card:nth-child(7n) .product-name {
    font-size: 1.25rem;
}

/* Bento Card Overlay for Large Items */
.bento-grid .product-card:nth-child(1),
.bento-grid .product-card:nth-child(2) {
    position: relative;
    background: linear-gradient(145deg, #1a1a1a 0%, #0a0a0a 100%);
}

.bento-grid .product-card:nth-child(1) .product-info,
.bento-grid .product-card:nth-child(2) .product-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    padding: var(--spacing-xl);
}

.bento-grid .product-card:nth-child(1) .product-name,
.bento-grid .product-card:nth-child(2) .product-name {
    color: #ffffff;
}

.bento-grid .product-card:nth-child(1) .product-category,
.bento-grid .product-card:nth-child(2) .product-category {
    color: #FF0000;
}

.bento-grid .product-card:nth-child(1) .product-sku,
.bento-grid .product-card:nth-child(2) .product-sku,
.bento-grid .product-card:nth-child(1) .product-stock,
.bento-grid .product-card:nth-child(2) .product-stock {
    color: rgba(255,255,255,0.7);
}

/* Bento Grid Responsive */
@media (max-width: 1200px) {
    .bento-grid .product-card {
        grid-column: span 4;
    }
    .bento-grid .product-card:nth-child(1),
    .bento-grid .product-card:nth-child(2) {
        grid-column: span 6;
    }
    .bento-grid .product-card:nth-child(7n) {
        grid-column: span 6;
    }
    .bento-grid .product-card:nth-child(11n) {
        grid-column: span 6;
    }
}

@media (max-width: 992px) {
    .bento-grid .product-card {
        grid-column: span 6;
    }
    .bento-grid .product-card:nth-child(1),
    .bento-grid .product-card:nth-child(2),
    .bento-grid .product-card:nth-child(7n),
    .bento-grid .product-card:nth-child(11n) {
        grid-column: span 12;
    }
}

@media (max-width: 576px) {
    .bento-grid .product-card,
    .bento-grid .product-card:nth-child(1),
    .bento-grid .product-card:nth-child(2),
    .bento-grid .product-card:nth-child(7n),
    .bento-grid .product-card:nth-child(11n) {
        grid-column: span 12;
        grid-row: span 1;
    }

    .bento-grid .product-card:nth-child(1) .product-info,
    .bento-grid .product-card:nth-child(2) .product-info {
        position: static;
        background: none;
    }

    .bento-grid .product-card:nth-child(1),
    .bento-grid .product-card:nth-child(2) {
        background: var(--color-white);
    }

    .bento-grid .product-card:nth-child(1) .product-name,
    .bento-grid .product-card:nth-child(2) .product-name {
        color: var(--color-black);
    }
}

.product-card {
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.product-image {
    position: relative;
    aspect-ratio: 1;
    background-color: var(--color-gray-100);
    overflow: hidden;
}

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: var(--spacing-lg);
    transition: transform var(--transition-normal);
}

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

.product-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-gray-400);
}

.product-image-placeholder svg {
    width: 64px;
    height: 64px;
}

.product-badge {
    position: absolute;
    top: var(--spacing-md);
    left: var(--spacing-md);
    padding: 4px 10px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: var(--radius-sm);
}

.product-badge.in-stock {
    background-color: var(--color-success);
    color: var(--color-white);
}

.product-badge.low-stock {
    background-color: var(--color-warning);
    color: var(--color-black);
}

.product-badge.new {
    background-color: var(--color-primary);
    color: var(--color-white);
}

.product-info {
    padding: var(--spacing-lg);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-category {
    font-size: 0.75rem;
    color: var(--color-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-xs);
}

.product-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-black);
    margin-bottom: var(--spacing-sm);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-sku {
    font-size: 0.8125rem;
    color: var(--color-gray-500);
    margin-bottom: var(--spacing-md);
}

.product-stock {
    font-size: 0.8125rem;
    color: var(--color-success);
    font-weight: 500;
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.product-stock svg {
    width: 16px;
    height: 16px;
}

.product-actions {
    margin-top: auto;
    display: flex;
    gap: var(--spacing-sm);
}

.product-actions .btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.8125rem;
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--spacing-3xl);
    background-color: var(--color-white);
    border-radius: var(--radius-lg);
}

.empty-state svg {
    width: 80px;
    height: 80px;
    color: var(--color-gray-300);
    margin-bottom: var(--spacing-lg);
}

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--color-gray-700);
    margin-bottom: var(--spacing-sm);
}

.empty-state p {
    color: var(--color-gray-500);
    margin-bottom: var(--spacing-lg);
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-2xl);
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 var(--spacing-md);
    background-color: var(--color-white);
    border: 1px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--color-gray-700);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.pagination a:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pagination .current {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-white);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1200px) {
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .catalog-filters {
        flex-direction: column;
    }
    
    .search-box {
        min-width: 100%;
    }
    
    .category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: var(--spacing-sm);
    }
    
    .category-tab {
        flex-shrink: 0;
    }
}

@media (max-width: 576px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .product-card {
        flex-direction: row;
    }
    
    .product-image {
        width: 120px;
        flex-shrink: 0;
        aspect-ratio: auto;
        height: auto;
    }
    
    .product-info {
        padding: var(--spacing-md);
    }
    
    .product-actions {
        flex-direction: column;
    }
}
