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

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

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

/* Animation Classes */
.animate-fade-in-up {
  animation: fadeInUp 1s ease-out;
}

.animate-fade-in-down {
  animation: fadeInDown 1s ease-out;
}

.animate-fade-in-left {
  animation: fadeInLeft 1s ease-out;
}

.animate-fade-in-right {
  animation: fadeInRight 1s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.8s ease-out;
}

.animate-slide-in-up {
  animation: slideInUp 0.8s ease-out;
}

/* Scroll Reveal Animation */
.scroll-reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger Children Animation */
.stagger-children > * {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-children.active > *:nth-child(1) {
  transition-delay: 0.1s;
}
.stagger-children.active > *:nth-child(2) {
  transition-delay: 0.2s;
}
.stagger-children.active > *:nth-child(3) {
  transition-delay: 0.3s;
}
.stagger-children.active > *:nth-child(4) {
  transition-delay: 0.4s;
}
.stagger-children.active > *:nth-child(5) {
  transition-delay: 0.5s;
}
.stagger-children.active > *:nth-child(6) {
  transition-delay: 0.6s;
}

.stagger-children.active > * {
  opacity: 1;
  transform: translateY(0);
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.dark ::-webkit-scrollbar-track {
  background: #1f2937;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3b82f6, #8b5cf6);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #2563eb, #7c3aed);
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Card Hover Effects */
.card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.dark .card-hover:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* Glassmorphism Effect */
.glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.dark .glass {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Floating Animation */
@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-20px);
  }
}

.float-animation {
  animation: float 3s ease-in-out infinite;
}

/* Pulse Animation for Icons */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

.pulse-animation {
  animation: pulse 2s ease-in-out infinite;
}

/* Project Card Styles */
.project-card {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.1) 0%,
    rgba(139, 92, 246, 0.1) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.project-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.dark .project-card:hover {
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

/* Button Hover Effects */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
  width: 300px;
  height: 300px;
}

/* Loading Animation */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner {
  animation: spin 1s linear infinite;
}

/* Section Divider */
.section-divider {
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    #3b82f6,
    #8b5cf6,
    transparent
  );
}

/* Responsive Typography */
@media (max-width: 768px) {
  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 2rem;
  }

  h3 {
    font-size: 1.5rem;
  }
}

/* Dark Mode Transition */
* {
  transition: background-color 0.3s ease, color 0.3s ease,
    border-color 0.3s ease;
}

/* Navigation Active Link */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

/* Image Zoom Effect */
.image-zoom {
  overflow: hidden;
}

.image-zoom img {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-zoom:hover img {
  transform: scale(1.1);
}

/* Gradient Border */
.gradient-border {
  position: relative;
  background: linear-gradient(white, white) padding-box,
    linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899) border-box;
  border: 2px solid transparent;
  border-radius: 1rem;
}

.dark .gradient-border {
  background: linear-gradient(#1f2937, #1f2937) padding-box,
    linear-gradient(135deg, #3b82f6, #8b5cf6, #ec4899) border-box;
}

/* Skills Carousel Animation */
.carousel-container {
  overflow: hidden;
  position: relative;
  width: 100%;
  padding: 1rem 0;
}

.carousel-track {
  display: flex;
  gap: 1rem;
  width: fit-content;
  animation: scroll-infinite 30s linear infinite;
}

.carousel-track:hover {
  animation-play-state: paused;
}

.carousel-item {
  flex-shrink: 0;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  border-radius: 9999px;
  white-space: nowrap;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
}

/* Different gradient colors for variety */
.carousel-item:nth-child(7n + 1) {
  background: linear-gradient(to right, #ef4444, #ec4899);
}

.carousel-item:nth-child(7n + 2) {
  background: linear-gradient(to right, #3b82f6, #06b6d4);
}

.carousel-item:nth-child(7n + 3) {
  background: linear-gradient(to right, #a855f7, #ec4899);
}

.carousel-item:nth-child(7n + 4) {
  background: linear-gradient(to right, #10b981, #14b8a6);
}

.carousel-item:nth-child(7n + 5) {
  background: linear-gradient(to right, #eab308, #f97316);
}

.carousel-item:nth-child(7n + 6) {
  background: linear-gradient(to right, #6366f1, #a855f7);
}

.carousel-item:nth-child(7n + 7) {
  background: linear-gradient(to right, #ec4899, #ef4444);
}

@keyframes scroll-infinite {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

/* Timeline Styles */
.timeline-dot {
  position: relative;
}

.timeline-dot::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
  animation: pulse 2s ease-in-out infinite;
}

/* Tech Stack Card Hover */
.tech-card {
  position: relative;
  overflow: hidden;
}

.tech-card::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    45deg,
    transparent,
    rgba(59, 130, 246, 0.1),
    transparent
  );
  transform: rotate(45deg);
  transition: all 0.5s;
}

.tech-card:hover::before {
  left: 100%;
}

/* Smooth Scroll Behavior for Carousel */
.scrollbar-hide {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

/* Timeline Item Animation on Scroll */
.timeline-item {
  opacity: 0;
  transform: translateX(-50px);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-item.active {
  opacity: 1;
  transform: translateX(0);
}

.timeline-item:nth-child(even) {
  transform: translateX(50px);
}

.timeline-item:nth-child(even).active {
  transform: translateX(0);
}

/* Download Button Pulse Effect */
#downloadResumeBtn {
  position: relative;
  overflow: hidden;
}

#downloadResumeBtn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

#downloadResumeBtn:hover::after {
  width: 300px;
  height: 300px;
}

/* Gradient Text Animation */
@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.gradient-text-animated {
  background: linear-gradient(270deg, #3b82f6, #8b5cf6, #ec4899, #3b82f6);
  background-size: 400% 400%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 3s ease infinite;
}

/* Mobile Experience Timeline - Left aligned */
@media (max-width: 768px) {
  /* Timeline container - no extra padding needed */
  #experience .relative {
    padding-left: 0;
  }

  /* Vertical Line - positioned at 1.5rem from left edge */
  #experience .absolute {
    left: 1.5rem !important;
    transform: translateX(0) !important;
  }

  /* Timeline items - make relative for absolute dot positioning */
  #experience .mb-16 {
    position: relative !important;
    flex-direction: row !important;
    justify-content: flex-start !important;
    padding-left: 3rem; /* Space for dot: 1.5rem (line pos) + 1.5rem (dot radius) */
  }

  /* Hide empty spacer divs */
  #experience .w-5\/12:empty {
    display: none;
  }

  /* Red dot - absolute positioned, centered on the line */
  /* Dot is 2rem (w-8), so center should be at 1.5rem */
  /* Therefore left should be 1.5rem - 1rem = 0.5rem */
  #experience .z-20 {
    position: absolute !important;
    left: 0.5rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    order: 1 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Content cards - take full remaining width */
  #experience .order-1.bg-white,
  #experience .order-1.dark\:bg-gray-800 {
    order: 2 !important;
    width: 100% !important;
    max-width: 100%;
  }
}
