/*
 * WalchandPRO — Enterprise Learning Platform
 * Course Discovery Section Styles
 * Design matches reference image exactly
 *
 * Copyright © 2025 Euclideum Solutions Private Limited.
 */

/* ============================================
   Course Discovery Section Base
   Padding matches navbar for consistency
   ============================================ */
.courses-section {
    padding: 48px 12px 48px;
    background-color: #f8fafc;
}

[data-theme="dark"] .courses-section {
    background-color: #0c1222;
}

@media (min-width: 480px) {
    .courses-section {
        padding: 48px 16px 48px;
    }
}

@media (min-width: 768px) {
    .courses-section {
        padding: 64px 24px 64px;
    }
}

@media (min-width: 1024px) {
    .courses-section {
        padding: 80px 24px 80px;
    }
}

@media (min-width: 1400px) {
    .courses-section {
        padding: 80px 32px 80px;
    }
}

.courses-container {
    max-width: 100%;
    margin: 0 auto;
}

@media (min-width: 1400px) {
    .courses-container {
        max-width: 1336px;
    }
}

/* ============================================
   Section Header - Title & Search inline
   ============================================ */
.courses-header {
    margin-bottom: 32px;
}

@media (min-width: 768px) {
    .courses-header {
        margin-bottom: 40px;
    }
}

.courses-header-top {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

@media (min-width: 768px) {
    .courses-header-top {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 32px;
        margin-bottom: 28px;
    }
}

.courses-heading {
    font-size: 26px;
    font-weight: 600;
    line-height: 1.2;
    color: #1e293b;
    letter-spacing: -0.01em;
    margin: 0;
    flex-shrink: 0;
}

[data-theme="dark"] .courses-heading {
    color: #f1f5f9;
}

@media (min-width: 480px) {
    .courses-heading {
        font-size: 32px;
    }
}

@media (min-width: 768px) {
    .courses-heading {
        font-size: 36px;
    }
}

@media (min-width: 1024px) {
    .courses-heading {
        font-size: 40px;
    }
}

/* ============================================
   Search Bar - Compact inline style
   ============================================ */
.courses-search {
    width: 100%;
}

@media (min-width: 768px) {
    .courses-search {
        max-width: 360px;
    }
}

@media (min-width: 1024px) {
    .courses-search {
        max-width: 400px;
    }
}

.courses-search-input-wrapper {
    position: relative;
    width: 100%;
}

.courses-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #94a3b8;
    pointer-events: none;
}

.courses-search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    font-size: 14px;
    font-family: inherit;
    color: #0f172a;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    outline: none;
    transition: all 0.2s ease;
}

.courses-search-input::placeholder {
    color: #94a3b8;
}

.courses-search-input:focus {
    border-color: #154f95;
    box-shadow: 0 0 0 3px rgba(21, 79, 149, 0.08);
}

[data-theme="dark"] .courses-search-input {
    color: #f1f5f9;
    background-color: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .courses-search-input::placeholder {
    color: #64748b;
}

[data-theme="dark"] .courses-search-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

/* ============================================
   Category Filter - Clean minimal design
   ============================================ */
.courses-categories {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
}

.courses-categories-track {
    position: relative;
    flex: 1;
    overflow: hidden;
    mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 3%,
        black 97%,
        transparent 100%
    );
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0%,
        black 3%,
        black 97%,
        transparent 100%
    );
}

.courses-categories-list {
    display: flex;
    gap: 8px;
    padding: 4px 8px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.courses-categories-list::-webkit-scrollbar {
    display: none;
}

.courses-category-pill {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: #475569;
    background-color: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.courses-category-pill:hover {
    color: #0f172a;
    background-color: #f1f5f9;
}

.courses-category-pill.is-active {
    color: #154f95;
    background-color: #e0f2fe;
    font-weight: 600;
}

.courses-category-pill.is-active:hover {
    background-color: #bae6fd;
}

[data-theme="dark"] .courses-category-pill {
    color: #94a3b8;
}

[data-theme="dark"] .courses-category-pill:hover {
    color: #f1f5f9;
    background-color: #1e293b;
}

[data-theme="dark"] .courses-category-pill.is-active {
    color: #60a5fa;
    background-color: rgba(96, 165, 250, 0.15);
}

[data-theme="dark"] .courses-category-pill.is-active:hover {
    background-color: rgba(96, 165, 250, 0.25);
}

/* Category Arrow Buttons - Minimal icons only */
.courses-categories-arrow {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
}

.courses-categories-arrow:hover {
    color: #0f172a;
    background-color: #f1f5f9;
}

.courses-categories-arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.courses-categories-arrow:disabled:hover {
    background: none;
    color: #64748b;
}

.courses-categories-arrow svg {
    width: 20px;
    height: 20px;
}

[data-theme="dark"] .courses-categories-arrow {
    color: #94a3b8;
}

[data-theme="dark"] .courses-categories-arrow:hover {
    color: #f1f5f9;
    background-color: #1e293b;
}

[data-theme="dark"] .courses-categories-arrow:disabled:hover {
    background: none;
    color: #94a3b8;
}

/* ============================================
   Course Cards Grid - 4 columns on desktop
   ============================================ */
.courses-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 640px) {
    .courses-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
}

@media (min-width: 900px) {
    .courses-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1200px) {
    .courses-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   Course Card - With border and hover animation
   ============================================ */
.course-card {
    display: flex;
    flex-direction: column;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    text-decoration: none;
    transition: border-radius 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.course-card:hover {
    border-radius: 20px;
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .course-card {
    background-color: #111a2e;
    border-color: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .course-card:hover {
    border-color: #334155;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Course Image Container */
.course-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 11px 11px 0 0;
    overflow: hidden;
    background-color: #1e293b;
    transition: border-radius 0.25s ease;
}

.course-card:hover .course-card-image {
    border-radius: 19px 19px 0 0;
}

[data-theme="dark"] .course-card-image {
    background-color: #1e293b;
}

.course-card-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* Category Badge - Positioned right */
.course-card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: #ffffff;
    background-color: #1e3a4c;
    border-radius: 6px;
    text-transform: capitalize;
}

[data-theme="dark"] .course-card-badge {
    background-color: #334155;
}

/* Course Card Content */
.course-card-content {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: #ffffff;
    border-radius: 0 0 11px 11px;
    transition: border-radius 0.25s ease;
}

.course-card:hover .course-card-content {
    border-radius: 0 0 19px 19px;
}

[data-theme="dark"] .course-card-content {
    background: #111a2e;
}

/* Course Title */
.course-card-title {
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    color: #0f172a;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

[data-theme="dark"] .course-card-title {
    color: #f1f5f9;
}

/* Course Description - 2 lines with ellipsis */
.course-card-description {
    font-size: 14px;
    font-weight: 400;
    line-height: 1.5;
    color: #64748b;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

[data-theme="dark"] .course-card-description {
    color: #94a3b8;
}

/* Instructor + Price Row */
.course-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

/* Instructor */
.course-card-instructor {
    display: flex;
    align-items: center;
    gap: 8px;
}

.course-card-instructor-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #e5e7eb;
    flex-shrink: 0;
}

[data-theme="dark"] .course-card-instructor-avatar {
    background-color: #334155;
    color: #94a3b8;
}

.course-card-instructor-name {
    font-size: 14px;
    font-weight: 400;
    color: #374151;
}

[data-theme="dark"] .course-card-instructor-name {
    color: #94a3b8;
}

/* Price */
.course-card-price {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.course-card-price-amount {
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
}

[data-theme="dark"] .course-card-price-amount {
    color: #f1f5f9;
}

.course-card-price-currency {
    font-size: 12px;
    font-weight: 400;
    color: #6b7280;
    text-transform: uppercase;
}

[data-theme="dark"] .course-card-price-currency {
    color: #94a3b8;
}

.course-card-price-free {
    font-size: 16px;
    font-weight: 600;
    color: #10b981;
}

[data-theme="dark"] .course-card-price-free {
    color: #34d399;
}

/* Rating + Button Row */
.course-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Rating */
.course-card-rating {
    display: flex;
    align-items: center;
    gap: 6px;
}

.course-card-rating-score {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

[data-theme="dark"] .course-card-rating-score {
    color: #d1d5db;
}

.course-card-rating-stars {
    display: flex;
    align-items: center;
    gap: 2px;
    color: #fbbf24;
}

.course-card-rating-stars svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Start Course Button - Matches Hero Primary Button */
.course-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background-color: #154f95;
    border: 1px solid #154f95;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(21, 79, 149, 0.3);
    transition: all 0.2s ease;
}

.course-card-btn:hover,
.course-card:hover .course-card-btn {
    background-color: #0d3d7a;
    border-color: #0d3d7a;
    box-shadow: 0 4px 6px -1px rgba(21, 79, 149, 0.4);
    transform: translateY(-1px);
}

[data-theme="dark"] .course-card-btn {
    background-color: #60a5fa;
    border-color: #60a5fa;
    color: #0f172a;
    box-shadow: 0 1px 3px rgba(96, 165, 250, 0.3);
}

[data-theme="dark"] .course-card-btn:hover,
[data-theme="dark"] .course-card:hover .course-card-btn {
    background-color: #3b82f6;
    border-color: #3b82f6;
    box-shadow: 0 4px 6px -1px rgba(96, 165, 250, 0.4);
}

/* ============================================
   Empty State
   ============================================ */
.courses-empty {
    text-align: center;
    padding: 48px 24px;
}

.courses-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: #94a3b8;
}

.courses-empty-title {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 8px;
}

[data-theme="dark"] .courses-empty-title {
    color: #f1f5f9;
}

.courses-empty-text {
    font-size: 14px;
    color: #64748b;
}

[data-theme="dark"] .courses-empty-text {
    color: #94a3b8;
}

/* ============================================
   No Results State (for search)
   ============================================ */
.courses-no-results {
    display: none;
    text-align: center;
    padding: 48px 24px;
}

.courses-no-results.is-visible {
    display: block;
}

.courses-no-results-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: #94a3b8;
}

.courses-no-results-title {
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 8px;
}

[data-theme="dark"] .courses-no-results-title {
    color: #f1f5f9;
}

.courses-no-results-text {
    font-size: 14px;
    color: #64748b;
}

[data-theme="dark"] .courses-no-results-text {
    color: #94a3b8;
}

/* Hide cards when no results */
.courses-grid.has-no-results .course-card {
    display: none;
}

.courses-grid.has-no-results .course-card.is-match {
    display: flex;
}
