/* Popular Categories Modern Styling */

/* Section Background */
.bg-gradient-light {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    position: relative;
    overflow: hidden;
}

.bg-gradient-light::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"><g fill="none" fill-rule="evenodd"><g fill="%23f1f5f9" fill-opacity="0.3"><circle cx="30" cy="30" r="1.5"/></g></svg>') repeat;
    opacity: 0.5;
}

/* Modern Category Card */
.category-card-modern {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    height: 100%;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.category-card-modern:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

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

/* Image Wrapper */
.category-image-wrapper {
    position: relative;
    height: 220px;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
    background: #ed5233;
}

.category-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.category-card-modern:hover .category-image {
    transform: scale(1.05);
}

/* Modern Icon Styling */
.category-icon-modern {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ed5233;
    color: white;
    font-size: 60px;
    position: relative;
}

.category-icon-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
}

.category-icon-modern i {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

/* Overlay Effects */
.category-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-card-modern:hover .category-overlay {
    opacity: 1;
}

.category-overlay-content {
    text-align: center;
    color: white;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.category-card-modern:hover .category-overlay-content {
    transform: translateY(0);
}

.category-arrow {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
    animation: bounceRight 2s infinite;
}

.category-text {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Category Info */
.category-info {
    padding: 20px;
    text-align: center;
    position: relative;
}

.category-name {
    font-size: 18px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 10px;
    transition: color 0.3s ease;
    line-height: 1.3;
}

.category-parent {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 8px;
    margin-top: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-card-modern:hover .category-name {
    color: #667eea;
}

/* Animated Underline */
.category-underline {
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
    width: 0;
    margin: 0 auto;
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.category-card-modern:hover .category-underline {
    width: 60px;
}

/* Responsive Adjustments */
@media (max-width: 1199px) {
    .category-image-wrapper {
        height: 200px;
    }

    .category-icon-modern {
        font-size: 50px;
    }
}

@media (max-width: 991px) {
    .category-image-wrapper {
        height: 180px;
    }

    .category-icon-modern {
        font-size: 45px;
    }

    .category-name {
        font-size: 16px;
    }
}

@media (max-width: 767px) and (min-width: 576px) {
    .category-card-modern {
        margin-bottom: 15px;
    }

    .category-image-wrapper {
        height: 160px;
    }

    .category-icon-modern {
        font-size: 40px;
    }

    .category-info {
        padding: 14px 16px;
    }

    .category-name {
        font-size: 15px;
        margin-bottom: 6px;
        line-height: 1.3;
    }

    .category-text {
        font-size: 12px;
    }

    .category-arrow {
        font-size: 18px;
        margin-bottom: 4px;
    }
}

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
    .category-card-modern {
        margin-bottom: 12px;
    }

    .category-image-wrapper {
        height: 120px;
    }

    .category-icon-modern {
        font-size: 35px;
    }

    .category-info {
        padding: 10px 12px;
    }

    .category-name {
        font-size: 13px;
        margin-bottom: 4px;
        line-height: 1.1;
    }

    .category-parent {
        font-size: 11px;
        color: #64748b;
        margin-bottom: 2px;
        margin-top: 2px;
    }

    .category-text {
        font-size: 11px;
    }

    .category-arrow {
        font-size: 16px;
        margin-bottom: 3px;
    }

    /* Reduce section spacing */
    .sect-title {
        margin-bottom: 2rem !important;
    }

    .flat-spacing-2 {
        padding: 2rem 0 !important;
    }

    /* Mobile grid adjustments */
    .row.g-4 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }

    /* Ensure 2 columns on all mobile sizes */
    .col-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
}

/* Very Small Mobile Devices - Ultra compact view */
@media (max-width: 360px) {
    .category-image-wrapper {
        height: 100px;
    }

    .category-info {
        padding: 8px 10px;
    }

    .category-name {
        font-size: 12px;
        margin-bottom: 2px;
        line-height: 1.2;
    }

    .category-parent {
        font-size: 10px;
        margin-bottom: 1px;
        margin-top: 1px;
    }

    .category-text {
        font-size: 10px;
    }

    .row.g-4 {
        --bs-gutter-x: 0.5rem;
        --bs-gutter-y: 0.5rem;
    }

    /* Title adjustments for very small screens */
    .sect-title .s-title {
        font-size: 24px !important;
    }

    .sect-title .sub-title {
        font-size: 14px !important;
    }
}

/* Animations */
@keyframes bounceRight {
    0%, 20%, 50%, 80%, 100% {
        transform: translateX(0);
    }
    40% {
        transform: translateX(5px);
    }
    60% {
        transform: translateX(3px);
    }
}

/* Gradient Animation for Icons */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.category-icon-modern {
    background: linear-gradient(-45deg, #667eea, #764ba2, #667eea, #764ba2);
    background-size: 400% 400%;
    animation: gradientShift 8s ease infinite;
}

/* Section Title Enhancements */
.sect-title .s-title {
    color: #1a202c;
    position: relative;
}

.sect-title .s-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
}

.sect-title .sub-title {
    font-size: 16px;
    margin-top: 15px;
    color: #64748b;
}

/* Stagger Animation Delays */
.col-xl-3:nth-child(1) { animation-delay: 0s; }
.col-xl-3:nth-child(2) { animation-delay: 0.1s; }
.col-xl-3:nth-child(3) { animation-delay: 0.2s; }
.col-xl-3:nth-child(4) { animation-delay: 0.3s; }
.col-xl-3:nth-child(5) { animation-delay: 0.4s; }
.col-xl-3:nth-child(6) { animation-delay: 0.5s; }
.col-xl-3:nth-child(7) { animation-delay: 0.6s; }
.col-xl-3:nth-child(8) { animation-delay: 0.7s; }

/* Loading State */
.category-image.lazyload:not(.lazyloaded) {
    background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
    position: relative;
}

.category-image.lazyload:not(.lazyloaded)::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* View All Categories Button */
.btn-view-all-categories {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #ed5233;
    color: white;
    text-decoration: none;
    border-radius: 25px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-view-all-categories:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

.btn-view-all-categories i {
    transition: transform 0.3s ease;
}

.btn-view-all-categories:hover i {
    transform: translateX(3px);
}

/* Section title adjustments when button is present */
.sect-title .d-flex .mx-auto {
    text-align: center;
}

/* Mobile responsive for view all button */
@media (max-width: 767px) {
    .btn-view-all-categories {
        position: static;
        margin-top: 15px;
    }

    .sect-title .d-flex {
        flex-direction: column;
        align-items: center;
    }
}
