/* Popular Courses Section */
.popular-courses {
    padding: 6rem 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #f1f3f5 100%);
    position: relative;
    overflow: hidden;
}

.popular-courses .section-header {
    text-align: center;
    margin-bottom: 3.5rem;
    position: relative;
    z-index: 1;
}

.popular-courses .section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.popular-courses .section-title::after {
    content: '';
    position: absolute;
    width: 60px;
    height: 4px;
    background: var(--primary-color);
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 2px;
}

.popular-courses .section-subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 700px;
    margin: 0 auto;
    line-height: 1.7;
}

.courses-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.course-card {
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.course-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
    border-color: rgba(var(--primary-color), 0.2);
}

.course-card:hover .course-image img {
    transform: scale(1.08);
    opacity: 0.95;
}

.course-image {
    position: relative;
    overflow: hidden;
    height: 200px;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px 12px 0 0;
    padding: 1.5rem;
}

.course-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 0.5s ease, opacity 0.3s ease;
    max-width: 100%;
    max-height: 100%;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

.course-card:hover .course-image img {
    transform: scale(1.05);
}

.course-content {
    padding: 1.8rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: white;
    z-index: 2;
    border-radius: 0 0 12px 12px;
}

.course-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark-color);
    margin-bottom: 0.8rem;
    line-height: 1.4;
}

.course-description {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    flex-grow: 1;
    line-height: 1.6;
}

.course-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 2rem;
    background: var(--primary-color);
    color: white;
    border-radius: 50px;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid transparent;
    margin-top: 1.2rem;
    width: 100%;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.course-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: width 0.3s ease;
    z-index: -1;
}

.course-btn:hover::before {
    width: 100%;
}

.course-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(var(--primary-color), 0.3);
}

/* Add a subtle pattern overlay to the section background */
.popular-courses::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px);
    background-size: 20px 20px;
    pointer-events: none;
    z-index: 0;
}

/* Add a decorative element */
.popular-courses .section-header::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    margin: 1.5rem auto 0;
    border-radius: 2px;
}

/* Responsive Styles */
@media (max-width: 1199px) {
    .courses-container {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 2rem;
        padding: 0 1rem;
    }
    
    .course-card {
        max-width: 100%;
    }
}

@media (max-width: 991px) {
    .popular-courses {
        padding: 5rem 0;
    }
    
    .courses-container {
        max-width: 700px;
        margin: 0 auto;
    }
}

@media (max-width: 767px) {
    .popular-courses {
        padding: 4rem 0;
    }
    
    .popular-courses .section-title {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    .popular-courses .section-subtitle {
        font-size: 1rem;
        line-height: 1.6;
        padding: 0 1rem;
    }
    
    .courses-container {
        grid-template-columns: 1fr;
        max-width: 420px;
        margin: 2rem auto 0;
        padding: 0 1.5rem;
        gap: 1.8rem;
    }
    
    .course-card {
        max-width: 100%;
        margin: 0 auto;
    }
    
    .course-btn {
        padding: 0.9rem 2rem;
        font-size: 1rem;
    }
}

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

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.course-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
    will-change: transform, box-shadow;
}

.course-card:nth-child(1) { 
    animation-delay: 0.1s;
}
.course-card:nth-child(2) { 
    animation-delay: 0.3s;
}
.course-card:nth-child(3) { 
    animation-delay: 0.5s;
}

/* Add a subtle floating animation on hover */
.course-card:hover {
    animation: float 3s ease-in-out infinite;
}

/* Add a subtle gradient overlay to images */
.course-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 70%, rgba(255,255,255,0.8) 100%);
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.course-card:hover .course-image::after {
    opacity: 0.8;
}
