/* Single Product Category Badge */
.single-product-category {
    display: inline-flex;
    flex-direction: column;
    gap: 8px;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 4px;
    font-size: 14px;
}

.category-badge::before {
    content: '|';
    color: #A9988420;
}

.category-badge-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-badge-icon svg {
    width: 16px;
    height: 16px;
}

.category-badge-name {
    font-weight: 600;
}

.category-badge-count {
    font-size: 12px;
    color: #666;
    font-weight: normal;
    margin-left: 4px;
}

.category-badge-link {
    display: inline-block;
    padding: 6px 12px;
    background: #007cba;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-align: center;
}

.category-badge-link:hover {
    background: #005a87;
    color: white;
    text-decoration: none;
}

/* Ensure it displays properly after product title */
.woocommerce-product-details__summary .single-product-category {
    display: inline-flex;
    margin: 8px 0;
}

/* Product Categories Grid - Compact Version */
.product-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.category-card {
    position: relative;
    background: white;
    border: 1px solid #A9988420;
    border-radius: 6px;
    padding: 8px;
    border-left: 3px solid #2196F3;
    transition: all 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #A9988440;
}

/* Hide current category when on its page */
.category-term.current-category {
    display: none !important;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 5px;
    position: relative;
}

.category-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.category-icon-svg {
    width: 20px;
    height: 20px;
}

.category-name {
    font-weight: 600;
    font-size: 16px;
    color: #333;
    line-height: 1.3;
    margin: 0;
    flex: 1;
    min-width: 0;
}

.category-count {
    font-size: 14px;
    color: #666;
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
    background: #f5f5f5;
    padding: 4px 8px;
    border-radius: 4px;
}

.category-description {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
    margin-bottom: 0;
}

/* Subtle arrow indicator */
.category-header::after {
    display: none; /* Hide arrow on all devices */
}

/* Empty state when all categories are hidden */
.product-categories-grid:empty {
    display: flex;
    min-height: 120px;
}

.product-categories-grid:empty::before {
    content: "No other categories available";
    display: block;
    text-align: center;
    padding: 20px;
    color: #888;
    font-style: italic;
    background: #f9f9f9;
    border-radius: 6px;
    border: 1px dashed #ddd;
    width: 100%;
}

/* ========== MOBILE FIXES ========== */
/* Tablet */
@media (max-width: 1024px) {
    .product-categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 14px;
    }
}

/* Small Tablet & Large Mobile */
@media (max-width: 768px) {
    .product-categories-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 12px;
    }
    
    .category-card {
        padding: 14px;
    }
    
    .category-header {
        gap: 10px;
        margin-bottom: 0px;
    }
    
    .category-name {
        font-size: 15px;
    }
    
    .category-count {
        font-size: 13px;
        padding: 3px 6px;
    }
    
    .category-description {
        font-size: 13px;
        line-height: 1.4;
    }
}

/* Mobile */
@media (max-width: 640px) {
    .product-categories-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .category-card {
        padding: 16px;
    }
    
    .category-header {
        display: grid;
        grid-template-columns: auto 1fr auto;
        grid-template-areas: 
            "icon name count"
            "icon name count";
        gap: 10px;
        align-items: center;
        margin-bottom: 0px;
    }
    
    .category-icon {
        grid-area: icon;
        width: 36px;
        height: 36px;
    }
    
    .category-icon-svg {
        width: 24px;
        height: 24px;
    }
    
    .category-name {
        grid-area: name;
        font-size: 16px;
        line-height: 1.2;
        white-space: normal;
        word-break: break-word;
        padding-right: 10px;
    }
    
    .category-count {
        grid-area: count;
        font-size: 13px;
        text-align: center;
        padding: 4px 8px;
        white-space: nowrap;
    }
    
    .category-description {
        font-size: 14px;
        line-height: 1.5;
        margin-top: 8px;
        padding-top: 12px;
        border-top: 1px solid #f0f0f0;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    .category-card {
        padding: 14px;
    }
    
    .category-header {
        gap: 8px;
    }
    
    .category-icon {
        width: 32px;
        height: 32px;
    }
    
    .category-icon-svg {
        width: 20px;
        height: 20px;
    }
    
    .category-name {
        font-size: 15px;
    }
    
    .category-count {
        font-size: 12px;
        padding: 3px 6px;
    }
    
    .category-description {
        font-size: 13px;
        padding-top: 10px;
        margin-top: 6px;
    }
}

/* Extra Small Mobile */
@media (max-width: 320px) {
    .category-card {
        padding: 12px;
    }
    
    .category-header {
        grid-template-columns: auto 1fr;
        grid-template-areas: 
            "icon name"
            "icon count";
        gap: 8px 12px;
    }
    
    .category-count {
        justify-self: start;
        margin-left: 0;
        grid-column: 2;
    }
    
    .category-description {
        font-size: 12px;
        line-height: 1.4;
    }
}