:root {
  /* استيراد الألوان من ملف theme.js */
  --primary-50: #f0fdf4;
  --primary-100: #dcfce7;
  --primary-200: #bbf7d0;
  --primary-300: #86efac;
  --primary-400: #4ade80;
  --primary-500: #22c55e;
  --primary-600: #16a34a;
  --primary-700: #15803d;
  --primary-800: #166534;
  --primary-900: #14532d;

  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;

  /* متغيرات الثيم الفاتح */
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-tertiary: #6b7280;
  
  --border-light: #e5e7eb;
  --border-default: #d1d5db;
  --border-dark: #9ca3af;

  /* متغيرات إضافية */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --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-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 1rem;
  
  --transition-default: all 0.3s ease;
  
  /* متغيرات الخط */
  --font-ar: 'Cairo', sans-serif;
  --font-en: 'Roboto', sans-serif;
}

/* الثيم الداكن */
.dark-theme {
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --bg-tertiary: #374151;
  
  --text-primary: #f9fafb;
  --text-secondary: #e5e7eb;
  --text-tertiary: #d1d5db;
  
  --border-light: #374151;
  --border-default: #4b5563;
  --border-dark: #6b7280;
}

/* إعادة ضبط عامة */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-ar);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: var(--transition-default);
}

html[lang="en"] body {
  font-family: var(--font-en);
}

a {
  color: var(--primary-600);
  text-decoration: none;
  transition: var(--transition-default);
}

a:hover {
  color: var(--primary-700);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* الرأس */
header {
  position: sticky;
  top: 0;
  background-color: var(--bg-primary);
  box-shadow: var(--shadow-sm);
  z-index: 100;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-light);
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo img {
  height: 40px;
  width: auto;
}

.logo h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-600);
}

nav ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
}

nav ul li a {
  color: var(--text-secondary);
  font-weight: 500;
  padding: 0.5rem 0;
  position: relative;
}

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

nav ul li a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: var(--primary-500);
  border-radius: 2px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#theme-toggle, #language-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.25rem;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  transition: var(--transition-default);
}

#theme-toggle:hover, #language-toggle:hover {
  background-color: var(--bg-tertiary);
  color: var(--primary-600);
}

#language-toggle {
  font-size: 1rem;
  font-weight: 600;
}

/* قسم البطل */
.hero {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
  color: white;
  padding: 4rem 0;
  text-align: center;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.hero p {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

.cta-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  transition: var(--transition-default);
  text-align: center;
}

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

.btn.primary:hover {
  background-color: rgba(255, 255, 255, 0.9);
  transform: translateY(-2px);
}

.btn.secondary {
  background-color: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn.secondary:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

/* المحتوى الرئيسي */
main {
  padding: 2rem 0;
  display: flex;
  flex-direction: row;
  gap: 2rem;
}

/* الشريط الجانبي */
.sidebar {
  width: 250px;
  position: sticky;
  top: 100px;
  height: calc(100vh - 100px);
  overflow-y: auto;
  padding-right: 1rem;
  border-right: 1px solid var(--border-light);
}

html[dir="rtl"] .sidebar {
  padding-right: 0;
  padding-left: 1rem;
  border-right: none;
  border-left: 1px solid var(--border-light);
}

.sidebar-header {
  margin-bottom: 1rem;
}

.sidebar-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.sidebar-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.sidebar-nav ul li {
  margin-bottom: 0.5rem;
}

.sidebar-nav ul li a {
  display: block;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-weight: 500;
  transition: var(--transition-default);
}

.sidebar-nav ul li a:hover {
  background-color: var(--bg-tertiary);
  color: var(--primary-600);
}

.sidebar-nav ul ul {
  margin-left: 1rem;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  width: 100%;
}

html[dir="rtl"] .sidebar-nav ul ul {
  margin-left: 0;
  margin-right: 1rem;
}

.sidebar-nav ul ul li a {
  font-size: 0.9rem;
}

/* المحتوى */
.content {
  flex: 1;
}

section {
  margin-bottom: 3rem;
}

h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  position: relative;
  padding-bottom: 0.5rem;
}

h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 50px;
  height: 3px;
  background-color: var(--primary-500);
  border-radius: 3px;
}

h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

h4 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

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

/* البطاقات */
.card {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

/* الميزات */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.feature-card {
  background-color: var(--bg-secondary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  transition: var(--transition-default);
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-300);
}

.feature-icon {
  font-size: 2rem;
  color: var(--primary-500);
  margin-bottom: 1rem;
}

/* نقاط النهاية */
.endpoint-group {
  margin-bottom: 2.5rem;
}

.endpoint {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.endpoint-header {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
}

.method {
  font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-right: 1rem;
  font-size: 0.875rem;
  text-transform: uppercase;
}

.method.get {
  background-color: #dbeafe;
  color: #1e40af;
}

.method.post {
  background-color: #dcfce7;
  color: #166534;
}

.method.put {
  background-color: #fef3c7;
  color: #92400e;
}

.method.delete {
  background-color: #fee2e2;
  color: #b91c1c;
}

.path {
  font-family: monospace;
  font-size: 1rem;
  font-weight: 500;
}

.endpoint-content {
  padding: 1.5rem;
  background-color: var(--bg-primary);
}

/* كتل الكود */
.code-block {
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin: 1rem 0;
  overflow-x: auto;
}

.code-block pre {
  margin: 0;
}

.code-block code {
  font-family: monospace;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* الجداول */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

table th, table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

table th {
  background-color: var(--bg-secondary);
  font-weight: 600;
  color: var(--text-primary);
}

/* الملاحظات */
.note {
  background-color: rgba(var(--primary-100-rgb), 0.3);
  border-left: 4px solid var(--primary-500);
  padding: 1rem;
  margin: 1rem 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.note p {
  margin: 0;
}

/* التذييل */
footer {
  background-color: var(--primary-800);
  color: white;
  padding: 3rem 0 1rem;
  margin-top: 3rem;
}

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

.footer-logo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.footer-logo img {
  height: 40px;
  margin-bottom: 1rem;
}

.footer-links h4, .footer-contact h4 {
  color: white;
  margin-bottom: 1rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.footer-links h4::after, .footer-contact h4::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 30px;
  height: 2px;
  background-color: var(--primary-400);
}

.footer-links ul {
  list-style: none;
}

.footer-links ul li {
  margin-bottom: 0.5rem;
}

.footer-links ul li a {
  color: rgba(255, 255, 255, 0.8);
}

.footer-links ul li a:hover {
  color: white;
}

.footer-contact p {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* روابط وسائل التواصل الاجتماعي */
.social-links {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.social-icon {
  width: 20px;
  height: 20px;
}

.social-link:hover {
  transform: translateY(-3px);
}

.social-link.facebook {
  color: #1877F2;
}

.social-link.telegram {
  color: #229ED9;
}

.social-link.whatsapp {
  color: #25D366;
}

.social-link.facebook:hover {
  background-color: rgba(24, 119, 242, 0.2);
}

.social-link.telegram:hover {
  background-color: rgba(34, 158, 217, 0.2);
}

.social-link.whatsapp:hover {
  background-color: rgba(37, 211, 102, 0.2);
}

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}

/* الاستجابة للشاشات المختلفة */
@media (max-width: 992px) {
  main {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    position: relative;
    top: 0;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
  }
}

@media (max-width: 768px) {
  header .container {
    flex-direction: column;
    gap: 1rem;
  }
  
  nav ul {
    gap: 1rem;
  }
  
  .hero h1 {
    font-size: 2rem;
  }
  
  .hero p {
    font-size: 1rem;
  }
  
  .features {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 576px) {
  nav ul {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .cta-buttons {
    flex-direction: column;
  }
  
  .endpoint-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .method {
    margin-right: 0;
  }
}

/* تأثيرات الانتقال */
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* تخصيصات للغة العربية */
html[lang="ar"] {
  direction: rtl;
}

html[lang="ar"] .sidebar {
  border-right: none;
  border-left: 1px solid var(--border-light);
  padding-right: 0;
  padding-left: 1rem;
}

html[lang="ar"] h2::after,
html[lang="ar"] .footer-links h4::after,
html[lang="ar"] .footer-contact h4::after {
  left: auto;
  right: 0;
}

html[lang="ar"] .note {
  border-left: none;
  border-right: 4px solid var(--primary-500);
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

html[lang="ar"] table th,
html[lang="ar"] table td {
  text-align: right;
}

html[lang="ar"] .method {
  margin-right: 0;
  margin-left: 1rem;
}

/* تخصيصات للغة الإنجليزية */
html[lang="en"] {
  direction: ltr;
}

/* تخصيصات للثيم الداكن */
.dark-theme .code-block {
  background-color: #2d3748;
}

.dark-theme .method.get {
  background-color: rgba(219, 234, 254, 0.1);
  color: #93c5fd;
}

.dark-theme .method.post {
  background-color: rgba(220, 252, 231, 0.1);
  color: #86efac;
}

.dark-theme .method.put {
  background-color: rgba(254, 243, 199, 0.1);
  color: #fcd34d;
}

.dark-theme .method.delete {
  background-color: rgba(254, 226, 226, 0.1);
  color: #fca5a5;
}

.dark-theme .note {
  background-color: rgba(20, 83, 45, 0.2);
}

/* تحميل الصفحة */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease-in-out;
}

.loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--bg-tertiary);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
