/* CSS للميزات الجديدة - الدروس والتدريبات والنقاشات */

/* ===== الدروس ===== */
.lessons-sections {
  max-width: 1200px;
  margin: 0 auto;
}

.lesson-section {
  margin-bottom: 50px;
  background: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #f0f0f0;
}

.section-header h2 {
  font-size: 24px;
  font-weight: bold;
  color: #2c3e50;
  margin: 0;
}

.section-duration, .section-info {
  font-size: 14px;
  color: #7f8c8d;
  background: #f8f9fa;
  padding: 6px 12px;
  border-radius: 20px;
}

.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 25px;
}

.lesson-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 2px solid transparent;
}

.lesson-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  border-color: #3498db;
}

.lesson-thumbnail {
  position: relative;
  height: 180px;
  overflow: hidden;
}

.lesson-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder-thumbnail {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(0,0,0,0.8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  transition: all 0.3s ease;
}

.lesson-card:hover .play-overlay {
  background: #3498db;
  transform: translate(-50%, -50%) scale(1.1);
}

.lesson-info {
  padding: 20px;
}

.lesson-info h3 {
  font-size: 18px;
  font-weight: bold;
  color: #2c3e50;
  margin: 0 0 10px 0;
  line-height: 1.4;
}

.lesson-info p {
  font-size: 14px;
  color: #7f8c8d;
  margin: 0 0 15px 0;
  line-height: 1.5;
}

.lesson-meta {
  display: flex;
  gap: 15px;
  font-size: 12px;
  color: #95a5a6;
}

/* ===== التدريبات ===== */
.assignments-sections {
  max-width: 1200px;
  margin: 0 auto;
}

.assignment-section, .my-submissions-section {
  margin-bottom: 50px;
  background: white;
  border-radius: 16px;
  padding: 30px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.assignments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 25px;
}

.assignment-card {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 25px;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
}

.assignment-card:hover {
  border-color: #28a745;
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.1);
}

.assignment-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.assignment-number {
  width: 40px;
  height: 40px;
  background: #28a745;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
  flex-shrink: 0;
}

.assignment-info {
  flex: 1;
}

.assignment-info h3 {
  font-size: 18px;
  font-weight: bold;
  color: #2c3e50;
  margin: 0 0 8px 0;
}

.assignment-info p {
  font-size: 14px;
  color: #7f8c8d;
  margin: 0;
  line-height: 1.5;
}

.assignment-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.assignment-status.pending {
  background: #fff3cd;
  color: #856404;
}

.assignment-status.submitted {
  background: #d4edda;
  color: #155724;
}

.assignment-details {
  margin-top: 20px;
}

.assignment-requirements h4 {
  font-size: 16px;
  font-weight: bold;
  color: #2c3e50;
  margin: 0 0 12px 0;
}

.assignment-requirements ul {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
}

.assignment-requirements li {
  padding: 6px 0;
  padding-right: 20px;
  position: relative;
  font-size: 14px;
  color: #495057;
}

.assignment-requirements li::before {
  content: '✓';
  position: absolute;
  right: 0;
  color: #28a745;
  font-weight: bold;
}

.upload-section {
  background: white;
  border-radius: 8px;
  padding: 20px;
  border: 2px dashed #dee2e6;
  margin-top: 15px;
}

.upload-btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 15px;
  display: block;
  width: 100%;
  transition: background 0.3s;
}

.upload-btn:hover {
  background: #2980b9;
}

.notes-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 15px;
}

.submit-btn {
  background: #28a745;
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  width: 100%;
  transition: background 0.3s;
}

.submit-btn:hover {
  background: #218838;
}

.empty-submissions {
  text-align: center;
  padding: 60px 20px;
  color: #7f8c8d;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.submissions-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 20px;
}

/* ===== النقاشات ===== */
.discussions-container {
  max-width: 1000px;
  margin: 0 auto;
}

.create-discussion-section {
  margin-bottom: 30px;
}

.create-discussion-btn {
  background: #3498db;
  color: white;
  border: none;
  padding: 15px 25px;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: background 0.3s;
}

.create-discussion-btn:hover {
  background: #2980b9;
}

.discussions-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.discussion-card {
  background: white;
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.discussion-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.12);
  border-color: #3498db;
}

.discussion-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
}

.discussion-info h3 {
  font-size: 18px;
  font-weight: bold;
  color: #2c3e50;
  margin: 0 0 10px 0;
  line-height: 1.4;
}

.discussion-meta {
  display: flex;
  gap: 20px;
  font-size: 13px;
  color: #7f8c8d;
}

.discussion-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
}

.discussion-status.active {
  background: #d4edda;
  color: #155724;
}

.discussion-status.popular {
  background: #fff3cd;
  color: #856404;
}

.discussion-status:not(.active):not(.popular) {
  background: #f8f9fa;
  color: #6c757d;
}

.discussion-preview {
  font-size: 14px;
  color: #7f8c8d;
  line-height: 1.6;
}

/* ===== Modal عام ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  overflow-y: auto;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 12px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  padding: 25px;
  border-bottom: 1px solid #e0e0e0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 24px;
  font-weight: bold;
  color: #2c3e50;
  margin: 0;
}

.modal-close {
  font-size: 28px;
  cursor: pointer;
  color: #7f8c8d;
  background: none;
  border: none;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 25px;
}

/* ===== تحسينات للهواتف ===== */
@media (max-width: 768px) {
  .lessons-grid, .assignments-grid {
    grid-template-columns: 1fr;
  }
  
  .assignment-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }
  
  .section-header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
  
  .discussion-header {
    flex-direction: column;
    gap: 10px;
  }
  
  .discussion-meta {
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .modal-content {
    margin: 10px;
    max-height: 95vh;
  }
  
  .modal-header, .modal-body {
    padding: 20px;
  }
}

/* ===== تأثيرات إضافية ===== */
.lesson-card, .assignment-card, .discussion-card {
  position: relative;
  overflow: hidden;
}

.lesson-card::before, .assignment-card::before, .discussion-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.lesson-card:hover::before, .assignment-card:hover::before, .discussion-card:hover::before {
  left: 100%;
}

/* ===== تحسين الألوان ===== */
:root {
  --primary-color: #3498db;
  --success-color: #28a745;
  --warning-color: #ffc107;
  --danger-color: #dc3545;
  --info-color: #17a2b8;
  --light-color: #f8f9fa;
  --dark-color: #343a40;
}

/* ===== تحسين التباعد ===== */
.lessons-sections > *:last-child,
.assignments-sections > *:last-child,
.discussions-container > *:last-child {
  margin-bottom: 0;
}

/* تحسين أزرار إكمال الدرس */
.complete-btn {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  color: white;
  border: none;
  padding: 15px 30px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  width: 100%;
  margin: 20px 0;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.complete-btn:hover {
  background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

.complete-btn:active {
  transform: translateY(0);
}

.complete-btn::before {
  content: '✓';
  font-size: 18px;
  font-weight: bold;
}

/* تحسين ألوان النصوص في المودال */
.lesson-content {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 12px;
  margin: 20px 0;
  border: 1px solid #e9ecef;
}

.lesson-content h3 {
  color: #2c3e50;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 15px;
  border-bottom: 2px solid #3498db;
  padding-bottom: 8px;
}

.lesson-content ul {
  list-style: none;
  padding: 0;
}

.lesson-content li {
  padding: 8px 0;
  padding-right: 25px;
  position: relative;
  color: #000000;
  font-size: 15px;
  line-height: 1.6;
}

.lesson-content li::before {
  content: '▶';
  position: absolute;
  right: 0;
  color: #3498db;
  font-size: 12px;
  top: 10px;
}

.lesson-description {
  background: #e3f2fd;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  border-left: 4px solid #2196f3;
}

.lesson-description p {
  margin: 0;
  color: #1565c0;
  font-weight: 500;
}

/* تحسين زر تفعيل الإشعارات */
.notification-toggle-btn {
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
  min-width: 140px;
}

.notification-toggle-btn:hover {
  background: linear-gradient(135deg, #2980b9 0%, #1f5582 100%);
  transform: scale(1.05);
}

.notification-toggle-btn.active {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

.notification-toggle-btn.active:hover {
  background: linear-gradient(135deg, #218838 0%, #1ea085 100%);
}
/* تصميم بطاقات الكتب */
.book-card {
  border: 2px solid #f39c12;
  background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
}

.book-card:hover {
  border-color: #e67e22;
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(243, 156, 18, 0.2);
}

.book-thumbnail {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
  color: white;
}

.book-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(0,0,0,0.8);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  transition: all 0.3s ease;
}

.book-card:hover .book-overlay {
  background: #f39c12;
  transform: translate(-50%, -50%) scale(1.1);
}

/* تحسين عرض المحتوى للكتب */
.book-content {
  background: #fff9e6;
  padding: 25px;
  border-radius: 12px;
  margin: 20px 0;
  border: 1px solid #f39c12;
}

.book-content h3 {
  color: #e67e22;
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 15px;
  border-bottom: 2px solid #f39c12;
  padding-bottom: 8px;
}

.reading-link {
  display: inline-block;
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: white;
  padding: 12px 25px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: bold;
  margin: 15px 0;
  transition: all 0.3s ease;
}

.reading-link:hover {
  background: linear-gradient(135deg, #2980b9 0%, #1f5582 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.reading-link::before {
  content: '🔗 ';
  margin-left: 8px;
}

/* تحسين دالة تفعيل الإشعارات */
function toggleNotifications() {
  const btn = document.getElementById('notificationToggle');
  const text = document.getElementById('toggleText');
  
  if (Notification.permission === 'granted') {
    btn.classList.add('active');
    text.textContent = 'الإشعارات مفعلة';
  } else if (Notification.permission === 'denied') {
    alert('الإشعارات محظورة. يرجى تفعيلها من إعدادات المتصفح');
  } else {
    Notification.requestPermission().then(permission => {
      if (permission === 'granted') {
        btn.classList.add('active');
        text.textContent = 'الإشعارات مفعلة';
        new Notification('تم تفعيل الإشعارات!', {
          body: 'سنرسل لك تذكيرات يومية',
          icon: '🔔'
        });
      } else {
        alert('لم يتم تفعيل الإشعارات');
      }
    });
  }
}

function updateReminderTime() {
  const time = document.getElementById('reminderTime').value;
  localStorage.setItem('reminderTime', time);
  alert(`تم تحديث وقت التذكير إلى ${time}`);
}

/* إصلاح ألوان النصوص في محتوى الدروس */
.lesson-content li {
  color: #000000 !important;
  font-weight: 500 !important;
}

.lesson-content h3 {
  color: #2c3e50 !important;
}

.lesson-content p {
  color: #000000 !important;
}

/* إصلاح ألوان النصوص في جميع أجزاء المودال */
.modal-body .lesson-content * {
  color: #000000 !important;
}

.modal-body .lesson-content h3 {
  color: #2c3e50 !important;
}

/* تحسين زر إكمال الدرس */
.complete-btn {
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
  color: white !important;
  border: none !important;
  padding: 15px 30px !important;
  border-radius: 8px !important;
  font-size: 16px !important;
  font-weight: bold !important;
  cursor: pointer !important;
  width: 100% !important;
  margin: 20px 0 !important;
  transition: all 0.3s ease !important;
}

.complete-btn:hover {
  background: linear-gradient(135deg, #218838 0%, #1ea085 100%) !important;
  transform: translateY(-2px) !important;
}

/* إصلاح ألوان النصوص في بطاقات الكتب */
.book-info {
  background: #fff3cd;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid #f39c12;
}

.book-info h3 {
  color: #856404 !important;
  margin: 0 0 10px 0;
}

.book-info p {
  color: #856404 !important;
  margin: 0;
}

/* تحسين روابط القراءة */
.reading-link-box {
  background: #e3f2fd;
  padding: 15px;
  border-radius: 8px;
  margin: 15px 0;
  border-left: 4px solid #2196f3;
}

.reading-link-box p {
  margin: 0;
  color: #1565c0 !important;
  font-weight: 500;
}

.reading-link-box a {
  color: #1976d2 !important;
  text-decoration: none;
  font-weight: bold;
}

.reading-link-box a:hover {
  text-decoration: underline;
}