/* Category Display Fixes */

/* Fix category image aspect ratio and size */
.list-9-col li .box-category .image {
    height: 120px; /* Increased height for better aspect ratio */
    line-height: 120px;
    margin-bottom: 8px;
    overflow: hidden;
    border-radius: 4px;
    background-color: #f8f9fa;
}

.list-9-col li .box-category .image img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Maintain aspect ratio while filling container */
    object-position: center;
    vertical-align: middle;
    border-radius: 4px;
}

/* Fix text overflow and spacing */
.list-9-col li .box-category .text-info {
    padding: 5px;
    min-height: 50px; /* Ensure consistent height */
}

.list-9-col li .box-category .text-info a {
    line-height: 16px;
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
    text-decoration: none;
    /* Text truncation */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.list-9-col li .box-category .text-info a:hover {
    color: #ef7b1a;
    text-decoration: none;
}

.list-9-col li .box-category .text-info p {
    font-size: 11px;
    color: #666;
    margin: 0;
    line-height: 14px;
}

/* Improve category card styling */
.list-9-col li .box-category {
    border-radius: 8px;
    border: 1px solid #e0e6ed;
    padding: 8px;
    transition: all 0.3s ease;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.list-9-col li .box-category:hover {
    border: 1px solid #ef7b1a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 123, 26, 0.15);
}

/* Responsive adjustments */
@media (max-width: 1199.98px) {
    .list-9-col li {
        width: 16.66%; /* 6 columns on large tablets */
    }
}

@media (max-width: 991.98px) {
    .list-9-col li {
        width: 20%; /* 5 columns on tablets */
    }
    
    .list-9-col li .box-category .image {
        height: 100px;
        line-height: 100px;
    }
    
    .list-9-col li .box-category .text-info a {
        font-size: 11px;
        line-height: 14px;
    }
}

@media (max-width: 767.98px) {
    .list-9-col li {
        width: 25%; /* 4 columns on mobile */
        margin-bottom: 15px;
    }
    
    .list-9-col li .box-category .image {
        height: 80px;
        line-height: 80px;
    }
    
    .list-9-col li .box-category .text-info a {
        font-size: 10px;
        line-height: 12px;
    }
    
    .list-9-col li .box-category .text-info p {
        font-size: 9px;
    }
}

@media (max-width: 575.98px) {
    .list-9-col li {
        width: 33.33%; /* 3 columns on small mobile */
    }
}

@media (max-width: 349.98px) {
    .list-9-col li {
        width: 50%; /* 2 columns on very small screens */
    }
}

/* Add loading animation for images */
.list-9-col li .box-category .image img {
    transition: opacity 0.3s ease;
}

.list-9-col li .box-category .image img:not([src]),
.list-9-col li .box-category .image img[src=""] {
    opacity: 0;
}

/* Ensure consistent spacing */
.list-9-col {
    margin-left: -8px;
    margin-right: -8px;
}

.list-9-col li {
    padding: 0 8px;
}

/* Add subtle animation */
.list-9-col li {
    animation: fadeInUp 0.6s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.list-9-col li:nth-child(1) { animation-delay: 0.1s; }
.list-9-col li:nth-child(2) { animation-delay: 0.2s; }
.list-9-col li:nth-child(3) { animation-delay: 0.3s; }
.list-9-col li:nth-child(4) { animation-delay: 0.4s; }
.list-9-col li:nth-child(5) { animation-delay: 0.5s; }
.list-9-col li:nth-child(6) { animation-delay: 0.6s; }
.list-9-col li:nth-child(7) { animation-delay: 0.7s; }
.list-9-col li:nth-child(8) { animation-delay: 0.8s; }
.list-9-col li:nth-child(9) { animation-delay: 0.9s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
