/* STEM Product Categories Widget Styles */

.stem-categories-container {
    display: grid;
    gap: 24px;
    margin: 20px 0;
    background: inherit;
}

/* Grid Layout Styles */
.stem-style-grid.stem-columns-1 { grid-template-columns: 1fr; }
.stem-style-grid.stem-columns-2 { grid-template-columns: repeat(2, 1fr); }
.stem-style-grid.stem-columns-3 { grid-template-columns: repeat(3, 1fr); }
.stem-style-grid.stem-columns-4 { grid-template-columns: repeat(4, 1fr); }
.stem-style-grid.stem-columns-5 { grid-template-columns: repeat(5, 1fr); }
.stem-style-grid.stem-columns-6 { grid-template-columns: repeat(6, 1fr); }

/* List Layout Styles */
.stem-style-list {
    grid-template-columns: 1fr;
    gap: 20px;
}

.stem-style-list .stem-category-item {
    display: flex;
    align-items: center;
    background: inherit;
    padding: 16px;
    transition: all 0.3s ease;
}

.stem-style-list .stem-category-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    margin-right: 16px;
}

.stem-style-list .stem-category-content {
    flex: 1;
}

/* Masonry Layout */
.stem-style-masonry {
    column-count: var(--columns, 4);
    column-gap: 24px;
}

.stem-style-masonry .stem-category-item {
    break-inside: avoid;
    margin-bottom: 24px;
}

/* Category Item Styles */
.stem-category-item {
    background: inherit;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    padding: 16px;
}

.stem-category-item:hover {
    transform: translateY(-4px);
}

.stem-category-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

/* Category Image Styles - Circular Avatar */
.stem-category-image {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
    /* border-radius: 50%; */
    overflow: hidden;
    /* background: #f8f9fa; */
    /* border: 4px solid #e9ecef; */
    transition: all 0.3s ease;
}

.stem-category-image img {
    width: 90%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.stem-category-item:hover .stem-category-image {
    transform: scale(1);
 
}

.stem-category-item:hover .stem-category-image img {
    transform: scale(0.9);
}

.stem-category-overlay {
    display: none;
}

/* Category Content Styles */
.stem-category-content {
    padding: 0;
    text-align: center;
}

.stem-category-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--ast-global-color-0);
    margin: 0;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.stem-category-item:hover .stem-category-title {
    color: #667eea;
}

.stem-category-description {
    font-size: 0.85rem;
    color: inherit;
    opacity: 0.7;
    margin: 8px 0 0 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.stem-category-count {
    display: none;
}

/* STEM Theme Colors */
:root {
    --stem-primary: #667eea;
    --stem-secondary: #764ba2;
    --stem-accent: #f093fb;
    --stem-success: #48bb78;
    --stem-warning: #ed8936;
    --stem-error: #f56565;
    --stem-text: #2d3748;
    --stem-text-light: #718096;
    --stem-bg: #f7fafc;
}

/* Special STEM Categories Styling - Light circular backgrounds */
.stem-category-item[data-category*="robot"] .stem-category-image,
.stem-category-item[data-category*="coding"] .stem-category-image {
    background: #f0f4ff;
    border-color: #e0e7ff;
}

.stem-category-item[data-category*="science"] .stem-category-image,
.stem-category-item[data-category*="experiment"] .stem-category-image {
    background: #f0fff4;
    border-color: #dcfce7;
}

.stem-category-item[data-category*="math"] .stem-category-image,
.stem-category-item[data-category*="puzzle"] .stem-category-image {
    background: #fffbeb;
    border-color: #fed7aa;
}

.stem-category-item[data-category*="engineering"] .stem-category-image,
.stem-category-item[data-category*="building"] .stem-category-image {
    background: #fdf2f8;
    border-color: #fce7f3;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .stem-style-grid.stem-columns-6 { grid-template-columns: repeat(4, 1fr); }
    .stem-style-grid.stem-columns-5 { grid-template-columns: repeat(4, 1fr); }
    .stem-style-masonry { column-count: 3; }
}

@media (max-width: 992px) {
    .stem-style-grid.stem-columns-4,
    .stem-style-grid.stem-columns-5,
    .stem-style-grid.stem-columns-6 { 
        grid-template-columns: repeat(3, 1fr); 
    }
    .stem-style-masonry { column-count: 2; }
}

@media (max-width: 768px) {
    .stem-categories-container {
        gap: 20px;
    }
    
    .stem-style-grid.stem-columns-3,
    .stem-style-grid.stem-columns-4,
    .stem-style-grid.stem-columns-5,
    .stem-style-grid.stem-columns-6 { 
        grid-template-columns: repeat(2, 1fr); 
    }
    
    .stem-category-image {
        width: 100px;
        height: 100px;
        margin-bottom: 12px;
    }
    
    .stem-category-title {
        font-size: 0.9rem;
    }
    
    .stem-style-list .stem-category-item {
        flex-direction: column;
        text-align: center;
    }
    
    .stem-style-list .stem-category-image {
        width: 80px;
        height: 80px;
        margin-right: 0;
        margin-bottom: 12px;
    }
    
    .stem-style-masonry { column-count: 1; }
}

@media (max-width: 480px) {
    .stem-style-grid.stem-columns-2,
    .stem-style-grid.stem-columns-3,
    .stem-style-grid.stem-columns-4,
    .stem-style-grid.stem-columns-5,
    .stem-style-grid.stem-columns-6 { 
        grid-template-columns: 1fr; 
    }
    
    .stem-category-image {
        width: 90px;
        height: 90px;
        margin-bottom: 10px;
    }
    
    .stem-category-title {
        font-size: 0.85rem;
    }
}

/* Animation for loading */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stem-category-item {
    animation: fadeInUp 0.6s ease-out;
}

.stem-category-item:nth-child(1) { animation-delay: 0.1s; }
.stem-category-item:nth-child(2) { animation-delay: 0.2s; }
.stem-category-item:nth-child(3) { animation-delay: 0.3s; }
.stem-category-item:nth-child(4) { animation-delay: 0.4s; }
.stem-category-item:nth-child(5) { animation-delay: 0.5s; }
.stem-category-item:nth-child(6) { animation-delay: 0.6s; }

/* Accessibility */
.stem-category-link:focus {
    outline: 3px solid var(--stem-primary);
    outline-offset: 2px;
}

.stem-category-item:focus-within {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .stem-category-image {
       
    }
    
    .stem-category-item:hover .stem-category-title {
        color: #90cdf4;
    }
}