/* --- Global Resets & Design System Variables --- */
:root {
    --primary-orange: #ea580c;
    --primary-orange-light: #ffedd5;
    --primary-green: #10b981;
    --primary-green-light: #d1fae5;
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --border-color: #e2e8f0;
    --bg-body: #ffffff;
    --bg-card: #ffffff;
    
    --font-family: 'Vazirmatn', system-ui, -apple-system, sans-serif;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* --- Header Section (Gradient Background) --- */
.page-header {
    background: linear-gradient(135deg, #fff1e6 0%, #f8fafc 50%, #e6f7ec 100%);
    padding: 60px 20px;
    text-align: center;
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
}

.header-badge {
    display: inline-block;
    background-color: var(--primary-orange-light);
    color: var(--primary-orange);
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.page-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text-main);
}

.text-orange {
    color: var(--primary-orange);
}

.header-desc {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* --- Main Layout Container --- */
.main-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* --- Search & Filters --- */
.filters-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 40px;
}

.search-sort-bar {
    display: flex;
    gap: 16px;
    align-items: center;
}

/* Styling for the Sort Dropdown */
.sort-select {
    padding: 12px 20px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 12px;
    background-color: white;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    outline: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: all 0.2s ease;
}

.sort-select:hover, .sort-select:focus {
    border-color: var(--orange-primary, #f97316);
    box-shadow: 0 4px 10px rgba(249, 115, 22, 0.1);
}

.search-box {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-box input {
    width: 100%;
    padding: 14px 20px 14px 50px; /* Space for icon */
    border: 1px solid var(--border-color);
    border-radius: 30px;
    font-size: 0.95rem;
    color: var(--text-main);
    outline: none;
    background-color: #fff;
    box-shadow: var(--shadow-sm);
}

.search-box input:focus {
    border-color: var(--primary-orange);
}

.btn-search {
    position: absolute;
    left: 16px;
    background: none;
    border: none;
    color: var(--text-light);
}

.btn-sort {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--border-color);
    padding: 14px 20px;
    border-radius: 30px;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.btn-sort:hover {
    background-color: #f8fafc;
}

/* Filter Tags (Pills) */
.filter-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.tag {
    background: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Orange Theme Tags */
.tags-orange .tag {
    border: 1px solid var(--primary-orange-light);
    color: var(--primary-orange);
}

.tags-orange .tag:hover,
.tags-orange .tag.active {
    background-color: var(--primary-orange);
    color: #fff;
    border-color: var(--primary-orange);
}

/* Green Theme Tags */
.tags-green .tag {
    border: 1px solid var(--primary-green-light);
    color: var(--primary-green);
}

.tags-green .tag:hover,
.tags-green .tag.active {
    background-color: var(--primary-green);
    color: #fff;
    border-color: var(--primary-green);
}

/* Courses Page Warning Alert Box */
.courses-warning-box {
    background-color: #fffbeb; /* Light warm amber */
    border-right: 4px solid #f59e0b; /* Amber accent bar on the right side for RTL */
    padding: 16px;
    border-radius: 8px;
    margin: 25px 0 15px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.courses-warning-box .warning-icon {
    color: #d97706;
    flex-shrink: 0;
}

.courses-warning-box .warning-text {
    color: #b45309; /* High-contrast readable dark amber */
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.6;
    margin: 0;
}

/* --- Results Header --- */
.results-header {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 24px;
    padding-right: 8px;
}

.results-header strong {
    color: var(--primary-orange);
    font-weight: 700;
}

/* --- Course Grid --- */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
}

/* --- Course Card Layout --- */
.course-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.course-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* Card Image Area */
.card-image {
    position: relative;
    height: 180px;
    width: 100%;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge {
    position: absolute;
    top: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.badge-top-right {
    right: 12px;
    background-color: var(--primary-orange);
    color: white;
}

.badge-top-left {
    left: 12px;
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--text-main);
}

/* Card Body Area */
.card-body {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-meta-top {
    display: flex;
    justify-content: flex-start;
    gap: 30px;
    align-items: center;
    margin-bottom: 12px;
}

.tag-level {
    background-color: var(--primary-green-light);
    color: var(--primary-green);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
}

.tag-partner {
    font-size: 0.75rem;
    color: var(--primary-orange);
    font-weight: 700;
    background: var(--primary-orange-light);
    padding: 4px 10px;
    border-radius: 20px;
}

.course-title {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.5;
    margin-bottom: 8px;
    color: var(--text-main);
}

.instructor {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.course-desc {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 16px;
    flex-grow: 1; /* Pushes footer down */
}

/* Ratings */
.course-rating {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
    font-size: 0.85rem;
}

.stars {
    color: #fbbf24; /* Golden yellow for stars */
    letter-spacing: -2px;
}

.score {
    font-weight: 700;
    color: var(--primary-orange);
}

.reviews {
    color: var(--text-light);
}

/* Specs (Time, Sessions, Location) */
.course-specs {
    display: flex;
    justify-content: flex-start;
    gap: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.spec-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.spec-item svg {
    color: var(--text-light);
}

/* Card Footer (Price & CTA) */
.card-footer {
    padding: 16px 20px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #fafaf9;
}

.price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-orange);
}

.btn-enroll {
    background-color: var(--primary-green);
    color: white;
    border: none;
    padding: 0px 24px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
}

.btn-enroll:hover {
    background-color: #059669;
}

/* --- Pagination Elements --- */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 50px;
}

.page-link {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary-green);
    border: 1px solid var(--primary-green-light);
    background: white;
}

.page-link.active {
    background-color: var(--primary-orange);
    color: white;
    border-color: var(--primary-orange);
}

.page-link:not(.active):hover {
    background-color: var(--primary-green-light);
}

.page-dots {
    color: var(--primary-green);
    font-weight: 800;
    letter-spacing: 2px;
}

/* --- Responsive Media Queries --- */
@media (max-width: 1024px) {
    .courses-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .search-sort-bar {
        flex-direction: column-reverse;
    }
    .search-box {
        width: 100%;
    }
    .btn-sort {
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 640px) {
    .courses-warning-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 14px;
    }
    .courses-grid {
        grid-template-columns: 1fr;
    }
    .page-header h1 {
        font-size: 1.8rem;
    }
    .course-specs {
        flex-wrap: wrap;
        gap: 12px;
    }
}