/* ============================================
   الشاذلي - التنسيقات المخصصة
   ============================================ */

/* ---------- خط Cairo ---------- */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&display=swap');

/* ---------- متغيرات عامة ---------- */
:root {
  --transition-speed: 0.3s;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.3);
  --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 8px 40px rgba(0, 0, 0, 0.12);
}

/* ---------- أساسيات ---------- */
* {
  font-family: 'Cairo', sans-serif;
}

body {
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #f1f5f9 100%);
  min-height: 100vh;
}

/* ---------- الهيدر ---------- */
.site-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header h1 {
  background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 50%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- كروت الصفوف ---------- */
.grade-card {
  position: relative;
  border-radius: 1.25rem;
  padding: 2.5rem 2rem;
  cursor: pointer;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  color: white;
  text-align: center;
}

.grade-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0) 100%);
  opacity: 0;
  transition: opacity var(--transition-speed);
}

.grade-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--shadow-hover);
}

.grade-card:hover::before {
  opacity: 1;
}

.grade-card:active {
  transform: translateY(-2px) scale(0.98);
}

.grade-card .grade-icon {
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 2rem;
  font-weight: 800;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: transform var(--transition-speed);
}

.grade-card:hover .grade-icon {
  transform: scale(1.1) rotate(-5deg);
}

.grade-card .grade-name {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.grade-card .grade-meta {
  font-size: 0.9rem;
  opacity: 0.85;
}

/* ---------- زرار الرجوع ---------- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.4rem;
  border-radius: 0.75rem;
  background: white;
  color: #334155;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  transition: all var(--transition-speed);
  box-shadow: var(--shadow-soft);
}

.back-btn:hover {
  background: #f1f5f9;
  transform: translateX(4px);
  box-shadow: var(--shadow-hover);
}

/* ---------- عنوان الصف ---------- */
.grade-title-bar {
  padding: 1.5rem 2rem;
  border-radius: 1rem;
  color: white;
  margin-bottom: 1.5rem;
}

/* ---------- أقسام الوحدات (Accordion) ---------- */
.unit-section {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  margin-bottom: 1rem;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: box-shadow var(--transition-speed);
}

.unit-section:hover {
  box-shadow: var(--shadow-hover);
}

.unit-header {
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 1.1rem;
  color: #1e293b;
  transition: background var(--transition-speed);
  user-select: none;
}

.unit-header:hover {
  background: rgba(99, 102, 241, 0.05);
}

.unit-header .chevron {
  transition: transform var(--transition-speed);
  color: #94a3b8;
  font-size: 1.25rem;
}

.unit-header.active .chevron {
  transform: rotate(180deg);
  color: #6366f1;
}

.unit-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.unit-body.open {
  max-height: 2000px;
}

/* ---------- عناصر الدروس ---------- */
.lesson-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-top: 1px solid #f1f5f9;
  transition: background var(--transition-speed);
  gap: 1rem;
}

.lesson-item:hover {
  background: rgba(99, 102, 241, 0.03);
}

.lesson-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
  color: #334155;
  font-weight: 600;
  flex: 1;
  min-width: 0;
}

.lesson-title .lesson-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #6366f1;
  flex-shrink: 0;
}

.lesson-title span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- زرار النسخ ---------- */
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 0.6rem;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  transition: all var(--transition-speed);
  white-space: nowrap;
  flex-shrink: 0;
}

.copy-btn:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.copy-btn:active {
  transform: scale(0.95);
}

.copy-btn.copied {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.copy-btn svg {
  width: 16px;
  height: 16px;
}

/* ---------- الفوتر ---------- */
.site-footer {
  text-align: center;
  padding: 2rem;
  color: #94a3b8;
  font-size: 0.85rem;
}

/* ---------- أنيميشن الظهور ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
}

.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.15s; }
.animate-in:nth-child(3) { animation-delay: 0.25s; }
.animate-in:nth-child(4) { animation-delay: 0.35s; }
.animate-in:nth-child(5) { animation-delay: 0.45s; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .grade-card {
    padding: 1.75rem 1.25rem;
  }

  .grade-card .grade-icon {
    width: 4rem;
    height: 4rem;
    font-size: 1.5rem;
  }

  .grade-card .grade-name {
    font-size: 1.1rem;
  }

  .lesson-item {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 1rem;
  }

  .copy-btn {
    justify-content: center;
    padding: 0.6rem;
  }

  .unit-header {
    padding: 1rem 1.25rem;
    font-size: 1rem;
  }
}
