:root {
    --bg-main: #060913;
    --bg-card: rgba(13, 20, 38, 0.6);
    --bg-glow: rgba(139, 92, 246, 0.15);
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.4);
    --cyan: #06b6d4;
    --cyan-glow: rgba(6, 182, 212, 0.4);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border-color: rgba(255, 255, 255, 0.08);
    --green-badge: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Background Grids & Glows */
.bg-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -2;
    pointer-events: none;
}

.bg-glow {
    position: absolute;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--bg-glow) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

header .logo {
    font-size: 2.8rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 15px;
    letter-spacing: -1px;
}

header .logo i {
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary-glow));
}

.gradient-text {
    background: linear-gradient(135deg, var(--cyan) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header .tagline {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-top: 10px;
    font-weight: 300;
}

/* Glassmorphism Card styling */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Search Section */
.search-section {
    padding: 30px;
    margin-bottom: 40px;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 5px 15px;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.search-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow);
}

.search-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-right: 15px;
}

#search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 1.1rem;
    padding: 12px 0;
    font-family: inherit;
}

#search-input::placeholder {
    color: var(--text-muted);
}

/* AI Mode Toggle Button */
#ai-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

#ai-toggle-btn.ai-active {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border-color: var(--cyan);
    color: var(--cyan);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

#ai-toggle-btn.ai-active i {
    animation: pulse 1.5s infinite alternate;
}

/* Search Action Button */
.search-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 25px;
}

.btn {
    padding: 12px 28px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--cyan) 0%, var(--primary) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

/* Filters */
.filters-container {
    display: flex;
    gap: 20px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-group select {
    background: #0f172a;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 8px;
    outline: none;
    font-family: inherit;
    cursor: pointer;
    min-width: 140px;
}

/* Popular Tags */
.popular-tags {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.tags-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.tags-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tag-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

/* Stats Bar */
.stats-bar {
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

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

/* Loading and Empty State */
.loading-state, .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.loading-state i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 15px;
}

/* Course Card */
.course-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.course-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: 0 12px 30px rgba(139, 92, 246, 0.2);
}

.card-img-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #1e293b;
}

.card-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--cyan);
}

.card-lang {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-main);
}

.card-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 3.2em;
}

.card-description {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 4.5em;
    font-weight: 300;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.card-price-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.price-old {
    text-decoration: line-through;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.badge-free {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid var(--green-badge);
    color: var(--green-badge);
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.card-actions {
    margin-top: 15px;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
    text-decoration: none;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 40px;
}

.page-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
}

.page-btn:hover, .page-btn.active {
    border-color: var(--primary);
    color: #fff;
    background: var(--primary);
    box-shadow: 0 4px 10px var(--primary-glow);
}

.page-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
    cursor: not-allowed;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 60px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Keyframes */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    100% {
        transform: scale(1.08);
    }
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .filters-container {
        flex-direction: column;
        gap: 15px;
    }
    .filter-group select {
        width: 100%;
    }
    header .logo {
        font-size: 2.2rem;
    }
}
