/* =======================================
   Global Styles
   ======================================= */
* {
  font-family: "Cairo", sans-serif;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #0d6efd;
  --secondary: #6c757d;
  --success: #198754;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #0dcaf0;
  --dark: #0b1220;
  --light: #f8f9fa;
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
  --gradient-warning: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

body {
  background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  min-height: 100vh;
  color: #2c3e50;
}

.container {
  max-width: 1200px;
}

/* =======================================
   Navbar
   ======================================= */
.navbar {
  background: var(--gradient-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
}

.navbar-brand {
  font-size: 1.5rem;
  transition: transform 0.3s ease;
}

.navbar-brand:hover {
  transform: scale(1.05);
}

.nav-link {
  color: rgba(255, 255, 255, 0.9) !important;
  transition: all 0.3s ease;
  margin: 0 0.5rem;
}

.nav-link:hover,
.nav-link.active {
  color: #fff !important;
  font-weight: 600;
}

.user-xp-badge {
  background: rgba(255, 255, 255, 0.2);
  padding: 0.5rem 1rem;
  border-radius: 25px;
  color: white;
  backdrop-filter: blur(10px);
  font-weight: 600;
}

/* User Dropdown Menu */
.navbar .dropdown-menu {
  background: white;
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 250px;
  margin-top: 0.5rem;
}

.navbar .dropdown-menu li {
  color: #2c3e50;
}

.navbar .dropdown-item {
  padding: 0.75rem 1rem;
  transition: background 0.2s ease;
  color: #2c3e50;
}

.navbar .dropdown-item:hover {
  background: rgba(102, 126, 234, 0.1);
  color: var(--primary);
}

.navbar .dropdown-divider {
  margin: 0;
}

/* =======================================
   Hero Section
   ======================================= */
.hero-section {
  padding: 5rem 0;
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.1) 0%,
    rgba(118, 75, 162, 0.1) 100%
  );
}

.hero-section h1 {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-box {
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.stat-box h3 {
  margin-bottom: 0.25rem;
}

.hero-image {
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-20px);
  }
}

/* =======================================
   Course CTA Section
   ======================================= */
.course-cta-section {
  padding: 3rem 0;
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.05) 0%,
    rgba(118, 75, 162, 0.05) 100%
  );
}

.course-cta-card {
  background: white;
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(102, 126, 234, 0.1);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.course-cta-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 4px;
  background: var(--gradient-primary);
}

.course-cta-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.course-cta-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.course-cta-description {
  color: #6c757d;
  font-size: 1rem;
  line-height: 1.6;
}

.btn-cta-primary {
  background: var(--gradient-success);
  border: none;
  color: white;
  font-weight: 600;
  padding: 0.875rem 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(25, 135, 84, 0.3);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-cta-primary::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-cta-primary:hover::before {
  width: 300px;
  height: 300px;
}

.btn-cta-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(25, 135, 84, 0.4);
  color: white;
}

.btn-cta-primary:active {
  transform: translateY(0);
}

/* =======================================
   Filter Section
   ======================================= */
.filter-section {
  padding: 2rem 0;
}

.btn-filter {
  background: white;
  border: 2px solid transparent;
  padding: 0.75rem 1.5rem;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.btn-filter:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-filter.active {
  background: var(--gradient-primary);
  color: white;
  border-color: var(--primary);
}

/* =======================================
   Courses Section
   ======================================= */
.courses-section {
  padding: 3rem 0;
}

.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.course-card {
  background: white;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border: none;
}

.course-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.course-thumbnail {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--gradient-primary);
}

.course-card .card-body {
  padding: 1.5rem;
}

.course-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--dark);
}

.course-description {
  color: #6c757d;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.course-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.course-meta span {
  font-size: 0.85rem;
  color: #6c757d;
}

.badge-level {
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  font-weight: 600;
}

.badge-beginner {
  background: var(--gradient-success);
  color: white;
}

.badge-intermediate {
  background: var(--gradient-warning);
  color: white;
}

.badge-advanced {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

/* =======================================
   Leaderboard Section
   ======================================= */
.leaderboard-section {
  padding: 4rem 0;
  background: rgba(255, 255, 255, 0.5);
}

.leaderboard-card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.leaderboard-card .table {
  margin-bottom: 0;
}

.leaderboard-card thead {
  background: var(--gradient-primary);
  color: white;
}

.leaderboard-card th {
  border: none;
  font-weight: 600;
  padding: 1rem;
}

.leaderboard-card tbody tr {
  transition: background 0.2s ease;
}

.leaderboard-card tbody tr:hover {
  background: rgba(102, 126, 234, 0.05);
}

.leaderboard-card td {
  padding: 1rem;
  vertical-align: middle;
}

.medal-icon {
  font-size: 1.5rem;
}

/* =======================================
   Lesson Page
   ======================================= */
.lesson-card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.video-container {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.infographic-container img {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.progress-card,
.xp-card {
  border: none;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 20px;
}

.lesson-item {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid #eee;
}

.lesson-item:hover {
  background: rgba(102, 126, 234, 0.05);
  border-color: var(--primary);
}

.lesson-item.active {
  background: var(--gradient-primary);
  color: white;
  border-color: var(--primary);
}

.lesson-item.completed {
  background: var(--gradient-success);
  color: white;
  border-color: var(--success);
}

/* =======================================
   Quiz Section
   ======================================= */
.quiz-question {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 2px solid #eee;
  transition: border-color 0.3s ease;
}

.quiz-question:hover {
  border-color: var(--primary);
}

.quiz-question-number {
  background: var(--gradient-primary);
  color: white;
  width: 35px;
  height: 35px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-left: 0.5rem;
}

.quiz-option {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.quiz-option:hover {
  background: rgba(102, 126, 234, 0.05);
  border-color: var(--primary);
}

.quiz-option input[type="radio"] {
  margin-left: 0.75rem;
}

.quiz-option input[type="radio"]:checked + label {
  font-weight: 600;
  color: var(--primary);
}

.quiz-results {
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.1) 0%,
    rgba(118, 75, 162, 0.1) 100%
  );
  padding: 2rem;
  border-radius: 12px;
  margin-top: 2rem;
}

.result-item {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border-right: 4px solid #ddd;
}

.result-item.correct {
  border-right-color: var(--success);
  background: rgba(25, 135, 84, 0.05);
}

.result-item.incorrect {
  border-right-color: var(--danger);
  background: rgba(220, 53, 69, 0.05);
}

.result-item .explanation {
  background: rgba(0, 0, 0, 0.03);
  padding: 0.75rem;
  border-radius: 6px;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.stat-box-small {
  background: white;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  min-width: 80px;
}

/* =======================================
   Modals
   ======================================= */
.modal-content {
  border: none;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
}

.modal-header {
  border-bottom: 1px solid #eee;
}

/* =======================================
   Footer
   ======================================= */
.footer {
  background: var(--gradient-primary);
  color: white;
  padding: 2rem 0;
  margin-top: 4rem;
}

.footer p,
.footer small {
  color: rgba(255, 255, 255, 0.9);
}

/* =======================================
   Utilities
   ======================================= */
.bg-gradient-primary {
  background: var(--gradient-primary);
  color: white;
}

.bg-gradient-success {
  background: var(--gradient-success);
  color: white;
}

.bg-gradient-warning {
  background: var(--gradient-warning);
  color: white;
}

/* =======================================
   Animations
   ======================================= */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease;
}

/* =======================================
   Responsive
   ======================================= */
@media (max-width: 768px) {
  .hero-section {
    padding: 3rem 0;
  }

  .section-title {
    font-size: 1.75rem;
  }

  .stat-box {
    margin-bottom: 1rem;
  }

  .filter-section .d-flex {
    flex-wrap: wrap;
  }

  .btn-filter {
    margin-bottom: 0.5rem;
  }

  .course-cta-section {
    padding: 2rem 0;
  }

  .course-cta-card {
    padding: 1.5rem;
  }

  .course-cta-title {
    font-size: 1.25rem;
  }

  .course-cta-description {
    font-size: 0.9rem;
  }

  .btn-cta-primary {
    width: 100%;
    padding: 1rem 2rem;
  }
}

/* =======================================
   Scrollbar
   ======================================= */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}
