/* Add Aenoik font */
@font-face {
  font-family: 'Aenoik';
  src: url('../fonts/aenoik.woff2') format('woff2'),
       url('../fonts/aenoik.woff') format('woff'),
       url('../fonts/aenoik.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --dark-navy: #121212; /* Changed to requested background color */
  --medium-blue: #3a80c1;
  --light-blue: #91c4e8;
  --accent-red: #eb3c51;
  --card-bg: #1A1A1A;
  --dark-text-primary: #ffffff; /* Added for the glitch effect */
  --accent-color: var(--light-blue); /* Using light-blue as accent color */
  --accent-hover: var(--accent-red); /* Using accent-red as accent-hover */
}

/* Force background color with !important to override any conflicting styles */
html body, body {
  background-color: #121212 !important;
}

/* Add forced overflow control to prevent horizontal scrolling */
html, body {
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100% !important;
  position: relative;
}

body {
  background-color: var(--dark-navy);
}

/* Animation container at the top of the page */
.animation-container {
  padding: 80px 0 0; /* Increased from 40px to 80px to add more space at the top */
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 200px; /* Increased from 150px to accommodate larger text */
  margin-top: 40px; /* Added explicit top margin for more space below header */
  max-width: 100vw; /* Ensure container doesn't exceed viewport width */
  overflow-x: hidden; /* Prevent horizontal scrolling */
}

/* Arabic typing animation styles - fix position */
.typing-container {
  display: flex;
  margin-top: 10px;
  justify-content: center;
  direction: rtl;
}

.static-text {
  color: var(--dark-text-primary);
  font-family: 'Tajawal', sans-serif;
  font-size: 3rem;
  font-weight: 500;
  margin-left: 5px;
}

.typing-text {
  color: #3a80c1;
  font-family: 'Tajawal', sans-serif;
  font-size: 3rem;
  font-weight: 700;
  min-width: 50px;
  display: inline-block;
}

/* Updated category styling to allow horizontal scrolling on mobile */
.categories-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 20px 0;
  position: relative;
  padding: 0 15px;
  box-sizing: border-box;
}

.categories-wrapper {
  display: flex;
  flex-wrap: wrap; /* Use wrap for desktop */
  overflow-x: hidden; /* Hide overflow on desktop */
  justify-content: center;
  padding: 80px 0;
  margin: 0 auto;
  max-width: 100%;
  gap: 10px;
}

/* Hide scrollbar on desktop */
.categories-wrapper::-webkit-scrollbar {
  display: none;
}

.categories-wrapper {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.category-button {
  background-color: var(--card-bg);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 8px 16px;
  margin: 5px 3px;
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  min-width: auto;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

/* Update category button styling */
.category-btn {
  background-color: #121212; /* Dark background */
  color: white; /* White text */
  border: 1px solid rgba(255, 255, 255, 0.2); /* Subtle border */
  border-radius: 30px; /* Increased from 20px for a more rounded look */
  padding: 12px 24px; /* Increased from 8px 16px */
  margin: 8px 5px; /* Increased margin */
  cursor: pointer;
  font-size: 1.1rem; /* Increased from 0.95rem */
  font-weight: 400;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: auto;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15); /* More visible shadow */
  letter-spacing: 0.2px; /* Added letter spacing for better readability */
}

.category-btn:hover {
  background-color: rgba(255, 255, 255, 0.1); /* Slightly lighter on hover */
  transform: translateY(-3px); /* Increased lift effect on hover */
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); /* Enhanced shadow on hover */
}

.category-btn.active {
  background-color: white; /* White background when active */
  color: #121212 !important; /* Dark text when active */
  border-color: white;
  font-weight: 500;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25); /* Enhanced shadow when active */
  transform: translateY(-2px); /* Slight lift when active */
}

/* Mobile-specific styles: Convert to horizontal scrolling */
@media (max-width: 768px) {
  .categories-container {
    padding: 0 5px;
    overflow: visible;
  }
  
  .categories-wrapper {
    flex-wrap: nowrap; /* Keep on single line for mobile */
    overflow-x: auto; /* Enable horizontal scrolling on mobile */
    justify-content: flex-start; /* Start from left on mobile */
    white-space: nowrap; /* Prevent wrapping */
    gap: 5px;
    padding: 10px 5px;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scroll-behavior: smooth; /* Smooth scrolling between items */
    max-width: 100%;
    mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent); /* Add fade effect to edges */
    -webkit-mask-image: linear-gradient(to right, transparent, black 5%, black 95%, transparent);
  }
  
  .category-button {
    flex-shrink: 0; /* Prevent shrinking */
    white-space: nowrap; /* Ensure text doesn't wrap */
    padding: 7px 14px;
    margin: 0 3px;
    font-size: 0.85rem;
  }

  .category-btn {
    flex-shrink: 0; /* Prevent shrinking */
    white-space: nowrap; /* Ensure text doesn't wrap */
    padding: 10px 20px; /* Slightly smaller padding on mobile but still larger than before */
    margin: 5px 4px;
    font-size: 1rem; /* Slightly smaller font on mobile but still larger than before */
  }
  
  /* Adjust container spacing for larger buttons */
  .categories-wrapper {
    padding: 15px 5px; /* Increased padding */
    gap: 8px; /* Increased gap */
  }
}

/* Course card styling - change to responsive dimensions */
.dark-course-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  
  width: 100% !important; /* Use percentage instead of fixed width */
  max-width: 450px !important; /* Maximum width cap */
  height: auto !important; /* Auto height instead of fixed */
  aspect-ratio: 450 / 550; /* Maintain proportions using aspect ratio */
  
  background: #1A1A1A;
  box-shadow: 2px 1px 37px rgba(0, 0, 0, 0.09);
  border-radius: 16px;
  
  margin: 0 auto;
  overflow: hidden;
  position: relative !important; /* For absolute positioning of elements */
}

.course-image {
  width: 100%;
  height: auto !important; /* Auto height */
  aspect-ratio: 450 / 260; /* Maintain image proportions */
  overflow: hidden;
  position: relative;
  border-radius: 16px 16px 0 0;
  flex-shrink: 0; /* Prevent the image from shrinking */
}

.course-image img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensure the image covers the container */
  object-position: center; /* Center the image in the container */
}

/* Course content container - remove scroll and make content scale */
.course-content {
  width: 100%;
  padding: 0 25px !important;
  display: flex;
  flex-direction: column;
  align-items: flex-start !important;
  text-align: left !important;
  height: auto !important; /* Auto height */
  min-height: unset !important; /* Remove min-height constraint */
  overflow-y: visible !important; /* Remove scrolling */
  padding-bottom: 80px !important; /* Increase padding at bottom for fixed elements */
}

/* Ensure course title stays compact */
.course-title {
  margin: 15px 0 5px 0 !important; /* Reduce bottom margin */
  font-size: clamp(1rem, 2.5vw, 1.4rem) !important; /* Slightly smaller responsive font */
  font-weight: 600;
  color: white;
  text-align: left !important;
  width: 100% !important;
  line-height: 1.3 !important; /* Tighter line height */
  max-height: 2.6em !important; /* Limit to 2 lines */
  overflow: hidden !important; /* Hide overflow */
  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important; /* Limit to 2 lines */
  -webkit-box-orient: vertical !important;
}

/* Make course meta more compact */
.course-meta {
  display: flex;
  justify-content: flex-start !important;
  gap: 10px; /* Smaller gap */
  margin-bottom: 5px; /* Smaller margin */
  font-size: 0.8rem; /* Slightly smaller font */
  color: #ccc;
  width: 100%;
}

/* Make description text adapt to available space */
.course-description {
  color: #aaa;
  font-size: clamp(0.8rem, 2.2vw, 0.95rem) !important; /* Slightly smaller responsive font */
  margin-bottom: 5px !important; /* Smaller margin */
  line-height: 1.3; /* Tighter line height */
  text-align: left !important;
  width: 100% !important;
  max-height: calc(1.3em * 4) !important; /* Limit height to 4 lines */
  overflow: hidden !important; /* Hide overflow */
  display: -webkit-box !important;
  -webkit-line-clamp: 4 !important; /* Limit to 4 lines */
  -webkit-box-orient: vertical !important;
}

/* Changed button color to navy blue */
.action-button {
  padding: clamp(6px, 1.8vw, 10px) clamp(12px, 2.5vw, 18px) !important; /* Smaller responsive padding */
  background-color: #1a365d !important; /* Changed from accent-red to a navy blue */
  color: white !important;
  border-radius: 8px !important;
  font-weight: 600 !important;
  transition: all 0.3s ease !important;
  font-size: clamp(0.9rem, 2.5vw, 1.1rem) !important; /* Responsive font size */
  width: auto !important;
  text-align: center !important;
  box-shadow: 0 4px 10px rgba(26, 54, 93, 0.3) !important; /* Updated shadow color to match button */
  white-space: nowrap !important;
  letter-spacing: 0.5px !important;
  position: absolute !important; /* Position the button absolutely */
  bottom: 25px !important; /* Consistent bottom position */
  right: 25px !important; /* Position from right */
  margin: 0 !important; /* Remove margins that might affect positioning */
}

/* Make price text left-aligned and positioned at bottom left, aligned vertically with button */
.course-price {
  font-weight: 700;
  color: var(--light-blue);
  font-size: clamp(0.9rem, 2.5vw, 1.1rem); /* Responsive font size */
  margin-right: 0;
  text-align: left !important;
  position: absolute !important; /* Position absolutely, just like the button */
  bottom: 25px !important; /* Match button position */
  left: 25px !important; /* Match the content padding */
  margin: 0 !important; /* Remove margins that might affect positioning */
  line-height: 38px !important; /* Match the button height for vertical centering */
  height: 38px !important; /* Set a fixed height equal to button for alignment */
  display: flex !important; /* Use flexbox for vertical alignment */
  align-items: center !important; /* Center text vertically */
}

/* Layout spacing */
.app-academy {
  padding-top: 0;
  margin-top: 0;
}

.dark-card-header {
  margin-top: 10px;
  position: relative !important;
  z-index: 10 !important;
  margin-bottom: 30px !important;
}

/* Responsive styling */
@media (max-width: 1200px) {
  .dark-course-card {
    width: 100% !important; /* Allow width to be responsive */
    max-width: 450px !important; /* But cap at original size */
    height: auto !important; /* Auto height */
    aspect-ratio: 450 / 550; /* Keep aspect ratio */
  }
}

@media (max-width: 768px) {
  .animation-container {
    padding-top: 60px; /* Less padding on mobile but still enough to clear header */
    margin-top: 30px;
    width: 100%; /* Ensure full width */
    overflow-x: hidden; /* Double ensure no horizontal scroll */
  }
  
  .animation-container .glitch-text {
    font-size: 8vw; /* Larger percentage on small screens */
    letter-spacing: 1px; /* Less spacing */
    width: 100%;
    margin: 0 auto;
    overflow: visible;
    white-space: nowrap;
  }
  
  .typing-container {
    margin-top: 5px;
  }
  
  .static-text,
  .typing-text {
    font-size: 1.5rem;
  }
  
  .dark-course-card {
    width: 100%;
    max-width: 450px !important; /* Increased from 395px */
    height: auto !important; /* Auto height */
    aspect-ratio: 450 / 550; /* Keep aspect ratio */
  }

  .course-image {
    height: auto !important; /* Auto height */
    aspect-ratio: 450 / 260; /* Keep aspect ratio */
  }
  
  /* Reduce glitch effect intensity for better readability on mobile */
  .glitch-text::before {
    animation: glitch-anim 5s infinite linear alternate-reverse;
    text-shadow: 0.5px 0 rgba(0, 0, 255, 0.5); /* Reduce blue shadow intensity */
    left: -0.5px; /* Smaller offset */
  }
  
  .glitch-text::after {
    animation: glitch-anim2 4s infinite linear alternate-reverse;
    text-shadow: -0.5px 0 rgba(255, 0, 0, 0.5); /* Reduce red shadow intensity */
    left: 0.5px; /* Smaller offset */
  }
}

@media (max-width: 480px) {
  .animation-container {
    padding: 40px 0 0;
    margin-top: 20px;
    width: 100%;
    overflow-x: hidden;
  }
  
  .dark-theme-wrapper {
    overflow-x: hidden; /* Ensure wrapper also doesn't allow scrolling */
    width: 100%;
    max-width: 100%;
  }
  
  .static-text,
  .typing-text {
    font-size: 1.3rem;
  }
  
  /* Further reduce glitch effect */
  .glitch-text {
    letter-spacing: 0.3px;
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
  }
  
  .glitch-text::before, 
  .glitch-text::after {
    animation-duration: 6s; /* Slower animation */
  }

  .dark-course-card {
    height: auto !important; /* Auto height instead of fixed */
    aspect-ratio: 450 / 550; /* Keep aspect ratio */
  }
  
  /* Adjust button and price for very small screens */
  .action-button {
    padding: 6px 12px !important; /* Even smaller padding */
    font-size: 0.85rem !important; /* Smaller font */
    bottom: 20px !important; /* Move up slightly */
  }
  
  .course-price {
    font-size: 0.85rem; /* Smaller font */
    bottom: 20px !important; /* Move up slightly */
  }
}

@media (max-width: 350px) {
  .animation-container {
    padding: 30px 5px 0;
  }
  
  .glitch-text {
    font-size: clamp(1.5rem, 6vw, 2rem);
    letter-spacing: 0;
    transform: scale(0.95);
    transform-origin: center center;
  }
  
  /* Minimal glitch effect for very small screens */
  .glitch-text::before {
    text-shadow: 0.3px 0 rgba(0, 0, 255, 0.3);
    left: -0.3px;
  }
  
  .glitch-text::after {
    text-shadow: -0.3px 0 rgba(255, 0, 0, 0.3);
    left: 0.3px;
  }
  
  /* Further adjustments for tiny screens */
  .course-content {
    padding: 0 15px !important; /* Less horizontal padding */
    padding-bottom: 60px !important; /* Less padding at bottom */
  }
  
  .course-title {
    margin: 10px 0 5px 0 !important; /* Smaller margins */
    font-size: clamp(0.85rem, 2vw, 1rem) !important; /* Smaller font */
  }
  
  .course-description {
    font-size: clamp(0.7rem, 1.8vw, 0.85rem) !important; /* Smaller font */
    -webkit-line-clamp: 2 !important; /* Only 2 lines on very small screens */
    max-height: calc(1.3em * 2) !important; /* Adjust max height */
  }
  
  .action-button {
    right: 15px !important;
    bottom: 15px !important; /* Move up further */
  }
  
  .course-price {
    left: 15px !important;
    bottom: 15px !important; /* Move up further */
  }
}

@media (max-width: 300px) {
  .animation-container {
    transform: scale(0.95);
    transform-origin: top center;
  }
  
  .animation-container .glitch-text {
    font-size: 12vw;
    transform: scale(0.85);
  }
  
  /* Almost disable glitch effect on tiny screens for better readability */
  .glitch-text::before, 
  .glitch-text::after {
    text-shadow: none;
    animation-play-state: paused;
  }
}

/* Replace glitch effect with the requested code */
.glitch-text {
  position: relative;
  font-family: 'Aenoik', sans-serif;
  font-size: clamp(2rem, 8vw, 8rem); /* Responsive sizing with min/max limits */
  font-weight: 900;
  text-transform: uppercase;
  color: white !important; /* Force white color */
  letter-spacing: 0.5px; /* Reduced letter spacing */
  margin: 0 auto 2rem; /* Center text horizontally */
  padding: 0 10px; /* Add some padding on sides */
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
  z-index: 2;
  white-space: nowrap; /* Force text to stay on one line */
  overflow: visible; /* Allow text to extend beyond container if needed */
  width: 100%;
  display: inline-block; /* Better control over text rendering */
  box-sizing: border-box; /* Include padding in width calculation */
  transform-origin: center center; /* Center any transforms */
  max-width: 100%; /* Ensure text doesn't exceed container */
  -webkit-text-size-adjust: 100%; /* Prevent iOS text size adjustment */
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  color: white !important; /* Ensure white text in pseudo-elements */
  white-space: nowrap; /* Ensure pseudo-elements also stay on one line */
  overflow: visible;
}

/* Add these animation properties to make the glitch effect work */
.glitch-text::before {
  animation: glitch-anim 3s infinite linear alternate-reverse;
  text-shadow: 1px 0 blue;
  left: -1px;
}

.glitch-text::after {
  animation: glitch-anim2 2.5s infinite linear alternate-reverse;
  text-shadow: -1px 0 red;
  left: 1px;
}

@keyframes glitch-anim {
  0% {
    clip: rect(44px, 9999px, 44px, 0);
    transform: skew(0.1deg);
  }
  5% {
    clip: rect(85px, 9999px, 71px, 0);
    transform: skew(0.2deg);
  }
  10% {
    clip: rect(26px, 9999px, 25px, 0);
    transform: skew(0.5deg);
  }
  15% {
    clip: rect(92px, 9999px, 5px, 0);
    transform: skew(0.1deg);
  }
  20% {
    clip: rect(30px, 9999px, 3px, 0);
    transform: skew(0.2deg);
  }
  25% {
    clip: rect(54px, 9999px, 73px, 0);
    transform: skew(0.5deg);
  }
  30% {
    clip: rect(86px, 9999px, 72px, 0);
    transform: skew(0.1deg);
  }
  35% {
    clip: rect(84px, 9999px, 23px, 0);
    transform: skew(0.2deg);
  }
  40% {
    clip: rect(8px, 9999px, 72px, 0);
    transform: skew(0.5deg);
  }
  45% {
    clip: rect(73px, 9999px, 75px, 0);
    transform: skew(0.1deg);
  }
  50% {
    clip: rect(13px, 9999px, 93px, 0);
    transform: skew(0.2deg);
  }
  55% {
    clip: rect(12px, 9999px, 80px, 0);
    transform: skew(0.5deg);
  }
  60% {
    clip: rect(71px, 9999px, 27px, 0);
    transform: skew(0.1deg);
  }
  65% {
    clip: rect(84px, 9999px, 15px, 0);
    transform: skew(0.2deg);
  }
  70% {
    clip: rect(44px, 9999px, 49px, 0);
    transform: skew(0.5deg);
  }
  75% {
    clip: rect(2px, 9999px, 57px, 0);
    transform: skew(0.1deg);
  }
  80% {
    clip: rect(41px, 9999px, 40px, 0);
    transform: skew(0.2deg);
  }
  85% {
    clip: rect(40px, 9999px, 76px, 0);
    transform: skew(0.5deg);
  }
  90% {
    clip: rect(73px, 9999px, 12px, 0);
    transform: skew(0.1deg);
  }
  95% {
    clip: rect(1px, 9999px, 50px, 0);
    transform: skew(0.2deg);
  }
  100% {
    clip: rect(62px, 9999px, 70px, 0);
    transform: skew(0.5deg);
  }
}

@keyframes glitch-anim2 {
  0% {
    clip: rect(99px, 9999px, 62px, 0);
    transform: skew(-0.1deg);
  }
  5% {
    clip: rect(29px, 9999px, 12px, 0);
    transform: skew(-0.3deg);
  }
  10% {
    clip: rect(65px, 9999px, 71px, 0);
    transform: skew(-0.2deg);
  }
  15% {
    clip: rect(6px, 9999px, 88px, 0);
    transform: skew(-0.1deg);
  }
  20% {
    clip: rect(10px, 9999px, 27px, 0);
    transform: skew(-0.3deg);
  }
  25% {
    clip: rect(34px, 9999px, 12px, 0);
    transform: skew(-0.2deg);
  }
  30% {
    clip: rect(73px, 9999px, 54px, 0);
    transform: skew(-0.1deg);
  }
  35% {
    clip: rect(87px, 9999px, 33px, 0);
    transform: skew(-0.3deg);
  }
  40% {
    clip: rect(50px, 9999px, 34px, 0);
    transform: skew(-0.2deg);
  }
  45% {
    clip: rect(50px, 9999px, 64px, 0);
    transform: skew(-0.1deg);
  50% {
    clip: rect(18px, 9999px, 24px, 0);
    transform: skew(-0.3deg);
  }
  55% {
    clip: rect(61px, 9999px, 57px, 0);
    transform: skew(-0.2deg);
  }
  60% {
    clip: rect(100px, 9999px, 20px, 0);
    transform: skew(-0.1deg);
  }
  65% {
    clip: rect(56px, 9999px, 45px, 0);
    transform: skew(-0.3deg);
  }
  70% {
    clip: rect(35px, 9999px, 62px, 0);
    transform: skew(-0.2deg);
  }
  75% {
    clip: rect(87px, 9999px, 3px, 0);
    transform: skew(-0.1deg);
  }
  80% {
    clip: rect(70px, 9999px, 14px, 0);
    transform: skew(-0.3deg);
  }
  85% {
    clip: rect(17px, 9999px, 58px, 0);
    transform: skew(-0.2deg);
  }
  90% {
    clip: rect(22px, 9999px, 59px, 0);
    transform: skew(-0.1deg);
  }
  95% {
    clip: rect(3px, 9999px, 92px, 0);
    transform: skew(-0.3deg);
  }
  100% {
    clip: rect(98px, 9999px, 72px, 0);
    transform: skew(-0.2deg);
  }
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* Animation styles */
.animated-element {
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.animated-element.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Loading indicator */
.loading-indicator {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 200px;
}

.loader {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top: 4px solid var(--light-blue);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Course wrapper with tilt effect */
.course-wrapper {
  position: relative;
  cursor: pointer;
  transition: transform 0.3s ease;
  height: 100%;
}

.course-wrapper:hover {
  transform: translateY(-5px);
}

.tilt-orientation {
  position: absolute;
  width: 33.333%;
  height: 33.333%;
  z-index: 1;
}

/* Fix categories visibility issues */

/* Position button to the right and price to the left - fixed syntax error in comment */
.course-action {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between !important; /* Space between price and button */
  width: 100%;
  padding: 0 !important; /* Remove padding that might interfere with absolute positioning */
  position: absolute !important; /* Position it absolutely within the card */
  bottom: 0 !important; /* Position at bottom */
  left: 0 !important; /* Align to the left edge */
  width: 100% !important; /* Take full width */
  height: 60px !important; /* Set a fixed height for the action area */
}

/* Add an extra breakpoint for very small screens */
@media (max-width: 300px) {
  .animation-container {
    transform: scale(0.95);
    transform-origin: top center;
  }
  
  .animation-container .glitch-text {
    font-size: 12vw;
    transform: scale(0.85);
  }
}

/* Fix scrollbars in course cards - apply aggressive approach */

/* Force no scrollbars on all card elements */
.dark-course-card,
.dark-course-card *,
.course-content,
.course-wrapper {
  overflow: hidden !important;
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* IE and Edge */
}

/* Hide WebKit/Blink scrollbars */
.dark-course-card::-webkit-scrollbar,
.dark-course-card *::-webkit-scrollbar,
.course-content::-webkit-scrollbar,
.course-wrapper::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}

/* Adjust card aspect ratio to be shorter if needed */
.dark-course-card {
  aspect-ratio: 450 / 520 !important; /* Slightly shorter ratio */
}

/* Ensure content is actually visually truncated */
.course-title {
  text-overflow: ellipsis !important;
  white-space: nowrap !important; /* Force single line */
}

.course-description {
  display: block !important; /* Override -webkit-box if that's causing issues */
  max-height: 4em !important; /* Limit to 4 lines maximum */
  text-overflow: ellipsis !important;
  position: relative !important;
}

/* Add fade effect to description bottom to indicate truncation */
.course-description::after {
  content: "" !important;
  position: absolute !important;
  bottom: 0 !important;
  right: 0 !important;
  left: 0 !important;
  height: 1.3em !important; 
  background: linear-gradient(to bottom, rgba(26, 26, 26, 0), rgba(26, 26, 26, 1)) !important;
  pointer-events: none !important;
}

/* Increase button bottom position to allow more content space */
.action-button,
.course-price {
  bottom: 15px !important; /* Move slightly higher */
}

/* Reduce bottom padding to give more space to content */
.course-content {
  padding-bottom: 60px !important; /* Less padding at bottom */
}

/* Mobile optimizations */
@media (max-width: 480px) {
  .course-description {
    max-height: 3em !important; /* Even fewer lines on mobile */
  }
  
  .action-button, 
  .course-price {
    bottom: 10px !important; /* Even higher on mobile */
  }
  
  .course-content {
    padding-bottom: 50px !important; /* Less padding on mobile */
  }
}

/* Add styles for single course per line on mobile */
@media (max-width: 770px) {
  /* Target common grid containers */
  .courses-grid,
  .courses-container,
  .course-list,
  .row,
  [class*="col-"],
  .card-deck,
  .card-columns {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    float: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  
  /* Force course card to take full width */
  .dark-course-card,
  .course-wrapper {
    width: 100% !important;
    max-width: 450px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    float: none !important;
    display: block !important;
  }
  
  /* Ensure grid items take full width */
  .course-item,
  .grid-item,
  [class*="col-"] {
    width: 100% !important;
    flex-basis: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }
  
  /* Add proper spacing between cards */
  .dark-course-card {
    margin-bottom: 30px !important;
  }
  
  /* Improve card positioning on small screens */
  .course-content {
    padding-bottom: 55px !important;
  }
}

/* Adjust course cards to fit full description content */

/* Make cards adapt to content instead of fixed aspect ratio */
.dark-course-card {
  aspect-ratio: unset !important; /* Remove fixed aspect ratio */
  min-height: 500px !important; /* Set minimum height */
  height: auto !important; /* Allow height to grow with content */
}

/* Allow description to show in full without truncation */
.course-description {
  display: block !important; 
  max-height: unset !important; /* Remove height limit */
  -webkit-line-clamp: unset !important; /* Remove line clamp */
  white-space: normal !important; /* Allow text to wrap */
  margin-bottom: 15px !important; /* Add space after description */
  overflow: visible !important; /* Show all content */
}

/* Remove the fade effect at the bottom that was indicating truncation */
.course-description::after {
  display: none !important;
}

/* Create fixed position footer area for buttons in the card */
.course-action {
  background-color: rgba(26, 26, 26, 0.95) !important; /* Slight transparency */
  position: absolute !important;
  bottom: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 60px !important;
  display: flex !important;
  align-items: center !important;
  padding: 0 25px !important;
  box-sizing: border-box !important;
  border-top: 1px solid rgba(255, 255, 255, 0.05) !important; /* Subtle separator */
}

/* Position buttons relative to action area instead of card */
.action-button {
  position: relative !important; /* Change from absolute to relative */
  bottom: unset !important;
  right: unset !important;
  margin: 0 0 0 auto !important; /* Push to right */
}

.course-price {
  position: relative !important; /* Change from absolute to relative */
  bottom: unset !important;
  left: unset !important;
}

/* Adjust content padding to make room for the action area */
.course-content {
  padding-bottom: 75px !important; /* Increase padding to avoid overlap with buttons */
}

/* Make course cards more efficient in mobile view */
@media (max-width: 768px) {
  .dark-course-card {
    min-height: 450px !important; /* Slightly shorter on mobile */
  }
  
  .course-action {
    height: 50px !important; /* Smaller action area on mobile */
    padding: 0 15px !important;
  }
  
  .course-content {
    padding-bottom: 60px !important; /* Adjusted for smaller action area */
  }
}

@media (max-width: 480px) {
  .course-title {
    white-space: normal !important; /* Allow title to wrap on small screens */
    -webkit-line-clamp: 2 !important; /* Show up to 2 lines */
    display: -webkit-box !important;
    -webkit-box-orient: vertical !important;
  }
}

/* Reinforce single card per line on mobile - more specific selectors */
@media (max-width: 770px) {
  /* Target all possible container types with higher specificity */
  body .courses-grid,
  body .courses-container,
  body .course-list,
  body .row,
  body [class*="col-"],
  body .card-deck,
  body .card-group,
  body .card-columns,
  body .grid,
  body .grid-container,
  body .masonry,
  body .courses-section > *,
  body div[class*="courses"] > *,
  body div[class*="course-"] > * {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
    float: none !important;
    grid-template-columns: 1fr !important;
    column-count: 1 !important;
  }
  
  /* Target all possible course card wrappers */
  body .course-wrapper,
  body .course-item,
  body .card-wrapper,
  body [class*="col-"],
  body .grid-item,
  body div[class*="course-item"],
  body div[class*="course-card-wrapper"] {
    width: 100% !important;
    display: block !important;
    float: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
    max-width: 450px !important;
  }
  
  /* Force margin between stacked cards */
  body .dark-course-card {
    margin-bottom: 40px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  
  /* Reset any flexbox or grid settings on parent containers */
  body .courses-row,
  body .card-row,
  body div[class*="courses-"],
  body div[class*="row"] {
    display: block !important;
    flex-wrap: nowrap !important;
    flex-direction: column !important;
    gap: 30px !important;
  }
  
  /* Reset any potentially conflicting Bootstrap grid classes */
  body .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Handle any masonry or grid layouts */
  body .masonry-grid,
  body .grid-layout,
  body div[class*="grid-"] {
    display: block !important;
    column-count: 1 !important;
    column-gap: 0 !important;
  }
}

/* Set navbar color to #121212 */
.layout-navbar,
.layout-navbar.navbar,
nav.layout-navbar,
.layout-navbar.bg-navbar-theme,
.bg-navbar-theme,
.layout-navbar.navbar.bg-navbar-theme {
  background-color: #121212 !important;
  color: white !important;
}

/* Ensure navbar dropdown menus maintain dark theme styling */
.layout-navbar .dropdown-menu {
  background-color: #1A1A1A !important;
  border-color: #2a2a2a !important;
}

/* Maintain dark theme for navbar elements */
.layout-navbar .navbar-nav .nav-link,
.layout-navbar .navbar-brand,
.layout-navbar .app-brand-link {
  color: white !important;
}

/* Prevent any other styling from overriding our navbar color */
html body .layout-navbar {
  background-color: #121212 !important;
  background: #121212 !important;
}

/* Force navbar background color to #121212 with maximum specificity */
#layout-navbar,
#layout-navbar.navbar,
.layout-navbar#layout-navbar,
nav#layout-navbar.layout-navbar.navbar.navbar-expand-xl.align-items-center.bg-navbar-theme,
div.layout-container nav.layout-navbar,
.layout-wrapper .layout-container .layout-navbar,
html body .layout-wrapper .layout-container nav.layout-navbar.navbar {
  background-color: #121212 !important;
  background: #121212 !important;
  background-image: none !important;
  box-shadow: none !important;
}

/* Ensure all elements inside navbar maintain dark theme styling */
#layout-navbar *,
.layout-navbar .container-xxl,
.layout-navbar .navbar-nav > li > a,
.layout-navbar .dropdown-toggle,
.layout-navbar .app-brand-link {
  color: white !important; 
}

/* Add !important to dropdown menu styles */
#layout-navbar .dropdown-menu {
  background-color: #1A1A1A !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

/* Add specific optimization for 1024-1366px screens to prevent button overlapping text */
@media (min-width: 1024px) and (max-width: 1366px) {
  /* Adjust course card content spacing */
  .course-content {
    padding-bottom: 90px !important; /* Increase bottom padding to prevent text overlap with action area */
  }
  
  /* Ensure description has enough room and doesn't get cut off */
  .course-description {
    margin-bottom: 25px !important; /* More space below description */
    max-height: unset !important; /* Allow description to take needed space */
    display: block !important; /* Ensure proper display */
  }
  
  /* Position action area with more clearance */
  .course-action {
    height: 70px !important; /* Taller action area */
  }
  
  /* Make sure the card height accommodates all content */
  .dark-course-card {
    min-height: 520px !important; /* Ensure enough height */
  }
  
  /* If text is still being cut off, limit description length */
  .course-description {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 5 !important; /* Show up to 5 lines of description */
    -webkit-box-orient: vertical !important;
  }
}

/* Completely redesigned optimization for 1024-1366px screens */
@media (min-width: 1024px) and (max-width: 1366px) {
  /* Force taller cards in this specific range */
  .dark-course-card {
    min-height: 580px !important; /* Much taller minimum height */
    height: auto !important;
    max-height: none !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  /* Make the content area take available space */
  .course-content {
    padding-bottom: 100px !important; /* Much more padding at bottom */
    flex: 1 0 auto !important; /* Take available space */
  }
  
  /* Ensure the description is properly contained */
  .course-description {
    margin-bottom: 35px !important; /* Much more space below description */
    max-height: 12em !important; /* Allow more height for description */
    overflow: hidden !important;
  }
  
  /* Position action area with more clearance */
  .course-action {
    height: 80px !important; /* Taller action area */
    border-top: 2px solid rgba(255, 255, 255, 0.08) !important; /* More visible separator */
    bottom: 0 !important;
    position: absolute !important;
  }
  
  /* Adjust course image to be proportionally sized */
  .course-image {
    height: auto !important;
    max-height: 220px !important;
    min-height: 180px !important;
  }
  
  /* Specifically position the button and price with more clearance */
  .action-button, .course-price {
    height: auto !important;
    line-height: normal !important;
    margin-top: 5px !important;
    margin-bottom: 5px !important;
  }
}

/* Add some debugging styles to be removed later */
@media (min-width: 1024px) and (max-width: 1366px) {
  /* Add a subtle border to help visualize card dimensions */
  .dark-course-card {
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2) !important;
  }
}


.course-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 395px;
  background: #1A1A1A;
  box-shadow: 2px 1px 37px rgba(0, 0, 0, 0.09);
  border-radius: 16px;
  padding: 0px; /* No extra padding on the card itself */
  height: auto; /* Allow the card height to be auto-sized based on content */
}

/* Image */
/* Image */
.course-card__image {
  width: 100%;
  height: auto;  /* Let the height be auto and scale with the aspect ratio */
  max-height: 300px;  /* Adjust the max-height for larger screens */
  background-size: cover;
  background-position: center;
  border-radius: 8px 8px 0px 0px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

/* Ensuring the image properly fits within the space */
.course-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 8px 8px 0px 0px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .course-card__image {
      height: 50vw;  /* Adjust the height for mobile devices */
      max-height: none;  /* Remove max-height on smaller screens */
  }
}

/* Contenu du cours */
.course-card__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 16px;
  width: 100%;
  flex-grow: 0; /* Do not expand the content */
}

/* Titre */
.course-card__title {
  font-family: 'Poppins';
  font-size: 18px;
  line-height: 27px;
  color: #FFFFFF;
  width: 100%;
}

/* Informations (enseignant, participants, avis) */
.course-card__info {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

.course-card__info-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #FFFFFF;
}

/* Description */
.course-card__description {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 300;
  color: #FFFFFF;
}

/* Pied de carte (prix + bouton) */
.course-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 10px 16px;
  gap: 10px;
  margin-top: 0; /* Removed margin-top to avoid unnecessary spacing */
}

/* Prix */
.course-card__price {
  display: flex;
  align-items: center;
  gap: 7px;
}

.course-card__current-price {
  font-family: 'Poppins', sans-serif;
  font-size: 18px;
  font-weight: 500;
  color: #FFFFFF;
}

.course-card__old-price {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #FF5353;
  text-decoration: line-through;
}

/* Bouton */
.course-card__cta {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.19);
  border: 1px solid #FFFFFF;
  box-shadow: 0px 0px 4px rgba(224, 224, 224, 0.25);
  border-radius: 13px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #FFFFFF;
  cursor: pointer;
  transition: background 0.3s ease-in-out;
}

.course-card__cta:hover {
  background: rgba(255, 255, 255, 0.3);
}

