.project-card {
  transition: opacity 0.4s ease, transform 0.4s ease;
  opacity: 1;
  transform: scale(1);
}

.project-card.fade-out {
  opacity: 0;
  transform: scale(0.9);
  pointer-events: none;
}

.project-card.hidden {
  display: none;
}

/* 🔥 Smooth fade-up when showing */
@keyframes fadeUp {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.project-card.fade-up {
  animation: fadeUp 0.5s ease forwards;
}

.projects-section {
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a3a 100%);
  border-radius: 20px;
  padding: 4rem 2rem;
  position: relative;
}

.projects-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
      circle at 20% 20%,
      rgba(102, 126, 234, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 80%,
      rgba(118, 75, 162, 0.1) 0%,
      transparent 50%
    );
  pointer-events: none;
  border-radius: 20px;
}

.section-title {
  font-size: 3.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
  animation: fadeInUp 0.8s ease-out;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 4px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 2px;
  animation: expandWidth 1s ease-out 0.5s both;
}

.filter-buttons {
  display: flex;
  justify-content: flex-start;
  gap: 1rem;
  margin: 3rem 0 4rem;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  padding: 10px 0;
  position: sticky;
  top: 80px; /* Adjust based on your header height */
  background: rgba(15, 15, 35, 0.95);
  z-index: 100;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #667eea rgba(255, 255, 255, 0.1);
  animation: fadeInUp 0.8s ease-out 0.2s both;
  backdrop-filter: blur(20px);
  border-radius: 15px;
}

.filter-buttons::-webkit-scrollbar {
  height: 6px;
}

.filter-buttons::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.filter-buttons::-webkit-scrollbar-thumb {
  background: #667eea;
  border-radius: 10px;
}

.filter-buttons::-webkit-scrollbar-thumb:hover {
  background: #5a52d5;
}

.filter-buttons button {
  padding: 12px 28px;
  border: 2px solid rgba(102, 126, 234, 0.3);
  background: rgba(15, 15, 35, 0.8);
  color: #ffffff;
  border-radius: 50px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(20px);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  min-width: fit-content;
  white-space: nowrap;
  margin-top: 25px;
}

.filter-buttons button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(102, 126, 234, 0.2),
    transparent
  );
  transition: left 0.6s;
}

.filter-buttons button:hover::before {
  left: 100%;
}

.filter-buttons button:hover,
.filter-buttons button.active {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.15);
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(102, 126, 234, 0.25);
}

.projects-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2.5rem;
  position: relative;
  margin-bottom: 4rem;
}

.project-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 20px;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(20px);
  position: relative;
  opacity: 1;
  transform: translateY(0);
  animation: fadeInUp 0.6s ease-out forwards;
}

.project-card:nth-child(1) {
  animation-delay: 0.1s;
}
.project-card:nth-child(2) {
  animation-delay: 0.2s;
}
.project-card:nth-child(3) {
  animation-delay: 0.3s;
}
.project-card:nth-child(4) {
  animation-delay: 0.4s;
}
.project-card:nth-child(5) {
  animation-delay: 0.5s;
}
.project-card:nth-child(6) {
  animation-delay: 0.6s;
}
.project-card:nth-child(7) {
  animation-delay: 0.7s;
}

.project-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(102, 126, 234, 0.1) 0%,
    rgba(118, 75, 162, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.project-card:hover::before {
  opacity: 1;
}

.project-card:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
  border-color: rgba(102, 126, 234, 0.4);
}

.project-card img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  transition: transform 0.4s ease;
  position: relative;
  z-index: 2;
}

.project-card:hover img {
  transform: scale(1.05);
}

.project-content {
  padding: 2rem;
  position: relative;
  z-index: 3;
}

.project-content h3 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #ffffff;
  line-height: 1.3;
}

.project-content p {
  color: #b0b0b0;
  line-height: 1.6;
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.project-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.project-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 12px 24px;
  color: white;
  text-decoration: none;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 0.9rem;
  background: none;
}

.project-btn.primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.project-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(102, 126, 234, 0.3);
}

.project-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
}

.project-btn.secondary:hover {
  background: rgba(102, 126, 234, 0.2);
  border-color: #667eea;
}

.project-btn::after {
  content: "→";
  transition: transform 0.3s ease;
}

.project-btn:hover::after {
  transform: translateX(4px);
}

.project-btn.details-btn::after {
  content: "↗";
}

/* GitHub Section */
.github-section {
  text-align: center;
  margin-top: 3rem;
  padding: 2rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
}

.github-title {
  font-size: 1.8rem;
  color: white;
  margin-bottom: 1rem;
  font-weight: 700;
}

.github-description {
  color: #b0b0b0;
  margin-bottom: 2rem;
  font-size: 1.1rem;
  line-height: 1.6;
}

.github-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 15px 35px;
  background: linear-gradient(135deg, #333 0%, #555 100%);
  color: white;
  text-decoration: none;
  border-radius: 30px;
  font-weight: 600;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.github-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
  background: linear-gradient(135deg, #24292e 0%, #444 100%);
  border-color: rgba(255, 255, 255, 0.2);
}

.github-btn i {
  font-size: 1.3rem;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes expandWidth {
  from {
    width: 0;
  }
  to {
    width: 80px;
  }
}

/* Mobile Responsive */
@media (max-width: 968px) {
  .projects-section {
    padding: 3rem 1.5rem;
  }

  .section-title {
    font-size: 3rem;
  }

  .projects-container {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
  }
}

@media (max-width: 768px) {
  .projects-section {
    padding: 2.5rem 1.5rem;
    border-radius: 15px;
  }

  .section-title {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
  }

  .section-title::after {
    width: 60px;
    height: 3px;
  }

  .filter-buttons {
    gap: 0.8rem;
    margin: 2rem 0 3rem;
    top: 70px;
    padding: 8px 0;
  }

  .filter-buttons button {
    padding: 10px 20px;
    font-size: 0.9rem;
    margin-top: 5px;
  }

  .projects-container {
    grid-template-columns: 1fr;
    gap: 1.8rem;
    margin-bottom: 3rem;
  }

  .project-card {
    margin: 0 auto;
    max-width: 450px;
  }

  .project-card img {
    height: 200px;
  }

  .project-content {
    padding: 1.5rem;
  }

  .project-content h3 {
    font-size: 1.3rem;
    margin-bottom: 0.8rem;
  }

  .project-content p {
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
  }

  .project-buttons {
    flex-direction: column;
    gap: 0.8rem;
  }

  .project-btn {
    padding: 12px 20px;
    font-size: 0.9rem;
    justify-content: center;
    text-align: center;
  }

  .github-section {
    margin-top: 2rem;
    padding: 1.5rem;
  }

  .github-title {
    font-size: 1.5rem;
  }

  .github-description {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }

  .github-btn {
    padding: 12px 28px;
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .projects-section {
    padding: 2rem 1rem;
  }

  .section-title {
    font-size: 2rem;
  }

  .filter-buttons {
    gap: 0.6rem;
    margin: 1.5rem 0 2.5rem;
    top: 60px;
    padding: 8px 5px;
  }

  .filter-buttons button {
    padding: 10px 20px;
    font-size: 0.85rem;
    margin-top: 5px;
  }

  .project-card {
    max-width: 100%;
  }

  .project-card img {
    height: 180px;
  }

  .project-content {
    padding: 1.2rem;
  }

  .project-content h3 {
    font-size: 1.2rem;
  }

  .project-content p {
    font-size: 0.9rem;
  }

  .project-btn {
    padding: 10px 18px;
    font-size: 0.85rem;
  }

  .github-section {
    padding: 1.2rem;
  }

  .github-btn {
    padding: 10px 24px;
    font-size: 0.95rem;
    gap: 0.6rem;
  }

  .github-btn i {
    font-size: 1.1rem;
  }
}

@media (max-width: 320px) {
  .projects-section {
    padding: 1.5rem 0.8rem;
  }

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

  .project-card img {
    height: 160px;
  }

  .project-content {
    padding: 1rem;
  }

  .project-buttons {
    gap: 0.6rem;
  }

  .project-btn {
    padding: 8px 16px;
    font-size: 0.8rem;
  }
}
