/* ==========================================================================
   CODEORBITZ SECTION 6: POPULAR COURSES
   ========================================================================== */

.popular-section {
    padding-top: 40px;
    padding-bottom: 70px;
}

.popular-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 24px;
}

.popular-main-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(34px, 4vw, 44px);
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.5px;
    margin: 0;
    color: #111827;
}

.view-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    transition: color 0.2s ease;
}

.view-all:hover {
    color: #5da8ef;
}

/* ── Filter Tabs ── */
.popular-filter-tabs {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.popular-filter-tabs .tab-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 999px;
    background: #ffffff;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.25s ease;
}

.popular-filter-tabs .tab-btn i {
    font-size: 14px;
    line-height: 1;
}

.popular-filter-tabs .tab-btn .tab-icon-img {
    width: 16px;
    height: 16px;
    object-fit: contain;
    display: inline-block;
}

.popular-filter-tabs .tab-btn:hover {
    border-color: #5da8ef;
    color: #5da8ef;
}

.popular-filter-tabs .tab-btn.active {
    background: #5da8ef;
    color: #ffffff;
    border-color: #5da8ef;
    box-shadow: 0 4px 14px rgba(93, 168, 239, 0.32);
}

/* ── Panes & Cards Grid ── */
.popular-panes-wrap {
    width: 100%;
}

.popular-tab-pane {
    width: 100%;
    animation: fadeInTab 0.3s ease;
}

@keyframes fadeInTab {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.popular-cards-grid {
    margin-top: 0;
}

/* ── Course Card ── */
.popular-card {
    width: 100%;
    height: 100%;
    background: #ffffff;
    border: 1px solid #eef0f3;
    border-radius: 24px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    overflow: hidden;
}

.popular-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
}

/* Card Image */
.popular-image {
    width: 100%;
    height: 185px;
    border-radius: 16px;
    overflow: hidden;
    background: #f1f5f9;
    position: relative;
}

.popular-image a {
    display: block;
    width: 100%;
    height: 100%;
}

.popular-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.popular-card:hover .popular-image img {
    transform: scale(1.03);
}

/* Card Info Body */
.popular-info {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    padding-top: 14px;
}

/* Category Badge Row */
.popular-instructor {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}

.instructor-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.instructor-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.instructor-name {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.popular-category-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: capitalize;
}

/* Course Title */
.popular-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    color: #0f172a;
    margin: 0 0 12px;
    min-height: 44px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.popular-title a {
    color: #0f172a;
    text-decoration: none;
    transition: color 0.2s ease;
}

.popular-title a:hover {
    color: #0284c7;
}

/* Meta: Duration & Lessons */
.course-meta {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 14px;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.course-meta .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.course-meta .meta-item i {
    font-size: 13px;
    color: #0284c7;
}

/* Bottom Footer Pill */
.popular-footer {
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: auto;
}

.price-wrap {
    display: flex;
    align-items: baseline;
    gap: 6px;
    min-width: 0;
}

.price-current {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
}

.price-original {
    font-size: 12px;
    color: #94a3b8;
    text-decoration: line-through;
    white-space: nowrap;
}

.rating-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.rating-value {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
}

.rating-stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.star-gold {
    color: #f59e0b;
    font-size: 11px;
}

.star-muted {
    color: #cbd5e1;
    font-size: 11px;
}

.reviews-count {
    font-size: 11px;
    color: #94a3b8;
}

/* ── Card Theme Column Accents (Matches Figma) ── */
.card-theme-1 .popular-category-badge {
    background: #e0f2fe;
    color: #0284c7;
}
.card-theme-1 .popular-footer {
    background: #eef6fc;
}

.card-theme-2 .popular-category-badge {
    background: #f3e8ff;
    color: #9333ea;
}
.card-theme-2 .popular-footer {
    background: #f3effe;
}

.card-theme-3 .popular-category-badge {
    background: #ffedd5;
    color: #ea580c;
}
.card-theme-3 .popular-footer {
    background: #fff1e5;
}

.card-theme-4 .popular-category-badge {
    background: #dcfce7;
    color: #16a34a;
}
.card-theme-4 .popular-footer {
    background: #eefaf2;
}

/* ── Responsive ── */
@media (max-width: 991px) {
    .popular-section {
        padding-top: 30px;
        padding-bottom: 50px;
    }
    .popular-image {
        height: 160px;
    }
}

@media (max-width: 767px) {
    .popular-cards-grid {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        padding-bottom: 12px;
        -webkit-overflow-scrolling: touch;
    }
    .popular-cards-grid > [class*="col-"] {
        flex: 0 0 82% !important;
        max-width: 82% !important;
        scroll-snap-align: start;
    }
}
