/* =====================
   ROOT VARIABLES (Dark/Light)
   ===================== */
:root {
  --accent: #7C3AED;
  --accent-hover: #5B21B6;
  --success: #38A169;
  --success-dark: #2F855A;
  --danger: #e53e3e;
  --card-bg: #23262f;
  --surface: #181a20;
  --text-main: #f5f6fa;
  --text-secondary: #b0b3b8;
  --border: #23262f;
  --shadow: 0 8px 32px rgba(124,58,237,0.10);
  --radius: 18px;
  --font-main: 'Cairo', 'Rubik', Arial, sans-serif;
}
body.light-mode {
  --text-main: #181a20;
  --text-secondary: #444a57;
  --card-bg: #fff;
  --surface: #f5f7fa;
}
body.light-mode h1, body.light-mode h2, body.light-mode h3, body.light-mode h4, body.light-mode h5, body.light-mode h6 {
  color: #181a20;
  text-shadow: 0 2px 8px rgba(124,58,237,0.07), 0 1px 0 #fff;
  -webkit-text-fill-color: #181a20 !important;
}
body.light-mode .featured-title h1, body.light-mode .section-title h2 {
  color: #181a20;
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: #181a20;
  background-clip: unset;
  text-shadow: 0 2px 12px rgba(124,58,237,0.10), 0 1px 0 #fff;
}
body.light-mode .featured-title, body.light-mode .featured-title *,
body.light-mode .section-title, body.light-mode .section-title * {
  color: #181a20 !important;
}
body.light-mode .featured-stat h3,
body.light-mode .price-amount,
body.light-mode .featured-title,
body.light-mode .featured-title h1,
body.light-mode .featured-category,
body.light-mode .filter-tab,
body.light-mode .enroll-btn,
body.light-mode .preview-btn,
body.light-mode .view-all {
  color: #181a20 !important;
  text-shadow: 0 1px 4px #fff, 0 2px 8px rgba(124,58,237,0.07);
}
body.light-mode .featured-card, body.light-mode .new-grid .featured-card {
  background: #fff;
  color: #181a20;
  box-shadow: 0 8px 32px rgba(124,58,237,0.07), 0 2px 8px rgba(67,233,123,0.07);
}
body.light-mode .featured-instructor span,
body.light-mode .featured-meta, body.light-mode .meta-item,
body.light-mode .featured-stat p, body.light-mode .price-original {
  color: #444a57 !important;
}
body.light-mode .filter-tab.active, body.light-mode .filter-tab:hover {
  color: #fff !important;
}
body.light-mode .enroll-btn, body.light-mode .preview-btn {
  color: #fff !important;
}
body.light-mode .search-input {
  color: #181a20;
  background: #f5f7fa;
}
body.light-mode .search-input::placeholder {
  color: #888;
}

/* =====================
   FONT ENHANCEMENTS & TYPOGRAPHY
   ===================== */
:root {
  --font-main: 'Cairo', 'Rubik', Arial, sans-serif;
  --font-bold: 900;
  --font-semibold: 700;
  --font-medium: 600;
  --font-regular: 500;
}
html, body {
  font-family: var(--font-main);
  font-weight: var(--font-regular);
  letter-spacing: 0.02em;
  line-height: 1.7;
  color: var(--text-main);
  background: var(--surface);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-main);
  font-weight: var(--font-bold);
  color: var(--accent);
  letter-spacing: 0.04em;
  line-height: 1.25;
  text-shadow: 0 2px 8px rgba(124,58,237,0.08);
}

/* Navbar & Logo */
.logo span {
  font-family: 'Rubik', 'Cairo', Arial, sans-serif;
  font-size: 1.7rem;
  font-weight: var(--font-bold);
  color: var(--accent);
  letter-spacing: 1.5px;
  text-shadow: 0 2px 8px rgba(124,58,237,0.10);
}

.nav-links a, .nav-links i {
  font-weight: var(--font-semibold);
  color: var(--text-main);
  letter-spacing: 0.03em;
}

/* Header & Stats */
.featured-title h1 {
  font-size: 2.6rem;
  font-weight: var(--font-bold);
  letter-spacing: 0.08em;
  text-shadow: 0 4px 18px rgba(124,58,237,0.25), 0 1px 0 #fff, 0 0 2px #23262f;
  color: var(--accent);
  background: linear-gradient(90deg, var(--accent) 30%, #6a11cb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  /* Fallback for browsers that don't support background-clip:text */
  text-fill-color: var(--accent);
  filter: brightness(1.15) contrast(1.2);
}
body.light-mode .featured-title h1 {
  text-shadow: 0 2px 12px rgba(124,58,237,0.13), 0 1px 0 #fff;
  filter: brightness(1.1) contrast(1.1);
}
.featured-subtitle {
  font-size: 1.13rem;
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.featured-stat h3 {
  font-size: 1.6rem;
  font-weight: var(--font-bold);
  color: var(--accent);
  text-shadow: 0 2px 8px rgba(124,58,237,0.10);
}
.featured-stat p {
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

/* Filters & Search */
.filter-tab {
  font-weight: var(--font-semibold);
  font-size: 1.08rem;
  letter-spacing: 0.03em;
}
.filter-tab.active, .filter-tab:hover {
  font-weight: var(--font-bold);
  box-shadow: 0 2px 8px rgba(124,58,237,0.13);
}
.search-input {
  font-size: 1.08rem;
  font-weight: var(--font-medium);
  color: var(--text-main);
  letter-spacing: 0.02em;
}

/* Cards & Grids */
.featured-card {
  font-family: var(--font-main);
  font-weight: var(--font-regular);
  box-shadow: 0 8px 32px rgba(124,58,237,0.13), 0 2px 8px rgba(67,233,123,0.10);
  transition: box-shadow 0.25s, transform 0.22s;
}
.featured-card:hover {
  box-shadow: 0 16px 48px rgba(124,58,237,0.18), 0 4px 16px rgba(67,233,123,0.13);
  transform: translateY(-10px) scale(1.045) rotate(-1deg);
}
.featured-title {
  font-size: 1.35rem;
  font-weight: var(--font-bold);
  color: var(--accent);
  letter-spacing: 0.03em;
  text-shadow: 0 2px 8px rgba(124,58,237,0.10);
}
.featured-category {
  font-weight: var(--font-semibold);
  color: var(--accent);
}
.featured-instructor span {
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}
.featured-meta, .meta-item {
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}
.price-amount {
  font-size: 1.6rem;
  font-weight: var(--font-bold);
  color: var(--accent);
  text-shadow: 0 2px 8px rgba(124,58,237,0.10);
}
.price-original {
  font-weight: var(--font-medium);
  color: var(--text-secondary);
}

/* Buttons */
.enroll-btn, .preview-btn {
  font-weight: var(--font-bold);
  font-size: 1.08rem;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 8px rgba(124,58,237,0.10);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.18s;
}
.enroll-btn:hover, .preview-btn:hover {
  box-shadow: 0 4px 16px rgba(124,58,237,0.18);
  transform: scale(1.04);
}

/* Sections */
.section-title h2 {
  font-size: 2rem;
  font-weight: var(--font-bold);
  letter-spacing: 0.05em;
  text-shadow: 0 2px 12px rgba(124,58,237,0.13);
  color: var(--accent);
  background: linear-gradient(90deg, var(--accent), #6a11cb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.view-all {
  font-weight: var(--font-semibold);
  color: var(--accent);
  letter-spacing: 0.03em;
  transition: color 0.3s, text-shadow 0.2s;
}
.view-all:hover {
  color: var(--accent-hover);
  text-shadow: 0 2px 8px rgba(124,58,237,0.13);
}

/* =====================
   GENERAL LAYOUT
   ===================== */
html, body {
  font-family: var(--font-main);
  background: var(--surface);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}
.container {
  max-width: 1200px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}

/* =====================
   NAVBAR & LOGO
   ===================== */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2.5rem;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
}
.logo {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.logo-image {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--accent);
  box-shadow: 0 2px 12px rgba(124,58,237,0.10);
  background: #fff;
}
.logo span {
  font-family: 'Rubik', 'Cairo', Arial, sans-serif;
  font-size: 1.55rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 1px;
  margin-left: 0.5rem;
  margin-right: 0.5rem;
  line-height: 1.1;
  display: inline-block;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.nav-links a, .nav-links i {
  color: var(--text-main);
  text-decoration: none;
  font-size: 1.18rem;
  padding: 0.32rem 0.7rem;
  border-radius: 50%;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.18s;
  cursor: pointer;
  margin: 0 0.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-links i:hover, .nav-links a:hover {
  background: rgba(124,58,237,0.10);
  color: var(--accent);
  transform: scale(1.13) rotate(-8deg);
}

/* =====================
   HEADER & STATS
   ===================== */
.featured-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
/* === Animated Gradient Bar for Featured Header (Always Visible) === */
.featured-header {
  position: relative;
  overflow: visible !important;
  z-index: 20;
}
.featured-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 10px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(270deg, #7C3AED, #38c8f4, #43e97b, #fdc830, #fa709a, #e53e3e, #7C3AED, #38c8f4);
  background-size: 1600% 1600% !important;
  animation: animated-gradient-bar 7s linear infinite !important;
  z-index: 99;
  pointer-events: none;
}
@keyframes animated-gradient-bar {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.featured-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.featured-title i {
  font-size: 2.2rem;
  color: var(--accent);
}
.featured-title h1 {
  margin: 0;
  font-size: 2.1rem;
  background: linear-gradient(90deg, var(--accent), #6a11cb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.featured-subtitle {
  color: var(--text-secondary);
  margin-top: 0.5rem;
  font-size: 1.1rem;
}
.featured-stats {
  display: flex;
  gap: 1.5rem;
}
.featured-stat {
  text-align: center;
  padding: 0.5rem 1.2rem;
  background: rgba(124,58,237,0.07);
  border-radius: 12px;
  min-width: 100px;
  box-shadow: 0 2px 8px rgba(124,58,237,0.07);
}
.featured-stat h3 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--accent);
}
.featured-stat p {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* =====================
   FILTERS & SEARCH
   ===================== */
.featured-filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.filter-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--card-bg);
  padding: 0.5rem;
  border-radius: 30px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.filter-tab {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 25px;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 500;
}
.filter-tab:hover, .filter-tab.active {
  background: var(--accent);
  color: #fff;
}
.filter-options {
  display: flex;
  gap: 1rem;
  align-items: center;
}
.search-container {
  position: relative;
  width: 300px;
}
.search-input {
  width: 100%;
  padding: 0.75rem 1.5rem 0.75rem 2.5rem;
  border: none;
  border-radius: 25px;
  background: var(--card-bg);
  color: var(--text-main);
  transition: all 0.3s;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.search-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
}
.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

/* =====================
   GRIDS & CARDS
   ===================== */
.featured-grid, .new-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}
.featured-card {
  background: var(--card-bg);
  border-radius: 15px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 420px;
}
.featured-card:hover {
  transform: translateY(-10px) scale(1.03);
  box-shadow: 0 15px 30px rgba(0,0,0,0.22);
}
.featured-badge {
  position: absolute;
  top: 1rem; right: 1rem;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
  z-index: 2;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
.featured-image {
  height: 200px;
  width: 100%;
  object-fit: cover;
  transition: transform 0.5s;
  border-bottom: 2px solid var(--accent);
}
.featured-card:hover .featured-image {
  transform: scale(1.05);
}
.featured-content {
  padding: 1.5rem;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.featured-category {
  display: inline-block;
  background: rgba(124,58,237,0.13) !important;
  color: #a259ff !important;
  padding: 0.25rem 0.95rem;
  border-radius: 15px;
  font-size: 1.13rem;
  margin-bottom: 0.5rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 8px #6a11cb33;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.featured-category:hover, .featured-card:hover .featured-category {
  background: linear-gradient(90deg, #7C3AED 60%, #6a11cb 100%) !important;
  color: #fff !important;
  box-shadow: 0 2px 12px rgba(124,58,237,0.13);
  text-shadow: 0 1px 4px #6a11cb55;
}
body.light-mode .featured-category {
  background: rgba(124,58,237,0.13) !important;
  color: #7C3AED !important;
  text-shadow: 0 1px 2px #fff, 0 1px 4px #ece9f6;
}
.featured-title {
  margin: 0 0 0.5rem;
  font-size: 1.3rem;
  line-height: 1.4;
  font-weight: bold;
}
.featured-instructor {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}
.instructor-avatar {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--accent);
}
.featured-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.featured-price {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.price-amount {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--accent);
}
.price-original {
  text-decoration: line-through;
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.featured-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  justify-content: stretch;
  align-items: stretch;
}
.enroll-btn, .preview-btn {
  flex: 1 1 0;
  padding: 0.85rem 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 0;
}
.enroll-btn.purchase-btn {
  background: linear-gradient(90deg, var(--success), #48BB78);
  color: #fff;
}
.enroll-btn.purchase-btn:hover:not(:disabled) {
  background: linear-gradient(90deg, var(--success-dark), var(--success));
  box-shadow: 0 2px 8px rgba(56,161,105,0.15);
}
.enroll-btn.code-btn {
  background: linear-gradient(90deg, var(--accent), #6B46C1);
  color: #fff;
}
.enroll-btn.code-btn:hover:not(:disabled) {
  background: linear-gradient(90deg, var(--accent-hover), var(--accent));
  box-shadow: 0 2px 8px rgba(124,58,237,0.15);
}
.preview-btn {
  background: #2D3748;
  color: #fff;
  border: none;
  text-decoration: none;
  font-weight: 600;
  border-radius: 10px;
  transition: background 0.2s, color 0.2s;
}
.preview-btn:hover {
  background: #4A5568;
  color: #fff;
}
body.light-mode .preview-btn {
  background: #E2E8F0;
  color: #2D3748;
}
body.light-mode .preview-btn:hover {
  background: #CBD5E1;
  color: #2D3748;
}
.enroll-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* =====================
   SECTIONS & RESPONSIVE
   ===================== */
.new-section {
  margin-top: 4rem;
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.section-title i {
  font-size: 1.5rem;
  color: var(--accent);
}
.section-title h2 {
  margin: 0;
  font-size: 1.8rem;
  background: linear-gradient(90deg, var(--accent), #6a11cb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}
.view-all {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color 0.3s;
}
.view-all:hover {
  color: var(--accent-hover);
}
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  font-size: 1.2rem;
  color: var(--text-secondary);
}
.loading-spinner i {
  margin-right: 0.5rem;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.error-message {
  text-align: center;
  padding: 2rem;
  color: var(--danger);
  background: rgba(229,62,62,0.1);
  border-radius: 10px;
  margin: 1rem 0;
}

/* =====================
   RESPONSIVE & RTL
   ===================== */
@media (max-width: 900px) {
  .navbar {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 1rem;
  }
  .container {
    padding: 0 0.5rem;
  }
  .featured-header, .section-header {
    flex-direction: column;
    gap: 1.5rem;
    align-items: flex-start;
  }
  .featured-stats {
    width: 100%;
    justify-content: space-between;
  }
  .featured-filters {
    flex-direction: column;
    align-items: flex-start;
  }
  .filter-tabs {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }
  .filter-options {
    width: 100%;
    flex-wrap: wrap;
  }
  .search-container {
    width: 100%;
  }
  .featured-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  .enroll-btn, .preview-btn {
    font-size: 0.95rem;
    padding: 0.7rem 0.5rem;
  }
}
@media (max-width: 600px) {
  .logo-image {
    width: 38px;
    height: 38px;
  }
  .logo span {
    font-size: 1.1rem;
  }
  .featured-header, .section-header {
    padding: 0.7rem;
  }
  .featured-card {
    min-height: 320px;
  }
}
[dir="rtl"] .navbar {
  flex-direction: row-reverse;
}
[dir="rtl"] .featured-header,
[dir="rtl"] .section-header {
  flex-direction: row-reverse;
}
[dir="rtl"] .featured-actions {
  flex-direction: row-reverse;
}
[dir="rtl"] .featured-title, [dir="rtl"] .section-title {
  flex-direction: row-reverse;
}
[dir="rtl"] .featured-meta {
  flex-direction: row-reverse;
}
[dir="rtl"] .meta-item {
  flex-direction: row-reverse;
}
