/* Global Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Container */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: var(--text-base);
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid transparent;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 8px -1px rgba(99, 102, 241, 0.5);
}

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

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

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

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: var(--text-sm);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: var(--text-lg);
}

.text-danger {
    color: var(--danger-color) !important;
}

/* Navbar */
.navbar {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    z-index: 1000;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.navbar.scrolled {
    box-shadow: var(--shadow-sm);
    height: 70px;
}

.navbar .container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-color);
}

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

.nav-links a {
    font-weight: 500;
    color: var(--text-secondary);
    position: relative;
    padding-bottom: 0.25rem;
}

.nav-links a.active,
.nav-links a:hover {
    color: var(--primary-color);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: var(--transition);
}

.nav-links a.active::after,
.nav-links a:hover::after {
    width: 100%;
    left: 0;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.search-box {
    position: relative;
    display: none;
    /* Hidden on small screens initially */
}

@media (min-width: 992px) {
    .search-box {
        display: block;
    }
}

.search-box input {
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    /* RTL padding */
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    width: 200px;
    transition: var(--transition);
}

.search-box input:focus {
    width: 300px;
    border-color: var(--primary-color);
    outline: none;
    background-color: white;
}

.search-box i {
    position: absolute;
    right: 1rem;
    /* RTL */
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: var(--text-primary);
}

.user-btn img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

.dropdown {
    position: absolute;
    top: 120%;
    left: 0;
    /* RTL left alignment for dropdown usually needs adjusting */
    background: white;
    width: 220px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.dropdown a:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-primary);
    cursor: pointer;
}

@media (max-width: 991px) {
    .mobile-toggle {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 2rem;
        gap: 1.5rem;
        border-bottom: 1px solid var(--border-color);
        transform: translateY(-150%);
        transition: var(--transition);
        z-index: 999;
    }

    .nav-links.active {
        transform: translateY(0);
        box-shadow: var(--shadow-lg);
    }

    .search-box {
        display: none;
    }

    .user-btn span,
    .user-btn i {
        display: none;
    }
}

/* Main Content */
main {
    padding-top: var(--header-height);
    flex: 1;
    width: 100%;
}

/* Footer */
.footer {
    background-color: #1e293b;
    /* Slate 800 */
    color: white;
    padding-top: 4rem;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 991px) {
    .footer-content {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 576px) {
    .footer-content {
        grid-template-columns: 1fr;
    }
}

.footer-col h3 {
    color: white;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.footer-col p {
    color: var(--text-light);
}

.footer-col ul li {
    margin-bottom: 0.8rem;
}

.footer-col ul li a {
    color: var(--text-light);
}

.footer-col ul li a:hover {
    color: var(--primary-color);
    padding-right: 5px;
    /* RTL */
}

.social-links {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.social-links a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: var(--transition);
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-3px);
}

.contact-info li {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-light);
}

.footer-bottom {
    padding: 1.5rem 0;
    text-align: center;
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* Utilities */
.section {
    padding: 5rem 0;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.section-title h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-center {
    text-align: center;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

/* Price Styles */
.price-container {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Cairo', sans-serif;
}

.current-price {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--primary-color);
}

.old-price {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 0.9rem;
    font-weight: 600;
}

.discount-badge {
    background: #FEF2F2;
    color: #DC2626;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 700;
    border: 1px solid #FECACA;
}

/* ===== Shared Course Card Component ===== */
.course-card {
    background: #fff;
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    border: 1px solid var(--gray-200, #e2e8f0);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}

.course-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(42, 157, 143, 0.1);
    transform: translateY(-4px);
    border-color: rgba(42, 157, 143, 0.2);
}

.course-card-thumb {
    position: relative;
    width: 100%;
    height: 190px;
    overflow: hidden;
    background: var(--gray-100, #f1f5f9);
    display: block;
}

.course-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #f8f9fa;
    object-position: center center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.course-card:hover .course-card-thumb img {
    transform: scale(1.06);
}

.course-card-body {
    padding: 1.15rem 1.25rem 0.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.course-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.course-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.2rem 0.65rem;
    background: rgba(42, 157, 143, 0.08);
    color: var(--primary-color, #2A9D8F);
    border-radius: var(--radius-full, 9999px);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.course-rating {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.78rem;
    color: var(--gray-500, #64748b);
}

.course-rating .stars {
    color: #FBBF24;
    display: flex;
    gap: 1px;
}

.course-rating .stars i {
    font-size: 0.65rem;
}

.course-rating strong {
    color: var(--gray-800, #1e293b);
    font-weight: 700;
    margin-inline-start: 2px;
}

.course-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-900, #0f172a);
    margin-bottom: 0.35rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-card-desc {
    font-size: 0.82rem;
    color: var(--gray-500, #64748b);
    line-height: 1.6;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-instructor {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-top: auto;
    padding-top: 0.7rem;
    border-top: 1px solid var(--gray-100, #f1f5f9);
}

.course-instructor img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gray-100, #f1f5f9);
}

.course-instructor-info {
    flex: 1;
    min-width: 0;
}

.course-instructor-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--gray-800, #1e293b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.course-instructor-role {
    font-size: 0.7rem;
    color: var(--gray-400, #94a3b8);
}

.course-students {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--gray-500, #64748b);
    font-weight: 600;
    white-space: nowrap;
}

.course-students i {
    color: var(--primary-color, #2A9D8F);
    font-size: 0.7rem;
}

.course-card-footer {
    padding: 0.85rem 1.25rem 1.15rem;
    border-top: 1px solid var(--gray-100, #f1f5f9);
    background: var(--gray-50, #f8fafc);
}

.course-card-price {
    font-weight: 800;
    color: var(--primary-color, #2A9D8F);
    font-size: 1.15rem;
    margin-bottom: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.course-card-price .old-price {
    font-size: 0.82rem;
    color: var(--gray-400, #94a3b8);
    text-decoration: line-through;
    font-weight: 500;
}

.course-card-price .free-badge {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-full, 9999px);
    font-size: 0.82rem;
    font-weight: 700;
}

.course-enroll-btn {
    display: block;
    width: 100%;
    padding: 0.6rem;
    background: var(--primary-color, #2A9D8F);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm, 8px);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.01em;
}

.course-enroll-btn:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-primary);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.8s ease forwards;
}

.scale-in {
    animation: fadeIn 0.8s ease forwards;
    /* Similar logic */
}