/* WooCommerce Category Grid Styles */

/* Container */
.woo-category-grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
    margin: 0 auto;
}

/* Category Card */
.category-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    cursor: pointer;
    box-shadow: 4px 4px 24px 0 rgba(0,0,0,.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.category-card a {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
}

/* Hover Effects */
.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Thumbnail */
.category-thumbnail {
    width: 50px!important;
    height: 50px!important;
    border-radius: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0px!important;
    background: #f5f5f5;
    flex-shrink: 0;
}

.category-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.category-card:hover .category-thumbnail img {
    transform: scale(1.1);
}

/* Thumbnail Placeholder */
.thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    background: #f0f0f0;
}

.thumbnail-placeholder svg {
    width: 40px;
    height: 40px;
}

/* Content */
.category-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Category Name */
.category-name {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 0px 0!important;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.category-card:hover .category-name {
    color: #d26e4b;
}

/* Price */
.category-price {
    font-size: 14px;
    color: #666;
    margin: 0;
    line-height: 1.4;
}

.price-label {
    color: #666;
    margin-right: 4px;
}

.price-value {
    font-weight: 600;
    color: #d26e4b;
}

.price-value .woocommerce-Price-amount {
    color: inherit;
}

.price-value .woocommerce-Price-currencySymbol {
    font-weight: 600;
}

/* Responsive Design */

/* Tablet - 768px to 1024px */
@media (max-width: 1024px) {
    .woo-category-grid-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    
    .category-card {
        padding: 16px;
    }
    
    .category-thumbnail {
        width: 50px;
        height: 50px;
        margin-bottom: 12px;
    }
    
    .thumbnail-placeholder svg {
        width: 32px;
        height: 32px;
    }
    
    .category-name {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .category-price {
        font-size: 13px;
    }
}

/* Mobile - Below 768px */
@media (max-width: 767px) {
    .woo-category-grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .category-card {
        padding: 12px;
    }
    
    .category-thumbnail {
        width: 36px!important;
        height: 36px!important;
        margin-bottom: 10px;
    }
    
    .thumbnail-placeholder svg {
        width: 28px;
        height: 28px;
    }
    
    .category-name {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .category-price {
        font-size: 12px;
    }
    
    .category-card:hover {
        transform: translateY(-2px);
    }
}

/* Small Mobile - Below 480px */
@media (max-width: 480px) {
    .woo-category-grid-container {
        grid-template-columns: repeat(1, 1fr);
        gap: 10px;
    }
    
    .category-card {
        padding: 15px;
        flex-direction: row;
        text-align: left;
        align-items: center;
    }
    
    .category-card a {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .category-thumbnail {
        width: 50px;
        height: 50px;
        margin-bottom: 0;
        margin-right: 12px;
        flex-shrink: 0;
    }
    
    .category-content {
        align-items: flex-start;
        text-align: left;
        flex: 1;
    }
    
    .category-name {
        font-size: 15px;
    }
}

/* Loading State */
.category-card.loading {
    opacity: 0.6;
    pointer-events: none;
}

.category-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: #d26e4b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Accessibility */
.category-card:focus,
.category-card:focus-visible {
    outline: 2px solid #d26e4b;
    outline-offset: 2px;
}

.category-card a:focus {
    outline: none;
}

/* Reduced Motion 
@media (prefers-reduced-motion: reduce) {
    .category-card,
    .category-thumbnail img,
    .category-name {
        transition: none;
    }
    
    .category-card:hover {
        transform: none;
    }
    
    .category-card:hover .category-thumbnail img {
        transform: none;
    }
    
    .category-card.loading::after {
        animation: none;
    }
}
*/
/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    .category-card {
        background: #2a2a2a;
        box-shadow: 4px 4px 24px 0 rgba(0,0,0,.08);
    }
    
    .category-card:hover {
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    }
    
    .category-name {
        color: #f5f5f5;
    }
    
    .price-label {
        color: #b0b0b0;
    }
    
    .thumbnail-placeholder {
        background: #3a3a3a;
        color: #666;
    }
}

/* Print Styles */
@media print {
    .woo-category-grid-container {
        display: block;
    }
    
    .category-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
        margin-bottom: 20px;
    }
    
    .category-card:hover {
        transform: none;
        box-shadow: none;
    }
}

/* RTL Support */
[dir="rtl"] .category-thumbnail {
    margin-left: 12px;
    margin-right: 0;
}

[dir="rtl"] .price-label {
    margin-left: 4px;
    margin-right: 0;
}

/* Custom Grid Columns Support */
.woo-category-grid-container[data-columns="1"] {
    grid-template-columns: repeat(1, 1fr);
}

.woo-category-grid-container[data-columns="2"] {
    grid-template-columns: repeat(2, 1fr);
}

.woo-category-grid-container[data-columns="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.woo-category-grid-container[data-columns="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.woo-category-grid-container[data-columns="5"] {
    grid-template-columns: repeat(5, 1fr);
}

.woo-category-grid-container[data-columns="6"] {
    grid-template-columns: repeat(6, 1fr);
}

/* Empty State */
.woo-category-grid-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.woo-category-grid-empty svg {
    width: 60px;
    height: 60px;
    margin-bottom: 15px;
    opacity: 0.5;
}

/* Elementor Editor Specific */
.elementor-editor-active .category-card {
    pointer-events: none;
}

/* Fix WooCommerce Price Styling */
.category-price .woocommerce-Price-amount {
    font-weight: inherit;
}

.category-price ins {
    text-decoration: none;
    font-weight: 600;
}

.category-price del {
    opacity: 0.6;
    margin-right: 5px;
}

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

.category-card.fade-in {
    animation: fadeInUp 0.5s ease forwards;
}*/

/* Stagger animation for multiple cards */
.category-card:nth-child(1) { animation-delay: 0.1s; }
.category-card:nth-child(2) { animation-delay: 0.2s; }
.category-card:nth-child(3) { animation-delay: 0.3s; }
.category-card:nth-child(4) { animation-delay: 0.4s; }
.category-card:nth-child(5) { animation-delay: 0.5s; }
.category-card:nth-child(6) { animation-delay: 0.6s; }

/* High contrast mode support */
@media (prefers-contrast: high) {
    .category-card {
        border: 2px solid currentColor;
    }
    
    .category-card:hover {
        border-color: #d26e4b;
    }
}