* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  direction: rtl;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #333;
  line-height: 1.6;
}

/* الرأس والملاح */
header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 40px;
  background: rgba(0, 0, 0, 0.1);
  border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.logo {
  font-size: 24px;
  font-weight: bold;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 25px;
}

.nav-links a {
  color: white;
  text-decoration: none;
  transition: 0.3s;
  font-weight: 500;
}

.nav-links a:hover {
  color: #ffd700;
  text-decoration: underline;
}

.hero {
  text-align: center;
  padding: 80px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.hero h1 {
  font-size: 48px;
  margin-bottom: 15px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.hero p {
  font-size: 20px;
  margin-bottom: 30px;
  opacity: 0.95;
}

.hero-subtitle {
  font-size: 16px;
  margin-bottom: 30px;
  opacity: 0.9;
  display: block;
}

.cta-button {
  background: #ffd700;
  color: #333;
  border: none;
  padding: 15px 40px;
  font-size: 18px;
  border-radius: 50px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.3s;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.cta-button:hover {
  background: #ffed4e;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* الأقسام الرئيسية */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
}

section {
  margin-bottom: 60px;
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

section h2 {
  color: #667eea;
  font-size: 36px;
  margin-bottom: 30px;
  text-align: center;
  border-bottom: 3px solid #667eea;
  padding-bottom: 15px;
}

.section-subtitle {
  text-align: center;
  color: #666;
  font-size: 16px;
  margin-bottom: 40px;
}

/* قسم الدروس */
.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

.lesson-card {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  padding: 30px;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.lesson-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
  border-color: #667eea;
}

.lesson-icon {
  font-size: 48px;
  margin-bottom: 15px;
}

.lesson-card h3 {
  color: #667eea;
  font-size: 20px;
  margin-bottom: 10px;
}

.lesson-card p {
  color: #666;
  font-size: 14px;
}

.lesson-level {
  display: inline-block;
  background: #667eea;
  color: white;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  margin-top: 12px;
}

/* محتوى الدرس */
.lesson-content {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.lesson-content.hidden {
  display: none;
}

.back-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #667eea;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
}

.back-btn:hover {
  background: #5568d3;
}

.lesson-view {
  background: white;
  border-radius: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  padding: 40px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  width: 100%;
}

.lesson-text h2 {
  color: #667eea;
  border: none;
  padding: 0;
  margin-bottom: 20px;
}

.lesson-text p {
  margin-bottom: 15px;
  line-height: 1.8;
}

.code-editor {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.code-editor h3 {
  color: #667eea;
}

#code-input {
  width: 100%;
  height: 200px;
  padding: 15px;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  resize: vertical;
}

#code-input:focus {
  outline: none;
  border-color: #667eea;
}

.code-editor button {
  background: #667eea;
  color: white;
  border: none;
  padding: 12px 25px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  font-size: 16px;
  transition: 0.3s;
}

.code-editor button:hover {
  background: #5568d3;
}

.output {
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 15px;
  min-height: 100px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: #333;
}

/* قسم التمارين */
.practice-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 25px;
}

.practice-item {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 8px;
  border-right: 4px solid #667eea;
}

.practice-item h3 {
  color: #667eea;
  margin-bottom: 12px;
}

.practice-item p {
  margin-bottom: 15px;
  color: #666;
}

.solution-btn {
  background: #764ba2;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  transition: 0.3s;
}

.solution-btn:hover {
  background: #653a82;
}

.solution {
  margin-top: 15px;
  padding: 15px;
  background: white;
  border-radius: 5px;
  border-right: 3px solid #ffd700;
}

.solution.hidden {
  display: none;
}

.solution code {
  background: #f4f4f4;
  padding: 10px;
  border-radius: 4px;
  display: block;
  overflow-x: auto;
  font-family: 'Courier New', monospace;
  font-size: 13px;
}

/* قسم الاتصال */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 600px;
  margin: 0 auto;
}

.contact-form input,
.contact-form textarea {
  padding: 15px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-family: inherit;
  font-size: 16px;
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 5px rgba(102, 126, 234, 0.3);
}

.contact-form textarea {
  resize: vertical;
  min-height: 120px;
}

.submit-btn {
  background: #667eea;
  color: white;
  border: none;
  padding: 15px;
  border-radius: 5px;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
  transition: 0.3s;
}

.submit-btn:hover {
  background: #5568d3;
}

.form-message {
  margin-top: 15px;
  text-align: center;
  font-weight: bold;
  color: #28a745;
}

.form-message.error {
  color: #dc3545;
}

/* التذييل */
footer {
  background: #333;
  color: white;
  text-align: center;
  padding: 30px 20px;
  margin-top: 40px;
}

footer p {
  margin: 8px 0;
}

/* الاستجابة للهاتف */
@media (max-width: 768px) {
  .nav-links {
    flex-direction: column;
    gap: 10px;
  }

  .hero h1 {
    font-size: 32px;
  }

  .lesson-view {
    grid-template-columns: 1fr;
  }

  section {
    padding: 20px;
  }

  nav {
    flex-direction: column;
    gap: 15px;
  }
}

/* قسم المقدمة */
.introduction-section {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  margin-bottom: 60px;
}

.introduction-section h2 {
  color: #667eea;
  font-size: 36px;
  margin-bottom: 30px;
  text-align: center;
  border-bottom: 3px solid #667eea;
  padding-bottom: 15px;
}

.intro-content h3 {
  color: #333;
  font-size: 22px;
  margin-top: 25px;
  margin-bottom: 15px;
}

.intro-content p {
  margin-bottom: 15px;
  line-height: 1.8;
  color: #555;
}

.intro-content ul {
  list-style-position: inside;
  margin: 15px 0;
}

.intro-content li {
  margin-bottom: 10px;
  color: #555;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 30px;
}

.feature {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  border: 2px solid #e9ecef;
  transition: all 0.3s;
}

.feature:hover {
  border-color: #667eea;
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
  transform: translateY(-3px);
}

.feature-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.feature h4 {
  color: #667eea;
  margin-bottom: 10px;
}

.feature p {
  font-size: 14px;
  color: #666;
}

/* قسم الموارد */
.resources-section {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  margin-bottom: 60px;
}

.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

.resource-item {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 25px;
  border-radius: 8px;
  transition: all 0.3s;
}

.resource-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.resource-item h4 {
  font-size: 18px;
  margin-bottom: 12px;
}

.resource-item p {
  font-size: 14px;
  opacity: 0.95;
}

/* قسم الأسئلة الشائعة */
.faq-section {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  margin-bottom: 60px;
}

.faq-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

.faq-item {
  background: #f8f9fa;
  padding: 25px;
  border-radius: 8px;
  border-right: 4px solid #667eea;
  transition: all 0.3s;
}

.faq-item:hover {
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
  transform: translateY(-2px);
}

.faq-item h4 {
  color: #667eea;
  margin-bottom: 12px;
  font-size: 16px;
}

.faq-item p {
  color: #555;
  font-size: 14px;
  line-height: 1.7;
}

/* صفحة عن الموقع */
.about-section {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  margin-bottom: 60px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.about-section h1 {
  color: #667eea;
  font-size: 42px;
  text-align: center;
  margin-bottom: 40px;
  border-bottom: 3px solid #667eea;
  padding-bottom: 20px;
}

.about-section h2 {
  color: #667eea;
  font-size: 28px;
  margin-top: 30px;
  margin-bottom: 15px;
  border-bottom: 2px solid #667eea;
  padding-bottom: 10px;
}

.about-section p {
  color: #555;
  line-height: 1.8;
  margin-bottom: 15px;
  font-size: 16px;
}

.about-section ul {
  margin-left: 20px;
  margin-bottom: 20px;
}

.about-section li {
  margin-bottom: 12px;
  color: #555;
  font-size: 15px;
  line-height: 1.7;
}

.features-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 30px 0;
}

.feature-item {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px;
  border-left: 4px solid #667eea;
  transition: all 0.3s;
}

.feature-item:hover {
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
  transform: translateY(-2px);
}

.feature-item h4 {
  color: #667eea;
  margin-bottom: 10px;
}

.feature-item p {
  color: #666;
  font-size: 14px;
}

.about-section a {
  color: #667eea;
  text-decoration: none;
  font-weight: bold;
}

.about-section a:hover {
  text-decoration: underline;
}

/* صفحة السياسة والخصوصية */
.policy-section {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
  margin-bottom: 60px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.policy-section h1 {
  color: #667eea;
  font-size: 42px;
  text-align: center;
  margin-bottom: 20px;
  border-bottom: 3px solid #667eea;
  padding-bottom: 20px;
}

.last-updated {
  text-align: center;
  color: #999;
  font-size: 14px;
  margin-bottom: 30px;
}

.policy-section h2 {
  color: #667eea;
  font-size: 24px;
  margin-top: 30px;
  margin-bottom: 15px;
  border-bottom: 2px solid #667eea;
  padding-bottom: 10px;
}

.policy-section h3 {
  color: #333;
  font-size: 18px;
  margin-top: 20px;
  margin-bottom: 12px;
}

.policy-section p {
  color: #555;
  line-height: 1.8;
  margin-bottom: 15px;
  font-size: 15px;
}

.policy-section ul {
  margin-left: 20px;
  margin-bottom: 20px;
}

.policy-section li {
  margin-bottom: 10px;
  color: #555;
  font-size: 15px;
  line-height: 1.6;
}

.policy-section a {
  color: #667eea;
  text-decoration: none;
  font-weight: bold;
}

.policy-section a:hover {
  text-decoration: underline;
}
