/* AI Projects Section - Advanced Modern UI with Full Image Modal */

/* Main Container */
.ai-projects {
  position: relative;
  background: #000000;
  padding: 120px 0;
  color: #ffffff;
  overflow: hidden;
  min-height: 100vh;
}

/* Neural Network Background Effect */
.neural-network-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.1;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle at 50% 50%, rgba(180, 44, 29, 0.15) 0%, transparent 70%);
  animation: pulse 12s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.1; }
  50% { transform: scale(1.2); opacity: 0.15; }
}

/* Section Header */
.ai-projects .section-header {
  position: relative;
  margin-bottom: 80px;
  text-align: center;
  z-index: 1;
}

.ai-projects .section-title {
  font-size: 3.5rem;
  font-weight: 900;
  margin-bottom: 20px;
  background: linear-gradient(90deg, #b42c1d, #ff7e5f, #feb47b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  letter-spacing: 3px;
  position: relative;
  display: inline-block;
  text-shadow: 0 0 20px rgba(180, 44, 29, 0.5);
  animation: glow 3s ease-in-out infinite alternate;
}

@keyframes glow {
  0% { text-shadow: 0 0 20px rgba(180, 44, 29, 0.5); }
  100% { text-shadow: 0 0 30px rgba(255, 126, 95, 0.7); }
}

.ai-projects .section-title::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 5px;
  background: linear-gradient(90deg, #b42c1d, #ff7e5f);
  border-radius: 3px;
  box-shadow: 0 0 15px rgba(180, 44, 29, 0.5);
}

.ai-projects .section-subtitle {
  max-width: 900px;
  margin: 25px auto 0;
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.7;
  font-weight: 300;
}

/* Project Cards Container */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 40px;
  position: relative;
  z-index: 1;
  max-width: 1920px;
  margin: 0 auto;
  padding: 0 20px;
}

/* AI Project Card */
.ai-project-card {
  position: relative;
  background: rgba(20, 20, 20, 0.85);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
  transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
  min-height: 480px; /* Changed from fixed height to min-height */
  border: 1px solid rgba(180, 44, 29, 0.4);
  display: flex;
  flex-direction: column;
}

.ai-project-card:hover {
  transform: translateY(-20px) scale(1.02);
  box-shadow: 0 25px 50px rgba(180, 44, 29, 0.5);
  border-color: rgba(180, 44, 29, 0.8);
}

/* Project Image Container */
.project-image-container {
  position: relative;
  height: 240px;
  overflow: visible;
  z-index: 1;
}

.project-image-container::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.7) 100%);
  transition: all 0.4s ease;
  z-index: 2;
}

.project-image-container:hover::after {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 60%, rgba(0, 0, 0, 0.5) 100%);
}

/* Magnifying Glass Icon */
.magnify-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  color: #ffffff;
  font-size: 2rem;
  opacity: 0;
  transition: all 0.4s ease;
  z-index: 3;
  text-shadow: 0 3px 6px rgba(0, 0, 0, 0.6);
  cursor: pointer;
}

.project-image-container:hover .magnify-icon {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.project-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
  cursor: pointer;
  position: relative;
  z-index: 1;
}

.ai-project-card:hover .project-image {
  transform: scale(1.15);
}

/* Project Type Badge */
.project-type {
  position: absolute;
  top: 20px;
  right: 20px;
  background: linear-gradient(90deg, #b42c1d, #ff7e5f);
  color: #ffffff;
  padding: 8px 16px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 700;
  z-index: 4;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease;
}

.ai-project-card:hover .project-type {
  transform: scale(1.1);
}

/* Project Content */
.project-content {
  padding: 30px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 2;
  min-height: 0; /* Prevent overflow in flex container */
}

.project-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 12px;
  color: #ffffff;
  line-height: 1.4;
  transition: color 0.3s ease;
}

.ai-project-card:hover .project-title {
  color: #ff7e5f;
}

.project-description {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 20px;
  line-height: 1.6;
  flex-grow: 1;
  overflow: hidden; /* Prevent description from overflowing */
}

/* Tech Stack Tags */
.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px; /* Reduced to ensure space for project-links */
}

/* Ensure tech tags don't overflow */
.tech-tag {
  background: rgba(0, 0, 0, 0.4);
  color: #ffffff;
  padding: 6px 14px;
  border-radius: 25px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  border: 1px solid rgba(180, 44, 29, 0.4);
}

.ai-project-card:hover .tech-tag {
  background: rgba(180, 44, 29, 0.3);
  border-color: rgba(180, 44, 29, 0.7);
  transform: translateY(-2px);
}

/* Project Links */
.project-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0; /* Prevent shrinking to ensure button visibility */
  margin-top: auto; /* Push to bottom of project-content */
}

.github-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1rem;
  padding: 10px 20px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(180, 44, 29, 0.3), rgba(255, 126, 95, 0.3));
  border: 1px solid rgba(180, 44, 29, 0.5);
  transition: all 0.4s ease;
}

.github-link:hover {
  background: linear-gradient(90deg, rgba(180, 44, 29, 0.6), rgba(255, 126, 95, 0.6));
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(180, 44, 29, 0.4);
}

.github-link i {
  font-size: 1.2rem;
}

/* Advanced AI Animation Effects */
.ai-glow {
  position: absolute;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(180, 44, 29, 0.5) 0%, rgba(180, 44, 29, 0) 70%);
  filter: blur(30px);
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: none;
}

.ai-project-card:hover .ai-glow {
  opacity: 0.8;
  transform: scale(1.2);
}

.ai-glow.top-left {
  top: -75px;
  left: -75px;
}

.ai-glow.bottom-right {
  bottom: -75px;
  right: -75px;
}

/* Dynamic Neural Network Lines */
.neural-lines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
  background-image: 
    linear-gradient(45deg, rgba(180, 44, 29, 0.15) 1px, transparent 1px),
    linear-gradient(-45deg, rgba(180, 44, 29, 0.15) 1px, transparent 1px);
  background-size: 30px 30px;
  animation: neural-flow 10s linear infinite;
}

@keyframes neural-flow {
  0% { background-position: 0 0; }
  100% { background-position: 60px 60px; }
}

.ai-project-card:hover .neural-lines {
  opacity: 0.5;
}

/* Featured Project */
.featured-project {
  grid-column: span 2;
  min-height: 520px; /* Adjusted for featured project */
  background: linear-gradient(135deg, rgba(20, 20, 20, 0.9), rgba(50, 50, 50, 0.9));
}

.featured-project .project-image-container {
  height: 360px;
}

.featured-project .project-content {
  padding: 40px;
}

.featured-project .project-title {
  font-size: 2.2rem;
}

.featured-project .project-description {
  font-size: 1.2rem;
}

.featured-badge {
  position: absolute;
  top: 20px;
  left: 20px;
  background: linear-gradient(90deg, #b42c1d, #ff7e5f);
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 25px;
  font-size: 0.9rem;
  font-weight: 700;
  z-index: 4;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 6px;
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.featured-badge i {
  font-size: 1rem;
}

/* Full Image Modal */
.image-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-modal.active {
  display: flex;
  opacity: 1;
}

.image-modal img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(180, 44, 29, 0.5);
}

.image-modal .close-modal {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #ffffff;
  font-size: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.image-modal .close-modal:hover {
  color: #ff7e5f;
  transform: scale(1.1);
}

/* Mobile Projects Carousel */
.mobile-projects-carousel {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 20px 0;
  display: none;
}

.carousel-container {
  display: flex;
  transition: transform 0.4s cubic-bezier(0.215, 0.610, 0.355, 1.000);
}

.carousel-slide {
  flex: 0 0 90%;
  max-width: 350px;
  margin: 0 15px;
}

.carousel-controls {
  display: flex;
  justify-content: center;
  margin-top: 30px;
  gap: 20px;
}

.carousel-btn {
  background: rgba(20, 20, 20, 0.8);
  color: #ffffff;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.carousel-btn:hover {
  background: rgba(180, 44, 29, 0.8);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(180, 44, 29, 0.3);
}

.carousel-dots {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  gap: 8px;
}

.carousel-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  transition: all 0.3s ease;
}

.carousel-dot.active {
  background: #b42c1d;
  transform: scale(1.2);
}

/* View All Projects Button */
.view-all-projects {
  display: flex;
  justify-content: center;
  margin-top: 70px;
}

.view-all-btn {
  background: linear-gradient(90deg, rgba(20, 20, 20, 0.9), rgba(50, 50, 50, 0.9));
  color: #ffffff;
  border: 2px solid rgba(180, 44, 29, 0.6);
  border-radius: 35px;
  padding: 15px 40px;
  font-size: 1.1rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.4s ease;
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.view-all-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #b42c1d, #ff7e5f);
  z-index: -1;
  transition: left 0.4s ease;
}

.view-all-btn:hover::before {
  left: 0;
}

.view-all-btn:hover {
  transform: translateY(-7px);
  box-shadow: 0 12px 25px rgba(180, 44, 29, 0.4);
  border-color: transparent;
}

/* Large Screen Optimizations */
@media (min-width: 1920px) {
  .ai-projects {
    padding: 150px 0;
  }

  .ai-projects .section-title {
    font-size: 4rem;
  }

  .ai-projects .section-subtitle {
    font-size: 1.5rem;
    max-width: 1000px;
  }

  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 50px;
  }

  .ai-project-card {
    min-height: 520px; /* Adjusted for larger screens */
  }

  .project-image-container {
    height: 260px;
  }

  .project-content {
    padding: 35px;
  }

  .project-title {
    font-size: 1.8rem;
  }

  .project-description {
    font-size: 1.1rem;
  }

  .tech-tag {
    font-size: 0.9rem;
    padding: 8px 16px;
  }

  .github-link {
    font-size: 1.1rem;
    padding: 12px 24px;
  }

  .featured-project .project-image-container {
    height: 400px;
  }

  .featured-project .project-title {
    font-size: 2.5rem;
  }

  .featured-project .project-description {
    font-size: 1.3rem;
  }

  .view-all-btn {
    padding: 18px 50px;
    font-size: 1.2rem;
  }
}

/* Original Responsive Design for Small Screens and Tablets */
@media (max-width: 1200px) {
  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
  
  .featured-project {
    grid-column: auto;
    min-height: 480px; /* Ensure consistent height */
  }
  
  .featured-project .project-image-container {
    height: 200px;
  }
}

@media (max-width: 992px) {
  .ai-projects .section-title {
    font-size: 2.4rem;
  }
  
  .projects-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .projects-grid {
    display: none;
  }
  
  .mobile-projects-carousel {
    display: block;
  }
  
  .ai-projects .section-title {
    font-size: 2rem;
  }
  
  .ai-projects .section-subtitle {
    font-size: 1rem;
  }
  
  .carousel-slide .ai-project-card {
    min-height: 400px; /* Adjusted for mobile carousel */
  }
}

@media (max-width: 576px) {
  .ai-projects {
    padding: 70px 0;
  }
  
  .ai-projects .section-title {
    font-size: 1.8rem;
  }
  
  .carousel-slide {
    flex: 0 0 95%;
  }
  
  .project-title {
    font-size: 1.2rem;
  }
  
  .project-description {
    font-size: 0.9rem;
  }
}