/**
 * Courses Listing Styles
 */

/* Wrapper */
.courses-listing-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Filters */
/* Search Input Wrapper */
.search-input-wrapper {
    position: relative;
}

.search-input-wrapper input[type="text"] {
    width: 100%;
    padding-right: 40px; /* Make space for the clear button */
}

.clear-search {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    transition: color 0.3s ease;
    font-size: 20px;
    line-height: 1;
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.clear-search:hover {
    color: #333;
    background: #f0f0f0;
}

.clear-search:focus {
    outline: none;
    color: #333;
}

.clear-search span {
    display: block;
    line-height: 1;
}

.courses-filters {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    align-items: end;
}

.filter-item {
    display: flex;
    flex-direction: column;
}

.filter-item label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
}

.filter-item input[type="text"],
.filter-item select {
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.filter-item input[type="text"]:focus,
.filter-item select:focus {
    outline: none;
    border-color: #0073aa;
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-apply {
    background: #0073aa;
    color: #fff;
}

.btn-apply:hover {
    background: #005a87;
}

.btn-reset {
    background: #666;
    color: #fff;
}

.btn-reset:hover {
    background: #444;
}

/* Loading Spinner */
.courses-loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Courses Grid */
.courses-grid {
    margin-bottom: 40px;
}

.courses-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 30px;
}

/* Course Card */
.course-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.course-thumbnail {
    overflow: hidden;
    height: 200px;
}

.course-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.course-card:hover .course-thumbnail img {
    transform: scale(1.05);
}

.course-content {
    padding: 20px;
}

.course-topics {
    margin-bottom: 10px;
}

.topic-badge {
    display: inline-block;
    background: #0073aa;
    color: #fff;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 12px;
    margin-right: 5px;
    margin-bottom: 5px;
}

.course-title {
    margin: 0 0 10px 0;
    font-size: 20px;
    line-height: 1.4;
}

.course-title a {
    color: #333;
    text-decoration: none;
    transition: color 0.3s ease;
}

.course-title a:hover {
    color: #0073aa;
}

.course-excerpt {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
}

.course-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px 0;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

.course-cost,
.course-credits {
    font-size: 14px;
    color: #333;
}

.course-cost strong,
.course-credits strong {
    color: #0073aa;
}

.course-free strong {
    color: #28a745;
}

.course-link {
    display: inline-block;
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s ease;
}

.course-link:hover {
    background: #005a87;
}

/* No Courses Found */
.no-courses-found {
    text-align: center;
    padding: 60px 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.no-courses-found p {
    font-size: 18px;
    color: #666;
    margin: 0;
}

/* Pagination */
.courses-pagination {
    text-align: center;
    padding: 20px 0;
}

.courses-pagination .page-numbers {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 5px;
    background: #f8f9fa;
    color: #333;
    text-decoration: none;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.courses-pagination .page-numbers:hover {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

.courses-pagination .page-numbers.current {
    background: #0073aa;
    color: #fff;
    border-color: #0073aa;
}

/* Responsive Design */
@media (max-width: 992px) {
    .courses-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .filter-form {
        grid-template-columns: 1fr;
    }
    
    .filter-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .filter-actions .btn {
        width: 100%;
    }
    
    .courses-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 576px) {
    .course-meta {
        flex-direction: column;
        gap: 10px;
    }
}