/* ===========================
   منصة أ/ طارق يوسف
   CSS Design System
   =========================== */

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

:root {
  --primary: #06b6d4;
  --primary-dark: #0891b2;
  --primary-glow: rgba(6, 182, 212, 0.3);
  --accent: #a78bfa;
  --bg-900: #020617;
  --bg-800: #0f172a;
  --bg-700: #1e293b;
  --bg-600: #334155;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --border: rgba(255,255,255,0.08);
  --glass: rgba(15, 23, 42, 0.75);
  --radius: 1rem;
  --radius-lg: 1.5rem;
  --radius-xl: 2rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Cairo', sans-serif;
  background-color: var(--bg-900);
  color: var(--text-primary);
  direction: rtl;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === Backgrounds === */
.main-bg {
  background: var(--bg-900);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(6,182,212,0.12), transparent),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(167,139,250,0.07), transparent);
}

/* === Glass Effect === */
.glass {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
}

.glass-dark {
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
}

/* === Typography === */
.heading-xl { font-size: clamp(2rem, 5vw, 4rem); font-weight: 900; line-height: 1.1; }
.heading-lg { font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 800; line-height: 1.2; }
.heading-md { font-size: clamp(1.2rem, 2.5vw, 1.75rem); font-weight: 700; }

.gradient-text {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === Buttons === */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #000;
  font-weight: 800;
  font-family: 'Cairo', sans-serif;
  border: none;
  border-radius: 3rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 0 25px var(--primary-glow);
  font-size: 1rem;
  text-decoration: none;
}
.btn-primary:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 40px rgba(6,182,212,0.5);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  background: transparent;
  color: var(--primary);
  font-weight: 700;
  font-family: 'Cairo', sans-serif;
  border: 1.5px solid var(--primary);
  border-radius: 3rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
  text-decoration: none;
}
.btn-outline:hover {
  background: var(--primary-glow);
  transform: translateY(-2px);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: rgba(255,255,255,0.05);
  color: var(--text-secondary);
  font-weight: 600;
  font-family: 'Cairo', sans-serif;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  text-decoration: none;
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

/* === Cards === */
.card {
  background: var(--bg-800);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all 0.3s ease;
}
.card:hover {
  border-color: rgba(6,182,212,0.3);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 20px var(--primary-glow);
}

/* === Form Inputs === */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
textarea,
select {
  width: 100%;
  background: var(--bg-800);
  border: 1.5px solid var(--bg-600);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font-family: 'Cairo', sans-serif;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
input::placeholder, textarea::placeholder { color: var(--text-secondary); }

/* === Badges === */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.75rem;
  border-radius: 3rem;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge-primary { background: rgba(6,182,212,0.15); color: var(--primary); border: 1px solid rgba(6,182,212,0.3); }
.badge-purple { background: rgba(167,139,250,0.15); color: var(--accent); border: 1px solid rgba(167,139,250,0.3); }
.badge-green { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.badge-red { background: rgba(239,68,68,0.15); color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }

/* === Divider === */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border), transparent);
  margin: 2rem 0;
}

/* === Navbar === */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 0;
  transition: all 0.3s ease;
}
.navbar.scrolled {
  background: rgba(2,6,23,0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0.6rem 0;
}

/* === Hero Glow Orb === */
.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}

/* === Grade Card Specific === */
.grade-card {
  border-radius: var(--radius-xl);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  transition: all 0.4s ease;
  border: 1px solid var(--border);
}
.grade-card:hover { transform: translateY(-8px); }
.grade-card .grade-card-inner {
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}

/* === Stat Counter === */
.stat-item {
  text-align: center;
  padding: 1.5rem;
}
.stat-number { font-size: 2.5rem; font-weight: 900; }
.stat-label { color: var(--text-secondary); font-size: 0.9rem; margin-top: 0.25rem; }

/* === Section === */
.section { padding: 5rem 0; }
.section-sm { padding: 3rem 0; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }

/* === Sidebar Dashboard === */
.sidebar {
  width: 260px;
  height: 100vh;
  max-height: 100vh;
  background: rgba(10, 15, 30, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.5);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(15, 23, 42, 0.2);
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-radius: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 600;
  font-size: 0.88rem;
  margin: 0.2rem 0.75rem;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
}
.sidebar-link i {
  transition: transform 0.25s ease;
}
.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  transform: translateX(-2px);
}
.sidebar-link:hover i {
  transform: scale(1.1);
}
.sidebar-link.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(6, 182, 212, 0.03));
  color: var(--primary);
  border: 1px solid rgba(6, 182, 212, 0.2);
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.05);
  font-weight: 700;
}
.sidebar-link.active::after {
  content: '';
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 3px;
  background: var(--primary);
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 8px var(--primary);
}

/* === Loading Spinner === */
.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Animations === */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 20px var(--primary-glow); }
  50% { box-shadow: 0 0 50px rgba(6,182,212,0.6); }
}

.animate-fade-up { animation: fadeInUp 0.6s ease forwards; }
.animate-float { animation: float 4s ease-in-out infinite; }
.animate-pulse-glow { animation: pulse-glow 2.5s ease-in-out infinite; }

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-900); }
::-webkit-scrollbar-thumb { background: var(--bg-600); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* === Mobile nav === */
.mobile-nav {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-900);
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}
.mobile-nav.open { display: flex; }

/* === Responsive === */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
  .section { padding: 3rem 0; }
  .grade-card .grade-card-inner { min-height: 220px; padding: 1.75rem; }
  .sidebar { transform: translateX(100%); }
  .sidebar.open { transform: translateX(0); }
}

/* Utility classes */
.text-primary-color { color: var(--primary); }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-secondary); }
.bg-800 { background: var(--bg-800); }
.border-subtle { border: 1px solid var(--border); }
.rounded-2xl { border-radius: 1rem; }
.rounded-3xl { border-radius: 1.5rem; }
.w-full { width: 100%; }

/* === Utility Classes (Phase 6) === */
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-start { display: flex; align-items: center; justify-content: flex-start; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { display: flex; flex-direction: column; }
.gap-xs { gap: 0.25rem; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 0.75rem; }
.gap-lg { gap: 1rem; }
.gap-xl { gap: 1.5rem; }

/* Text Colors */
.text-success { color: #10b981; }
.text-danger { color: #f43f5e; }
.text-warning { color: #f59e0b; }
.text-info { color: #0ea5e9; }
.text-white { color: #ffffff; }

/* Backgrounds & Gradients */
.bg-gradient-success { background: linear-gradient(135deg, #10b981, #059669); }
.bg-gradient-danger { background: linear-gradient(135deg, #f43f5e, #e11d48); }
.bg-gradient-warning { background: linear-gradient(135deg, #f59e0b, #d97706); }
.bg-gradient-info { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.bg-dark-card { background: rgba(30,41,59,0.5); backdrop-filter: blur(10px); }

/* Borders */
.border-success { border-color: rgba(16,185,129,0.3); }
.border-danger { border-color: rgba(244,63,94,0.3); }
.border-warning { border-color: rgba(245,158,11,0.3); }

/* Spacing */
.p-sm { padding: 0.5rem; }
.p-md { padding: 1rem; }
.p-lg { padding: 1.5rem; }
.m-0 { margin: 0; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }

/* Layout & Typography */
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }
.text-sm { font-size: 0.85rem; }
.text-md { font-size: 1rem; }
.text-lg { font-size: 1.25rem; }

.show-mobile { transform: translateX(0%) !important; }

/* ===========================
   Light Mode Theme System
   =========================== */
html.theme-light,
body.theme-light {
  --bg-900: #f8fafc;
  --bg-800: #ffffff;
  --bg-700: #f1f5f9;
  --bg-600: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --border: rgba(15, 23, 42, 0.08);
  --glass: rgba(255, 255, 255, 0.88);
  --primary: #0284c7;
  --primary-dark: #0369a1;
  --primary-glow: rgba(2, 132, 199, 0.2);
}

html.theme-light body {
  background-color: var(--bg-900) !important;
  color: var(--text-primary) !important;
}

html.theme-light .main-bg {
  background: var(--bg-900) !important;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(2,132,199,0.08), transparent),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(147,51,234,0.05), transparent) !important;
}

html.theme-light .main-content {
  background: var(--bg-900) !important;
}

html.theme-light .sidebar {
  background: rgba(255, 255, 255, 0.95) !important;
  border-left: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: -5px 0 25px rgba(0, 0, 0, 0.06) !important;
}

html.theme-light .sidebar-brand {
  border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
  background: rgba(241, 245, 249, 0.6) !important;
}

html.theme-light .sidebar-brand h1 {
  color: #0f172a !important;
}

html.theme-light .sidebar-link {
  color: #475569 !important;
}

html.theme-light .sidebar-link:hover {
  background: rgba(2, 132, 199, 0.08) !important;
  color: #0284c7 !important;
}

html.theme-light .sidebar-link.active {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.12), rgba(2, 132, 199, 0.04)) !important;
  color: #0284c7 !important;
  border-color: rgba(2, 132, 199, 0.25) !important;
}

html.theme-light .card,
html.theme-light .stat-card {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.06) !important;
}

html.theme-light .glass {
  background: rgba(255, 255, 255, 0.88) !important;
  border: 1px solid rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.06) !important;
}

html.theme-light input[type="text"],
html.theme-light input[type="email"],
html.theme-light input[type="password"],
html.theme-light input[type="number"],
html.theme-light input[type="tel"],
html.theme-light textarea,
html.theme-light select {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
}

html.theme-light input::placeholder,
html.theme-light textarea::placeholder {
  color: #94a3b8 !important;
}

html.theme-light .wallet-widget {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06) !important;
}

html.theme-light .wb-balance span {
  color: #0f172a !important;
}

html.theme-light #wallet-dropdown {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.1) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12) !important;
}

html.theme-light .wd-row {
  color: #334155 !important;
}

html.theme-light .wd-row:hover {
  background: #f1f5f9 !important;
  color: #0284c7 !important;
}

html.theme-light .navbar.scrolled {
  background: rgba(255, 255, 255, 0.95) !important;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
}

/* Light mode overrides for big cards and text elements */
html.theme-light .monthly-course-card {
  background: #ffffff !important;
  border-color: rgba(15, 23, 42, 0.08) !important;
  box-shadow: 0 8px 30px -4px rgba(0, 0, 0, 0.06) !important;
}

html.theme-light .monthly-course-card:hover {
  border-color: rgba(2, 132, 199, 0.4) !important;
  box-shadow: 0 16px 40px -8px rgba(2, 132, 199, 0.15) !important;
}

html.theme-light .course-card-title {
  color: #0f172a !important;
}

html.theme-light .course-card-desc {
  color: #64748b !important;
}

html.theme-light .hero-promo-banner {
  background: linear-gradient(135deg, #ffffff, #f0fdf4) !important;
  border-color: rgba(16, 185, 129, 0.25) !important;
  box-shadow: 0 10px 35px -5px rgba(16, 185, 129, 0.1) !important;
}

html.theme-light .hero-promo-banner h2 {
  color: #0f172a !important;
}

html.theme-light .hero-promo-banner p {
  color: #475569 !important;
}

