@import url('https://fonts.googleapis.com/css2?family=Almarai:wght@400;700;800&display=swap');

:root {
    --primary: #B01D23;
    --primary-dark: #631719;
    --primary-light: #d22329;
    --secondary: #2B0128;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1f2937;
    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50: #f9fafb;
    --white: #ffffff;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --transition: all 0.3s ease;
}


* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    direction: rtl;
    font-family: 'Almarai', sans-serif, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif ;

}


::selection {
    background: var(--primary);
    /* لون الخلفية عند التحديد */
    color: var(--white);
    /* لون النص */
}

body {
    line-height: 1.6;
    color: var(--gray-700);
    background-color: var(--gray-50);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: var(--transition);
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-secondary:hover {
    background: var(--primary-dark);
}

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

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

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

.btn-danger:hover {
    background: #dc2626;
}

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

.btn-success:hover {
    background: var(--primary-dark);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.navbar {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    direction: ltr;
    gap: 15px;
}

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo i {
    font-size: 28px;
}

.search-bar {
    flex: 1;
    max-width: 400px;
    margin: 0 30px;
}

.search-bar form {
    display: flex;
    background: var(--gray-100);
    border-radius: 50px;
    overflow: hidden;
}

.search-bar input {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
}

.search-bar button {
    padding: 10px 16px;
    background: var(--primary);
    color: var(--white);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.search-bar button:hover {
    background: var(--primary-dark);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 25px;
}

.nav-links a {
    font-weight: 500;
    color: var(--gray-700);
    transition: var(--transition);
}

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

.dropdown {
    position: relative;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 1000;
}

.dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-content a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover {
    background: var(--gray-50);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-700);
}

main {
    flex: 1;
}

.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 60px 0;
    text-align: center;
}

.hero h1 {
    font-size: 42px;
    margin-bottom: 16px;
}

.hero p {
    font-size: 18px;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 30px;
}

.hero .btn {
    background: var(--white);
    color: var(--primary);
    padding: 14px 32px;
    font-size: 16px;
}

.hero .btn:hover {
    background: var(--gray-100);
}

.section {
    padding: 60px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 40px;
}

.section-header h2 {
    font-size: 32px;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.section-header p {
    color: var(--gray-500);
    font-size: 16px;
}

.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

.course-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.course-card-image {
    height: 180px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 48px;
}

.course-card-content {
    padding: 20px;
}

.course-card-content h3 {
    font-size: 18px;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.course-card-content p {
    color: var(--gray-500);
    font-size: 14px;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.course-card-footer {
    display: flex;
    gap: 10px;
}

.course-card-footer .btn {
    flex: 1;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border-radius: var(--radius);
    background: var(--white);
    color: var(--gray-700);
    font-weight: 500;
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--gray-100);
}

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

.auth-container {
    max-width: 450px;
    margin: 60px auto;
    padding: 0 20px;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--gray-900);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.alert {
    padding: 14px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.course-detail {
    padding: 40px 0;
}

.course-detail-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 40px 0;
    margin-bottom: 40px;
}

.course-detail-header h1 {
    font-size: 36px;
    margin-bottom: 16px;
}

.course-detail-header p {
    font-size: 18px;
    opacity: 0.9;
    max-width: 700px;
}

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

.course-info-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 100px;
}

.course-info-card h3 {
    margin-bottom: 20px;
    color: var(--gray-900);
}

.course-meta {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.course-meta-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--gray-600);
}

.course-meta-item i {
    width: 20px;
    color: var(--primary);
}

.course-sidebar {
    margin-bottom: 30px;
}

.learning-container {
    display: flex;
    min-height: calc(100vh - 70px);
}

.learning-sidebar {
    width: 300px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    overflow-y: auto;
    min-height: calc(100vh - 70px);
    position: sticky;
    top: 70px;
}

.learning-sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.learning-sidebar-header h3 {
    font-size: 18px;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.learning-sidebar-header a {
    font-size: 14px;
    color: var(--primary);
}

.unit-section {
    border-bottom: 1px solid var(--gray-200);
}

.unit-header {
    padding: 16px 20px;
    background: var(--gray-50);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.unit-header h4 {
    font-size: 15px;
    color: var(--gray-900);
}

.unit-header .badge {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    background: var(--secondary);
    color: var(--white);
}

.unit-header.locked {
    opacity: 0.6;
}

.unit-header.locked .badge {
    background: var(--gray-500);
}

.lesson-list {
    display: none;
}

.lesson-list.active {
    display: block;
}

.lesson-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--gray-100);
    transition: var(--transition);
}

.lesson-item:hover {
    background: var(--gray-50);
}

.lesson-item a {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--gray-700);
}

.lesson-item.completed a {
    color: var(--secondary);
}

.lesson-item.current a {
    color: var(--primary);
    font-weight: 600;
}

.lesson-item.locked {
    opacity: 0.5;
}

.lesson-item i {
    width: 20px;
}

.quiz-item {
    padding: 12px 20px;
    background: var(--gray-50);
    display: flex;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--gray-200);
}

.quiz-item a {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--primary);
    font-weight: 500;
}

.quiz-item.passed {
    background: #d1fae5;
}

.quiz-item.passed a {
    color: var(--secondary);
}

.quiz-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.learning-main {
    flex: 1;
    padding: 40px;
    background: var(--gray-50);
}

.video-container {
    max-width: 1000px;
    margin: 0 auto;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    background: var(--gray-900);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.lesson-content {
    margin-top: 30px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

.lesson-content h1 {
    font-size: 28px;
    color: var(--gray-900);
    margin-bottom: 16px;
}

.lesson-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

.quiz-container {
    max-width: 700px;
    margin: 0 auto;
    background: var(--white);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
}

.quiz-header {
    text-align: center;
    margin-bottom: 30px;
}

.quiz-header h2 {
    font-size: 24px;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.quiz-header p {
    color: var(--gray-500);
}

.quiz-progress {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--gray-200);
}

.quiz-progress-text {
    font-size: 14px;
    color: var(--gray-600);
    white-space: nowrap;
}

.question-card {
    margin-bottom: 24px;
}

.question-card h3 {
    font-size: 16px;
    color: var(--gray-900);
    margin-bottom: 16px;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.option:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.option.selected {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
}

.option input {
    display: none;
}

.option .radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-400);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.option.selected .radio {
    border-color: var(--primary);
    background: var(--primary);
}

.option.selected .radio::after {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--white);
    border-radius: 50%;
}

.quiz-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

.quiz-result {
    text-align: center;
    padding: 40px;
}

.quiz-result-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.quiz-result-icon.success {
    color: var(--secondary);
}

.quiz-result-icon.fail {
    color: var(--danger);
}

.quiz-result h2 {
    font-size: 28px;
    margin-bottom: 12px;
}

.quiz-result p {
    color: var(--gray-500);
    margin-bottom: 24px;
}

.quiz-result .score {
    font-size: 48px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 24px;
}

.certificate {
    max-width: 800px;
    margin: 40px auto;
    background: var(--white);
    border: 20px solid var(--primary);
    border-radius: var(--radius);
    padding: 60px;
    text-align: center;
    position: relative;
}

.certificate::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    border: 2px solid var(--primary-light);
    pointer-events: none;
}

.certificate-header {
    margin-bottom: 40px;
}

.certificate-header i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 16px;
}

.certificate-header h1 {
    font-size: 36px;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 4px;
}

.certificate-body h2 {
    font-size: 24px;
    color: var(--gray-900);
    margin-bottom: 16px;
}

.certificate-body .user-name {
    font-size: 32px;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 16px;
}

.certificate-body .course-name {
    font-size: 20px;
    color: var(--gray-700);
    margin-bottom: 30px;
}

.certificate-footer {
    display: flex;
    justify-content: space-around;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--gray-200);
}

.certificate-footer-item {
    text-align: center;
}

.certificate-footer-item label {
    display: block;
    font-size: 12px;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.certificate-footer-item span {
    font-size: 14px;
    color: var(--gray-900);
    font-weight: 600;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 30px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 32px;
}

.profile-info h2 {
    font-size: 24px;
    color: var(--gray-900);
}

.profile-info p {
    color: var(--gray-500);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-card i {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 12px;
}

.stat-card h3 {
    font-size: 28px;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.stat-card p {
    color: var(--gray-500);
}

.footer {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 40px 0 20px;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 30px;
}

.footer-section h3,
.footer-section h4 {
    color: var(--white);
    margin-bottom: 16px;
}

.footer-section ul li {
    margin-bottom: 8px;
}

.footer-section ul li i {
    margin-right: 8px;
    color: var(--primary-light);
}

.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--gray-700);
    font-size: 14px;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.modal-content h3 {
    margin-bottom: 12px;
}

.modal-content p {
    color: var(--gray-500);
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.final-exam-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 30px;
    border-radius: var(--radius);
    margin-top: 30px;
    text-align: center;
}

.final-exam-section h3 {
    color: var(--white);
    font-size: 24px;
    margin-bottom: 12px;
}

.final-exam-section.locked {
    background: linear-gradient(135deg, var(--gray-500) 0%, var(--gray-600) 100%);
}

.final-exam-section .btn {
    margin-top: 16px;
}

.certificate-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--secondary);
    color: var(--white);
    padding: 12px 24px;
    border-radius: var(--radius);
    font-weight: 600;
    margin-top: 16px;
    transition: var(--transition);
    justify-content: center;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--gray-300);
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 24px;
    color: var(--gray-700);
    margin-bottom: 12px;
}

.empty-state p {
    color: var(--gray-500);
    margin-bottom: 24px;
}

@media (max-width: 768px) {
    .navbar .container {
        flex-wrap: wrap;
    }

    /* بعد الإصلاح ✅ */
    .search-bar {
        flex: none;
        order: 3;
        max-width: 100%;
        margin: 15px 0 0;
        width: 100%;
        /* ← بدل display: none */
    }

    .search-bar.active {
        display: block;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        flex-direction: column;
        padding: 20px;
        box-shadow: var(--shadow-lg);
    }

    .nav-links.active {
        display: flex;
    }

    .mobile-menu-btn {
        display: block;
    }

    .hero h1 {
        font-size: 28px;
    }

    .hero p {
        font-size: 16px;
    }

    .courses-grid {
        grid-template-columns: 1fr;
    }

    .course-detail-content {
        grid-template-columns: 1fr;
    }

    .learning-container {
        flex-direction: column-reverse;
    }

    .learning-sidebar {
        width: 100%;
        max-height: none;
        min-height: auto;
        position: relative;
        top: 0;
    }

    .learning-main {
        padding: 20px;
    }

    .auth-card {
        padding: 24px;
    }

    .certificate {
        padding: 30px;
        border-width: 10px;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }
}

/*  */
img.logo-image {
    width: 32px;
    height: 32px;
}
span.name {
    color: #d22329;
}