/* ===========================
   OPTION 1: EQUAL HEIGHT CARDS (RECOMMENDED)
   =========================== */

.resources-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px auto;
    max-width: 1100px;
    align-items: start; /* ✅ Align cards to top */
}

.resource-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%; /* ✅ Make all cards same height */
    min-height: 500px; /* ✅ Set minimum height */
}

.resource-card:hover {
    transform: translateY(-5px);
}

/* ✅ FIXED MEDIA CONTAINER HEIGHTS */
.resource-image,
.resource-img,
.resource-card iframe,
.resource-pdf {
    width: 100%;
    height: 220px; /* ✅ Fixed height for all media */
    object-fit: cover;
    flex-shrink: 0; /* ✅ Prevent shrinking */
}

.resource-pdf-frame {
    width: 100%;
    height: 220px !important; /* ✅ Override inline styles */
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    background: #f8f9fa;
}

.resource-content {
    padding: 1.5rem;
    flex-grow: 1; /* ✅ Fill remaining space */
    display: flex;
    flex-direction: column;
}

.resource-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
    line-height: 1.4;
    min-height: 2.8em; /* ✅ Reserve space for 2 lines */
}

.resource-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
    flex-grow: 1; /* ✅ Fill remaining space */
    display: -webkit-box;
    -webkit-line-clamp: 4; /* ✅ Limit to 4 lines */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.resource-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #E94D4E;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s ease;
    margin-top: auto; /* ✅ Push to bottom */
    align-self: flex-start; /* ✅ Don't stretch full width */
}

.resource-tags {
    margin: 15px 0;
    margin-left: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 35px; /* ✅ Reserve space for tags */
}

/* ===========================
   OPTION 2: FIXED ASPECT RATIO
   =========================== */

/* Uncomment this section if you prefer fixed aspect ratio cards */

/*
.resource-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    aspect-ratio: 3/4; /* ✅ Fixed 3:4 aspect ratio 
    height: auto;
}
*/

/* ===========================
   OPTION 3: MASONRY LAYOUT WITH EQUAL WIDTHS
   =========================== */

/* Uncomment this section for masonry-style layout */

/*
.resources-grid {
    column-count: 3;
    column-gap: 20px;
    margin: 20px auto;
    max-width: 1100px;
}

.resource-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    display: inline-block;
    width: 100%;
    margin-bottom: 20px;
    break-inside: avoid;
}
*/

/* ===========================
   OPTION 4: TRUNCATED CONTENT (STRICT UNIFORMITY)
   =========================== */

/* Uncomment this section for extremely uniform cards */

/*
.resource-card {
    background: #fff;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 480px; /* ✅ Fixed height for all cards 
}

.resource-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #333;
    height: 60px; /* ✅ Fixed title height 
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.resource-description {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1rem;
    height: 96px; /* ✅ Fixed description height (4 lines) 
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}
*/

/* ===========================
   RESPONSIVE ADJUSTMENTS (FOR ALL OPTIONS)
   =========================== */

@media (max-width: 992px) {
    .resources-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 800px;
    }
}

@media (max-width: 768px) {
    .resources-grid {
        grid-template-columns: 1fr;
        padding: 1rem;
        max-width: 500px;
    }
    
    .resource-card {
        min-height: 400px; /* ✅ Reduce min-height on mobile */
    }
    
    .resource-image,
    .resource-img,
    .resource-card iframe,
    .resource-pdf-frame {
        height: 180px; /* ✅ Reduce media height on mobile */
    }
}

@media (max-width: 480px) {
    .resource-card {
        min-height: 350px;
    }
    
    .resource-image,
    .resource-img,
    .resource-card iframe,
    .resource-pdf-frame {
        height: 160px;
    }
    
    .resource-content {
        padding: 1rem;
    }
}

.resources-header {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, #0d1117, #0f2a52);
    color: white;
}

.resources-header h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.resources-header p {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.9;
}

.pagination {
    text-align: center;
    margin: 30px 0;
}
.pagination a {
    padding: 8px 15px;
    margin: 3px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
}
.pagination a.active {
    background: #667eea;
    color: white;
    font-weight: bold;
}
.pagination a:hover {
    background: #764ba2;
    color: white;
}

.pdf-slider-section {
    max-width: 1100px;
    margin: 50px auto;
    text-align: center;
}

.pdf-heading {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 20px;
    color: #333;
}

.pdfSwiper {
    width: 100%;
    padding: 20px;
}

.swiper-slide {
    background: #f8f9fa;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* PDF Preview */
.resource-pdf {
    margin: 15px 0;
    text-align: center;
}

.resource-pdf-frame {
    width: 100%;
    height: 380px;  /* fixed height like a video */
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    overflow: hidden;
    background: #f8f9fa;
}

/* -------- Search Bar -------- */
.search-bar {
    margin: 30px auto;
    max-width: 600px;
    text-align: center;
}

.search-bar form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.search-bar input[type="text"] {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
}

.search-bar input[type="text"]:focus {
    border-color: #3498db;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.3);
}

.search-bar button {
    padding: 12px 20px;
    background: #E94D4E;
    border: none;
    color: white;
    font-size: 15px;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.search-bar button:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

/* -------- Tags -------- */
.resource-tags {
    margin: 15px 0;
    margin-left: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.resource-tags .tag {
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 20px;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.resource-tags .tag:hover {
    background: linear-gradient(135deg, #2575fc 0%, #6a11cb 100%);
    transform: translateY(-2px);
}

/* Responsive adjustments */
@media (max-width: 600px) {
    .search-bar form {
        flex-direction: column;
    }

    .search-bar input[type="text"],
    .search-bar button {
        width: 100%;
    }
}

/* Tags Section */
.tags-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.tag {
    padding: 6px 14px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 20px;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.tag:hover {
    background: linear-gradient(135deg, #2575fc 0%, #6a11cb 100%);
    transform: translateY(-2px);
}

/* ===========================
 /* ===========================
   Featured Blogs Section - FIXED
   =========================== */
.featured-slider-section {
  text-align: center;
  padding: 40px 20px;
  background: #f7f9fc;
}

.featured-heading {
  font-size: 26px;
  margin-bottom: 18px;
  color: #2c3e50;
  font-weight: 700;
}

.featured-slider {
  position: relative;
  overflow: hidden;
  width: min(95vw, 1000px);
  margin: 0 auto;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

.featured-track {
  display: flex;
  transition: transform 0.55s ease;
}

.featured-slide {
  display: flex;
  justify-content: flex-start;  /* ✅ Changed from center to flex-start for left alignment */
  flex-wrap: wrap;
  gap: 15px;
  min-width: 100%;
  box-sizing: border-box;
  padding: 20px; /* ✅ Added padding for better spacing */
}

.featured-card {
  flex: 1 1 calc(33.333% - 10px);   /* ✅ Better flex calculation for 3 per row */
  max-width: calc(33.333% - 10px);
  min-width: 280px; /* ✅ Added min-width to prevent cards from getting too small */
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  padding: 15px; /* ✅ Increased padding for better spacing */
  display: flex;
  flex-direction: column;
  align-items: stretch; /* ✅ Changed from left to stretch for consistent card heights */
  overflow: hidden; /* ✅ Added to prevent content overflow */
}

.featured-card img,
.featured-card .video-wrapper,
.featured-card .pdf-wrapper {
  width: 100%;
  height: 200px; /* ✅ Fixed height to prevent layout shifts */
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 15px; /* ✅ Increased margin for better spacing */
  flex-shrink: 0; /* ✅ Prevent shrinking */
}

.featured-card .video-wrapper iframe,
.featured-card .pdf-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 10px;
}

.featured-title {
  font-size: 16px;
  font-weight: 600;
  text-align: left;
  margin-top: auto;
  line-height: 1.4; /* ✅ Added line-height for better readability */
  padding-top: 10px; /* ✅ Added padding to separate from content above */
}

.featured-title a {
  color: #2c3e50;
  text-decoration: none;
  transition: color 0.3s ease;
  display: block; /* ✅ Make link block level for better click area */
}

.featured-title a:hover {
  color: #e74c3c;
}

.slider-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #f44369;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .2s ease, transform .2s ease;
  z-index: 5;
}

.slider-btn:hover { 
  background: rgba(0,0,0,.75); 
  transform: translateY(-50%) scale(1.04); 
}

.slider-btn.prev { 
  left: 12px; 
}

.slider-btn.next { 
  right: 12px; 
}

/* ✅ IMPROVED RESPONSIVE DESIGN */

/* Large tablets and small desktops (992px - 1200px) */
@media (max-width: 1200px) {
  .featured-card {
    flex: 1 1 calc(33.333% - 10px);
    max-width: calc(33.333% - 10px);
  }
}

/* Tablets (768px - 992px) - 2 cards per row */
@media (max-width: 992px) {
  .featured-card {
    flex: 1 1 calc(50% - 15px);
    max-width: calc(50% - 15px);
    min-width: 250px;
  }
  
  .featured-slide {
    padding: 15px;
    gap: 15px;
  }
}

/* Small tablets and large phones (600px - 768px) */
@media (max-width: 768px) {
  .featured-card {
    flex: 1 1 calc(50% - 10px);
    max-width: calc(50% - 10px);
    min-width: 220px;
    padding: 12px;
  }
  
  .featured-card img,
  .featured-card .video-wrapper,
  .featured-card .pdf-wrapper {
    height: 160px; /* ✅ Reduced height for smaller screens */
    margin-bottom: 12px;
  }
  
  .featured-title {
    font-size: 14px;
  }
  
  .featured-heading { 
    font-size: 22px; 
  }
}

/* Mobile (up to 600px) - 1 card per row */
@media (max-width: 600px) {
  .featured-card {
    flex: 1 1 100%;
    max-width: 100%;
    min-width: unset;
    margin: 0 auto; /* ✅ Center single cards on mobile */
    max-width: 350px; /* ✅ Limit max width on mobile */
  }
  
  .featured-slide {
    padding: 10px;
    justify-content: center; /* ✅ Center align on mobile for single cards */
  }
  
  .featured-card img,
  .featured-card .video-wrapper,
  .featured-card .pdf-wrapper {
    height: 180px;
  }
  
  .featured-heading { 
    font-size: 20px; 
    margin-bottom: 15px;
  }
  
  .slider-btn {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }
  
  .slider-btn.prev { 
    left: 8px; 
  }
  
  .slider-btn.next { 
    right: 8px; 
  }
}

/* Extra small screens (up to 400px) */
@media (max-width: 400px) {
  .featured-slider-section {
    padding: 30px 15px;
  }
  
  .featured-card {
    padding: 10px;
  }
  
  .featured-card img,
  .featured-card .video-wrapper,
  .featured-card .pdf-wrapper {
    height: 150px;
    margin-bottom: 10px;
  }
  
  .featured-title {
    font-size: 13px;
    padding-top: 8px;
  }
}