:root {
    --primary-color: #4e73df;
    --primary-dark: #2e59d9;
    --secondary-color: #1cc88a;
    --dark-color: #5a5c69;
    --light-color: #f8f9fc;
    --border-color: #e3e6f0;
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--light-color);
    color: #333;
    line-height: 1.6;
    padding-top: 70px; /* Fixed header offset */
    overflow-x: hidden;
    position: relative;
}

/* Header Styles */
.site-header {
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    height: 70px;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5%;
    max-width: 1400px;
    margin: 0 auto;
    height: 100%;
}

.logo {
    display: flex;
    align-items: center;
    height: 100%;
}

.logo img {
    height: 40px;
    transition: transform 0.2s;
}

.logo img:hover {
    transform: scale(1.05);
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark-color);
    cursor: pointer;
    padding: 5px;
}

/* Button Styles */
.btn {
    padding: 0.6rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-block;
    border: none;
    min-height: 42px;
    margin-top:10px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
}

/* Main Container */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 5%;
}

/* Course Grid */
.course-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 30px;
}

/* Course Card */
.course-card {
    background-color: white;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.course-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow-hover);
}

.course-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
}

.course-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.course-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--dark-color);
    line-height: 1.4;
}

.course-instructor {
    display: flex;
    align-items: center;
    color: #666;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.course-instructor i {
    margin-right: 8px;
    color: var(--primary-color);
}

.instructor-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    object-fit: cover;
    border: 1px solid #e0e0e0;
}

.instructor-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.instructor-link:hover {
    color: var(--primary-color);
    text-decoration: none;
}

.course-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
    font-size: 0.9rem;
    color: #666;
}

.course-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--secondary-color);
    margin-bottom: 15px;
}

.course-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 20px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.view-course-btn {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    margin-top: auto;
}

.view-course-btn:hover {
    background-color: var(--primary-dark);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
}

/* Section Title */
.section-title {
    text-align: center;
    margin-bottom: 2rem;
}

.section-title h2 {
    font-size: 2.2rem;
    color: var(--dark-color);
    position: relative;
    display: inline-block;
}

.section-title h2::after {
    content: '';
    position: absolute;
    width: 70px;
    height: 3px;
    background-color: var(--secondary-color);
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
}

/* Course Detail/View Page */
.course-container {
    max-width: 1200px;
    margin: 20px auto 40px;
    padding: 20px;
}

.course-header {
    display: flex;
    flex-wrap: wrap;
    background-color: white;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    padding: 30px;
    margin-bottom: 30px;
}

.course-thumbnail {
    width: 300px;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 30px;
}

.course-info {
    flex: 1;
    min-width: 300px;
}

.course-content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
}

.main-content, .sidebar {
    background-color: white;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    padding: 30px;
}

.sidebar {
    height: fit-content;
}

.section-title-alt {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

/* Lesson Item */
.lesson-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #eee;
    background-color: #f8f9fc;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background-color 0.2s;
}

.lesson-item:hover {
    background-color: #eef1f8;
}

.lesson-item:last-child {
    border-bottom: none;
}

.lesson-left {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.lesson-icon {
    min-width: 24px;
    margin-right: 15px;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.lesson-title {
    font-weight: 500;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-duration {
    min-width: 100px;
    text-align: right;
    color: #666;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
}

.locked-lesson {
    color: #999;
    background-color: #f2f2f2;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.stat-item {
    text-align: center;
    padding: 20px;
    background-color: #f8f9fc;
    border-radius: 8px;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: #666;
    margin-top: 5px;
}

/* Courses Page Specific */
.search-filter-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 30px;
}

.search-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.search-container {
    flex: 1;
    min-width: 300px;
    display: flex;
    position: relative;
}

.search-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid var(--border-color);
    border-radius: 10px 0 0 10px;
    font-size: 16px;
    border-right: none;
    transition: all 0.3s;
}

.search-btn {
    padding: 0 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 10px 10px 0;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
}

.results-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
    padding: 0 5px;
}

/* Messages/Alerts */
.messages {
    margin-bottom: 20px;
}

.alert {
    padding: 10px 15px;
    border-radius: 5px;
    position: relative;
    margin-bottom: 10px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger, .alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
}

.clear-filters{
    color:#000;
    background-color:#95baf5;
    padding:8px;
    border-radius:10px;
}

/* Legal Links */
.legal-links {
    text-align: center;
    padding: 2rem 1rem;
    margin-top: 2rem;
    color: #888;
    font-size: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

.legal-links a {
    color: var(--dark-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.legal-links a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.copyright {
    display: block;
    width: 100%;
    margin-top: 1rem;
    text-align: center;
}

/* Back to top button */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 99;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background-color: var(--primary-dark);
    transform: translateY(-5px);
}

/* Loading Spinner - Make hidden by default */
.loading-spinner {
    text-align: center;
    padding: 30px;
    display: none; /* This ensures it's hidden by default */
    margin: 0 auto;
    width: 100%;
}

.spinner {
    border: 4px solid rgba(78, 115, 223, 0.1);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

/* Empty state improvements */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    background-color: white;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
    margin: 30px auto;
    max-width: 600px;
}

.empty-state i {
    font-size: 3rem;
    color: #d1d5db;
    margin-bottom: 15px;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--dark-color);
    margin-bottom: 10px;
}

.empty-state p {
    color: #6c757d;
    margin-bottom: 20px;
}

.empty-state .btn {
    margin-top: 10px;
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Mobile Responsiveness */
@media (max-width: 992px) {
    .course-content-grid {
        grid-template-columns: 1.5fr 1fr;
    }
    .course-header {
        padding: 20px;
    }
    .main-content, .sidebar {
        padding: 20px;
    }
}

@media (max-width: 900px) {
    .course-content-grid {
        grid-template-columns: 1fr;
    }
    .sidebar {
        margin-top: 30px;
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }
    
    .nav-links {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 20px;
        box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
        transform: translateY(-100%);
        opacity: 0;
        transition: all 0.3s ease;
        z-index: -1;
        width: 100%;
    }
    
    .nav-links.active {
        transform: translateY(0);
        opacity: 1;
        z-index: 999;
    }
    
    .btn {
        width: 100%;
        text-align: center;
        padding: 12px;
    }
    
    .course-header {
        flex-direction: column;
        padding: 15px;
    }
    
    .course-thumbnail {
        width: 100%;
        height: 180px;
        margin-right: 0;
        margin-bottom: 15px;
    }
    
    .course-title {
        font-size: 1.5rem;
    }
    
    .course-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .lesson-duration {
        margin-left: 10px;
        text-align: right;
        justify-content: flex-end;
        width: auto;
        min-width: 80px;
        white-space: nowrap;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .legal-links {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .search-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }

    .search-filter-section {
        padding: 15px;
    }
    
    .search-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-container {
        width: 100%;
        max-width: none;
    }
    
    .search-input {
        width: 100%;
        border-radius: 5px 0 0 5px;
    }

    .sort-container {
        width: 100%;
        display: flex;
        align-items: center;
    }
    
    .sort-container label {
        margin-right: 10px;
        min-width: 60px;
    }
    
    .sort-select {
        flex: 1;
    }
}

@media (max-width: 576px) {
    .course-grid {
        grid-template-columns: 1fr;
    }
    
    .section-title h2 {
        font-size: 1.6rem;
    }
    
    .navbar {
        padding: 0.6rem 15px;
    }
    
    .course-container {
        padding: 15px;
    }
    
    .main-content, .sidebar {
        padding: 15px;
    }
    
    .lesson-icon {
        font-size: 1rem;
    }
    
    .lesson-title {
        font-size: 0.95rem;
    }
    
    .lesson-duration {
        font-size: 0.8rem;
        min-width: 70px;
    }
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.course-card {
    animation: fadeIn 0.5s ease forwards;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}