:root {
  --primary-purple: #861678;
  --primary-hover: #6d1061;
  --deep-purple: #3b0f53;
  --dark-plum: #2a0845;
  --magenta-berry: #9d177d;
  --rose-violet: #c0258d;
  --lavender: #dfc2ea;
  --soft-lilac: #faf4fc;
  --lilac-border: #edd6f5;
  --purple-glow: rgba(157, 23, 125, 0.3);
  --purple-gradient: linear-gradient(135deg, #2a0845 0%, #6b1d7d 45%, #9d177d 80%, #c0258d 100%);
  --accent-gradient: linear-gradient(135deg, #6b1d7d 0%, #c0258d 100%);
  --roshd-pill-gradient: linear-gradient(135deg, #38084e 0%, #6f167a 50%, #9e1981 100%);
  --glass-bg: rgba(255, 255, 255, 0.9);
  --card-radius: 20px;
  --btn-radius: 14px;
}

/* Global Font & Direction */
body {
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  background-color: #faf4fc;
  color: #2a0845;
  overflow-x: hidden;
  transition: background-color 0.3s ease;
}

[dir="ltr"] body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Smooth Transitions */
*, *::before, *::after {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

/* Custom Purple Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: #f5f3ff;
}
::-webkit-scrollbar-thumb {
  background: #a78bfa;
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: #7c3aed;
}

/* Animations */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-8px); }
  100% { transform: translateY(0px); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(124, 58, 237, 0.3); }
  50% { box-shadow: 0 0 35px rgba(168, 85, 247, 0.6); }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.animate-float {
  animation: float 4s ease-in-out infinite;
}

.animate-glow {
  animation: pulseGlow 3s infinite;
}

/* Navbar */
.navbar-custom {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(167, 139, 250, 0.25);
  box-shadow: 0 4px 20px rgba(76, 29, 149, 0.05);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 1050;
}

.navbar-brand img {
  height: 44px;
}

.nav-link {
  font-weight: 600;
  color: #3b0764 !important;
  padding: 8px 16px !important;
  border-radius: 8px;
  transition: all 0.25s ease !important;
}

.nav-link:hover, .nav-link.active {
  color: #7c3aed !important;
  background-color: #f3e8ff;
  transform: translateY(-1px);
}

/* Modern Gradient Buttons */
.btn-purple {
  background: var(--purple-gradient);
  background-size: 200% 200%;
  color: #ffffff !important;
  border: none;
  border-radius: var(--btn-radius);
  padding: 10px 24px;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-purple:hover {
  background-position: right center;
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.5);
  transform: translateY(-2px);
  color: #ffffff !important;
}

.btn-purple-outline {
  background: transparent;
  color: var(--primary-purple) !important;
  border: 2px solid var(--primary-purple);
  border-radius: var(--btn-radius);
  padding: 8px 22px;
  font-weight: 700;
  transition: all 0.25s ease;
}

.btn-purple-outline:hover {
  background: var(--primary-purple);
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.25);
}

/* Modern Cards */
.modern-card {
  background: #ffffff;
  border-radius: var(--card-radius);
  border: 1px solid rgba(221, 214, 254, 0.7);
  box-shadow: 0 10px 30px -5px rgba(124, 58, 237, 0.08);
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.modern-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px -4px rgba(124, 58, 237, 0.18);
  border-color: #c4b5fd;
}

.card-img-wrapper {
  position: relative;
  overflow: hidden;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background: #f5f3ff;
}

.card-img-wrapper img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.modern-card:hover .card-img-wrapper img {
  transform: scale(1.05);
}

/* Badges */
.badge-purple {
  background: #ede9fe;
  color: #6d28d9;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
}

.badge-featured {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
}

.badge-low-stock {
  background: #fee2e2;
  color: #dc2626;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
}

/* Lazy Load Styling */
img.lazyload-img {
  opacity: 0;
  filter: blur(5px);
  transition: opacity 0.5s ease-in-out, filter 0.5s ease-in-out, transform 0.5s ease;
}

img.lazyload-img.loaded {
  opacity: 1;
  filter: blur(0);
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, #2e1065 0%, #4c1d95 40%, #6d28d9 100%);
  color: #ffffff;
  padding: 80px 0;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(192, 132, 252, 0.25) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-section::after {
  content: '';
  position: absolute;
  bottom: -150px;
  left: -150px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.2) 0%, transparent 70%);
  border-radius: 50%;
}

/* Certificate Verification Box */
.verify-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  border: 2px solid rgba(192, 132, 252, 0.4);
  border-radius: 24px;
  padding: 36px;
  box-shadow: 0 20px 45px rgba(76, 29, 149, 0.15);
}

.cert-input-group {
  border: 2px solid #ddd6fe;
  border-radius: 16px;
  overflow: hidden;
  background: #ffffff;
  transition: border-color 0.25s ease;
}

.cert-input-group:focus-within {
  border-color: #7c3aed;
  box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.15);
}

/* Certificate Output Card (Official Certificate Look) */
.official-certificate-container {
  background: #ffffff;
  border: 12px double #6d28d9;
  border-radius: 20px;
  padding: 45px 35px;
  position: relative;
  box-shadow: 0 15px 40px rgba(124, 58, 237, 0.12);
  text-align: center;
}

.official-certificate-container::before {
  content: 'أكاديمية رُشْد';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-25deg);
  font-size: 72px;
  font-weight: 900;
  color: rgba(124, 58, 237, 0.05);
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 2px;
  z-index: 1;
}

.cert-code-pill {
  background: #f3e8ff;
  border: 1px dashed #7c3aed;
  color: #5b21b6;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 2px;
  padding: 8px 24px;
  border-radius: 30px;
  display: inline-block;
}

/* Admin Dashboard Specific */
.admin-sidebar {
  background: #2e1065;
  color: #ede9fe;
  min-height: 100vh;
  box-shadow: 4px 0 20px rgba(0,0,0,0.06);
}

.admin-sidebar .nav-link {
  color: #ddd6fe !important;
  font-weight: 500;
  margin-bottom: 4px;
  padding: 10px 18px !important;
  border-radius: 10px;
}

.admin-sidebar .nav-link:hover, .admin-sidebar .nav-link.active {
  background: #4c1d95;
  color: #ffffff !important;
  font-weight: 700;
}

.admin-stat-card {
  background: #ffffff;
  border-radius: 18px;
  padding: 24px;
  border: 1px solid #ede9fe;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.04);
  display: flex;
  align-items: center;
  gap: 18px;
}

.admin-stat-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background: #f5f3ff;
  color: #7c3aed;
}

/* Footer */
.footer-custom {
  background: #1e1b4b;
  color: #c4b5fd;
  padding: 60px 0 30px;
  margin-top: 80px;
}

.footer-custom a {
  color: #ede9fe;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-custom a:hover {
  color: #c084fc;
}

/* ==========================================================================
   DARK MODE SYSTEM (تدرجات الموف الليلي الفخمة)
   ========================================================================== */
[data-theme="dark"] body {
  background-color: #0c0817;
  color: #ede9fe;
}

[data-theme="dark"] .navbar-custom {
  background: rgba(18, 12, 34, 0.92) !important;
  border-bottom: 1px solid #2e1d52;
}

[data-theme="dark"] .navbar-custom .nav-link {
  color: #c4b5fd !important;
}

[data-theme="dark"] .navbar-custom .nav-link:hover,
[data-theme="dark"] .navbar-custom .nav-link.active {
  color: #ffffff !important;
}

[data-theme="dark"] .card-custom,
[data-theme="dark"] .card,
[data-theme="dark"] .admin-card,
[data-theme="dark"] .admin-stat-card,
[data-theme="dark"] .admin-sidebar {
  background: #171128 !important;
  border-color: #2e1d52 !important;
  color: #ede9fe !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45) !important;
}

[data-theme="dark"] .text-muted {
  color: #a78bfa !important;
}

[data-theme="dark"] .text-dark {
  color: #f5f3ff !important;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background-color: #1e1535 !important;
  border-color: #3b2567 !important;
  color: #f5f3ff !important;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
  background-color: #231840 !important;
  border-color: #a855f7 !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 0.25rem rgba(168, 85, 247, 0.25) !important;
}

[data-theme="dark"] .table {
  color: #ede9fe !important;
  border-color: #2e1d52 !important;
}

[data-theme="dark"] .table-light,
[data-theme="dark"] thead th {
  background-color: #22183d !important;
  color: #ddd6fe !important;
  border-color: #2e1d52 !important;
}

[data-theme="dark"] .dropdown-menu {
  background-color: #1a1230 !important;
  border-color: #3b2567 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="dark"] .dropdown-item {
  color: #c4b5fd !important;
}

[data-theme="dark"] .dropdown-item:hover {
  background-color: #2e1d52 !important;
  color: #ffffff !important;
}

[data-theme="dark"] .list-group-item {
  background-color: #1a1230 !important;
  border-color: #2e1d52 !important;
  color: #ede9fe !important;
}

[data-theme="dark"] .modal-content {
  background-color: #171128 !important;
  border-color: #3b2567 !important;
  color: #f5f3ff !important;
}

[data-theme="dark"] .border,
[data-theme="dark"] .border-bottom,
[data-theme="dark"] .border-top {
  border-color: #2e1d52 !important;
}

[data-theme="dark"] .bg-light {
  background-color: #1a1230 !important;
}

[data-theme="dark"] .footer-custom {
  background: #090611 !important;
  border-top: 1px solid #22153d;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  background: rgba(124, 58, 237, 0.12);
  border: 1px solid #c4b5fd;
  color: #7c3aed;
  border-radius: 30px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle-btn:hover {
  background: #7c3aed;
  color: #ffffff;
  transform: translateY(-2px);
}

[data-theme="dark"] .theme-toggle-btn {
  background: rgba(168, 85, 247, 0.2);
  border-color: #a855f7;
  color: #e9d5ff;
}

[data-theme="dark"] .theme-toggle-btn:hover {
  background: #a855f7;
  color: #ffffff;
}

/* ==========================================================================
   COURSE AVAILABILITY BADGES (علامات إتاحة الكورسات)
   ========================================================================== */
.badge-available {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-coming-soon {
  background: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 15px rgba(217, 70, 239, 0.4);
  animation: pulseGlow 2.5s infinite;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-unavailable {
  background: #64748b;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-closed {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   CONSULTANT SESSIONS & TIME SLOTS PICKER
   ========================================================================== */
.slot-badge {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid #ddd6fe;
  background: #f5f3ff;
  color: #4c1d95;
  text-align: center;
}

.slot-badge:hover:not(.disabled) {
  background: #7c3aed;
  color: #ffffff;
  border-color: #7c3aed;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(124, 58, 237, 0.3);
}

.slot-badge.selected {
  background: #7c3aed !important;
  color: #ffffff !important;
  border-color: #6d28d9 !important;
  box-shadow: 0 6px 20px rgba(124, 58, 237, 0.45);
}

.slot-badge.disabled {
  background: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
  cursor: not-allowed;
  opacity: 0.65;
  text-decoration: line-through;
}

[data-theme="dark"] .slot-badge {
  background: #1f1638;
  border-color: #3b2567;
  color: #c4b5fd;
}

[data-theme="dark"] .slot-badge.disabled {
  background: #161026;
  border-color: #251a3d;
  color: #64748b;
}

/* ==========================================================================
   DIGITAL PDF LIBRARY (المكتبة الرقمية)
   ========================================================================== */
.book-card {
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  border-radius: 20px;
}

.book-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(124, 58, 237, 0.2);
}

.book-cover-wrapper {
  position: relative;
  overflow: hidden;
  background: #2e1065;
  aspect-ratio: 3/4;
}

.book-cover-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.book-card:hover .book-cover-wrapper img {
  transform: scale(1.06);
}

.pdf-reader-frame {
  width: 100%;
  height: 82vh;
  border: 1px solid #3b2567;
  border-radius: 16px;
  background: #171128;
}

/* ==========================================================================
   EVENTS & WEBINARS STYLING (الفاعليات واللقاءات)
   ========================================================================== */
.event-card {
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 20px;
  overflow: hidden;
}

.event-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px rgba(134, 22, 120, 0.18);
}

/* ==========================================================================
   STAR RATING PICKER & REVIEWS (نظام تقييم النجوم)
   ========================================================================== */
.star-rating-picker {
  display: inline-flex;
  flex-direction: row-reverse;
  justify-content: center;
  gap: 6px;
}

.star-rating-picker .star-label {
  color: #d1d5db;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

.star-rating-picker .star-label:hover,
.star-rating-picker .star-label:hover ~ .star-label,
.star-rating-picker input[type="radio"]:checked ~ .star-label {
  color: #f59e0b !important;
  transform: scale(1.15);
}

.star-rating-picker input[type="radio"]:checked + .star-label {
  color: #f59e0b !important;
}

.card-hover {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-5px);
  box-shadow: 0 16px 32px rgba(134, 22, 120, 0.15) !important;
}

.bg-purple-header {
  background: linear-gradient(135deg, #3b0764 0%, #701a75 50%, #1e002e 100%) !important;
  color: #ffffff !important;
}

/* Purple Palette Utilities */
.text-purple {
  color: #701a75 !important;
}

.bg-purple {
  background-color: #701a75 !important;
  color: #ffffff !important;
}

.bg-purple-subtle {
  background-color: #fdf2f8 !important;
  color: #701a75 !important;
}

.border-purple {
  border-color: #701a75 !important;
}

.border-purple-subtle {
  border-color: #fbcfe8 !important;
}


