/* ==========================================================================
   MG Education & Social Development Organization
   Premium Udemy-Style Courses Component CSS
   ========================================================================== */

/* Main Section Wrapper */
.courses-section {
    padding: 60px 0;
    background-color: #ffffff;
    font-family: 'Inter', sans-serif;
    color: #1c1d1f;
}

.courses-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Headers */
.courses-header {
    margin-bottom: 24px;
}

.courses-header h2 {
    font-size: 28px;
    font-weight: 700;
    color: #1c1d1f;
    margin: 0 0 10px 0;
    letter-spacing: -0.5px;
}

.courses-header p {
    font-size: 16px;
    color: #6a6f73;
    margin: 0;
}

/* Category Filter Tabs */
.courses-filter-wrapper {
    margin-bottom: 28px;
    border-bottom: 1px solid #d1d7dc;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar for Chrome, Safari and Opera */
.courses-filter-wrapper::-webkit-scrollbar {
    display: none;
}

/* Hide scrollbar for IE, Edge and Firefox */
.courses-filter-wrapper {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.courses-filter-tabs {
    display: flex;
    gap: 24px;
    list-style: none;
    padding: 0;
    margin: 0;
    white-space: nowrap;
}

.filter-tab {
    background: none;
    border: none;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #6a6f73;
    padding: 12px 4px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    outline: none;
}

.filter-tab:hover {
    color: #1c1d1f;
}

.filter-tab.active {
    color: #1c1d1f;
}

.filter-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #1c1d1f;
    border-radius: 2px;
}

/* Slider Grid Wrapper */
.courses-grid-container {
    position: relative;
    width: 100%;
    margin-bottom: 30px;
}

/* Courses Grid Layout (Desktop Slider) */
.courses-grid {
    display: flex;
    overflow-x: auto;
    scroll-behavior: smooth;
    gap: 20px;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
    -ms-overflow-style: none;  /* Hide scrollbar for IE and Edge */
    padding: 4px; /* Leave space for hover border highlights and card shadows */
}

.courses-grid::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome, Safari, Opera */
}

/* Slider Navigation Buttons */
.courses-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #ffffff;
    border: 1px solid #d1d7dc;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    color: #1c1d1f;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.courses-nav-btn:hover {
    background-color: #f7f9fa;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
    border-color: #8c9096;
    transform: translateY(-50%) scale(1.05);
}

.courses-nav-btn:active {
    transform: translateY(-50%) scale(0.95);
}

.courses-nav-btn.prev-btn {
    left: -22px; /* Hang slightly off the left edge */
}

.courses-nav-btn.next-btn {
    right: -22px; /* Hang slightly off the right edge */
}

.courses-nav-btn:disabled {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}

/* Course Card Item with SOLID BORDERS */
.course-card {
    flex: 0 0 calc(25% - 15px); /* Exactly 4 cards visible on desktop */
    min-width: 260px;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: #1c1d1f;
    background-color: #ffffff;
    border: 1px solid #d1d7dc; /* Clean solid border around card */
    border-radius: 8px; /* Rounded corners */
    padding: 14px; /* Internal padding matching the screenshot */
    box-sizing: border-box;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.course-card.hidden {
    display: none !important;
}

/* Card Image Box */
.course-image-box {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 4px;
    margin-bottom: 12px;
    position: relative;
    background-color: #f7f9fa;
}

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

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    border-color: #8c9096; /* Highlight border on hover */
}

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

/* Card Body Details */
.course-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.course-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    color: #1c1d1f;
    margin: 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    min-height: 38px;
}

.course-card:hover .course-title {
    color: #0056b3;
}

.course-instructor {
    font-size: 12px;
    color: #6a6f73;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Ratings */
.course-ratings {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    margin-top: 2px;
}

.rating-score {
    font-size: 13px;
    font-weight: 700;
    color: #b4690e;
}

.rating-stars {
    display: flex;
    color: #e59819;
    gap: 1px;
}

.rating-stars i {
    font-size: 11px;
}

.rating-count {
    color: #6a6f73;
}

/* Badges */
.course-badge-container {
    margin-top: 2px;
}

.badge-bestseller {
    background-color: #ecebff;
    color: #2d2f31;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 2px;
    display: inline-block;
}

/* Pricing */
.course-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 15px;
}

.price-current {
    font-weight: 700;
    color: #1c1d1f;
}

.price-original {
    text-decoration: line-through;
    color: #6a6f73;
    font-size: 12px;
}

/* Show All courses Footer Link */
.courses-show-all {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #4f46e5;
    font-weight: 700;
    text-decoration: none;
    font-size: 15px;
    transition: gap 0.2s ease;
    margin-top: 15px;
}

.courses-show-all:hover {
    gap: 12px;
    text-decoration: underline;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */

@media (max-width: 1024px) {
    .course-card {
        flex: 0 0 calc(33.333% - 14px); /* 3 cards visible on small desktop/tablet */
    }
}

@media (max-width: 768px) {
    .courses-section {
        padding: 40px 0;
    }
    
    .courses-header h2 {
        font-size: 22px;
        margin-bottom: 6px;
    }

    .courses-header p {
        font-size: 14px;
    }

    /* Hide absolute slider navigation arrows on mobile */
    .courses-nav-btn {
        display: none !important;
    }

    /* Core User Requirement: High-density 2x2 grid layout properly on mobile */
    .courses-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        overflow-x: visible !important;
        padding: 0 !important;
    }

    .course-card {
        flex: none !important;
        min-width: 0 !important;
        padding: 10px !important; /* Slightly smaller padding on mobile to save vertical space */
        border-radius: 8px !important;
    }

    .course-image-box {
        margin-bottom: 8px !important;
    }

    .course-title {
        font-size: 13.5px;
        min-height: 32px;
    }

    .course-instructor {
        font-size: 11px;
    }

    .course-ratings {
        font-size: 11px;
        flex-wrap: wrap;
        gap: 2px;
    }

    .rating-score {
        font-size: 11.5px;
    }

    .course-price {
        font-size: 13.5px;
        gap: 6px;
    }

    .price-original {
        font-size: 11px;
    }
}
