/**
 * Modern Animations and Design Enhancements
 * Portfolio Website Redesign
 */

/*--------------------------------------------------------------
# Reduced Motion Support
--------------------------------------------------------------*/
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/*--------------------------------------------------------------
# Scroll to Top Button
--------------------------------------------------------------*/
.scroll-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, #12d640, #1c7d32);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9998;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(18, 214, 64, 0.3);
}

.scroll-to-top.show {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background: linear-gradient(135deg, #1c7d32, #35e888);
  transform: translateY(-5px);
  box-shadow: 0 6px 20px rgba(18, 214, 64, 0.5);
}

.scroll-to-top i {
  font-size: 24px;
}

/*--------------------------------------------------------------
# Animated Background Gradient
--------------------------------------------------------------*/
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 50%, rgba(18, 214, 64, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(28, 125, 50, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, rgba(53, 232, 136, 0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.1);
  }
}

/*--------------------------------------------------------------
# Fade In 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 fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

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

@keyframes fadeInLeft {
  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);
  }
}

/*--------------------------------------------------------------
# Animation Classes
--------------------------------------------------------------*/
.animate-on-scroll {
  opacity: 0;
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-on-scroll.animated {
  opacity: 1;
}

.fade-in-up {
  animation: fadeInUp 0.8s ease forwards;
}

.fade-in-down {
  animation: fadeInDown 0.8s ease forwards;
}

.fade-in {
  animation: fadeIn 0.8s ease forwards;
}

.slide-in-left {
  animation: slideInLeft 0.8s ease forwards;
}

.slide-in-right {
  animation: slideInRight 0.8s ease forwards;
}

.scale-in {
  animation: scaleIn 0.6s ease forwards;
}

.fade-in-right {
  animation: fadeInRight 0.8s ease forwards;
}

.fade-in-left {
  animation: fadeInLeft 0.8s ease forwards;
}

/*--------------------------------------------------------------
# Stagger Animation Delays
--------------------------------------------------------------*/
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }
.stagger-7 { animation-delay: 0.7s; }
.stagger-8 { animation-delay: 0.8s; }

/*--------------------------------------------------------------
# Enhanced Card Designs (Glassmorphism)
--------------------------------------------------------------*/
.glass-card {
  background: rgba(9, 32, 58, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(18, 214, 64, 0.2);
  border-color: rgba(18, 214, 64, 0.3);
}

/*--------------------------------------------------------------
# Enhanced Icon Box Hover Effects
--------------------------------------------------------------*/
.interests .icon-box,
.services .icon-box {
  position: relative;
  overflow: hidden;
}

.interests .icon-box::before,
.services .icon-box::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(18, 214, 64, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.interests .icon-box:hover::before,
.services .icon-box:hover::before {
  width: 300px;
  height: 300px;
}

.interests .icon-box:hover,
.services .icon-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 30px rgba(18, 214, 64, 0.2);
}

/*--------------------------------------------------------------
# Enhanced Social Links
--------------------------------------------------------------*/
#header .social-links a,
.contact .info-box .social-links a {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

#header .social-links a::before,
.contact .info-box .social-links a::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.4s ease, height 0.4s ease;
}

#header .social-links a:hover::before,
.contact .info-box .social-links a:hover::before {
  width: 100px;
  height: 100px;
}

#header .social-links a:hover {
  transform: scale(1.1) rotate(5deg);
  box-shadow: 0 5px 15px rgba(18, 214, 64, 0.4);
}

/*--------------------------------------------------------------
# Portfolio Card 3D Effects
--------------------------------------------------------------*/
.portfolio .portfolio-wrap {
  transform-style: preserve-3d;
  perspective: 1000px;
}

.portfolio .portfolio-item {
  transition: transform 0.3s ease;
}

.portfolio .portfolio-item:hover {
  transform: translateY(-10px) scale(1.02);
}

.portfolio .portfolio-wrap img {
  transition: transform 0.5s ease;
}

.portfolio .portfolio-wrap:hover img {
  transform: scale(1.1);
}

/*--------------------------------------------------------------
# Typed Text Enhancement
--------------------------------------------------------------*/
.typing {
  position: relative;
}

.typing::after {
  content: "|";
  animation: blink 1s infinite;
  color: #12d640;
  margin-left: 2px;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/*--------------------------------------------------------------
# Profile Image Animation
--------------------------------------------------------------*/
.about-me img {
  position: relative;
  transition: all 0.3s ease;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.about-me img:hover {
  transform: scale(1.05);
  box-shadow: 0 15px 40px rgba(18, 214, 64, 0.3);
}

.about-me img::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -5px;
  right: -5px;
  bottom: -5px;
  border: 2px solid #12d640;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.about-me img:hover::before {
  opacity: 0.5;
}

/*--------------------------------------------------------------
# Scroll Indicator
--------------------------------------------------------------*/
.scroll-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #fff;
  opacity: 0.7;
  animation: bounce 2s infinite;
}

.scroll-indicator span {
  font-size: 12px;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.scroll-indicator i {
  font-size: 24px;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  40% {
    transform: translateX(-50%) translateY(-10px);
  }
  60% {
    transform: translateX(-50%) translateY(-5px);
  }
}

/*--------------------------------------------------------------
# Enhanced Section Titles
--------------------------------------------------------------*/
.section-title h2 {
  position: relative;
  display: inline-block;
}

.section-title h2::before {
  content: "";
  position: absolute;
  left: -50px;
  top: 50%;
  width: 30px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #12d640);
  transform: translateY(-50%);
}

.section-title h2::after {
  background: linear-gradient(90deg, #12d640, transparent);
}

/*--------------------------------------------------------------
# Loading Animation
--------------------------------------------------------------*/
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #010e1b;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(18, 214, 64, 0.2);
  border-top-color: #12d640;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/*--------------------------------------------------------------
# Enhanced Navigation Active Indicator
--------------------------------------------------------------*/
.nav-menu a {
  position: relative;
}

.nav-menu a.active::after {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, #12d640, #35e888);
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

/*--------------------------------------------------------------
# Skills Logo Hover Effects
--------------------------------------------------------------*/
.skills img {
  transition: all 0.3s ease;
  filter: grayscale(30%);
}

.skills img:hover {
  transform: scale(1.1) translateY(-5px);
  filter: grayscale(0%);
  filter: drop-shadow(0 5px 15px rgba(18, 214, 64, 0.3));
}

/*--------------------------------------------------------------
# Enhanced Button Styles
--------------------------------------------------------------*/
.btn-enhanced {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

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

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

.btn-enhanced:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(18, 214, 64, 0.4);
}

/*--------------------------------------------------------------
# Timeline Connector Animation
--------------------------------------------------------------*/
.timeline-item {
  position: relative;
  padding-left: 40px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: -20px;
  width: 2px;
  background: linear-gradient(180deg, #12d640, transparent);
  animation: drawLine 1s ease forwards;
}

.services .icon-box.timeline-item {
  position: relative;
  margin-bottom: 40px;
  padding-left: 60px;
  border-left: 2px solid rgba(18, 214, 64, 0.3);
  margin-left: 20px;
}

.services .icon-box.timeline-item::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 20px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #12d640;
  border: 3px solid #09203a;
  box-shadow: 0 0 0 4px rgba(18, 214, 64, 0.2);
  animation: pulse 2s infinite;
  z-index: 1;
}

.services .icon-box.timeline-item:last-child {
  border-left: none;
}

@keyframes drawLine {
  from {
    height: 0;
  }
  to {
    height: 100%;
  }
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 4px rgba(18, 214, 64, 0.2);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(18, 214, 64, 0);
  }
}

/*--------------------------------------------------------------
# Mobile Optimizations
--------------------------------------------------------------*/
@media (max-width: 768px) {
  .scroll-to-top {
    width: 45px;
    height: 45px;
    bottom: 20px;
    right: 20px;
  }
  
  .scroll-indicator {
    bottom: 20px;
  }
  
  .portfolio .portfolio-item:hover {
    transform: none;
  }
}

