/* Animations and Transitions for TechSolutions Website */

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide Up Animation */
@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Slide Down Animation */
@keyframes slideDown {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Slide In From Left */
@keyframes slideInLeft {
  from {
    transform: translateX(-30px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Slide In From Right */
@keyframes slideInRight {
  from {
    transform: translateX(30px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

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

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

/* Glow Animation */
@keyframes glow {
  0% {
    box-shadow: 0 0 0 rgba(0, 85, 255, 0);
  }
  50% {
    box-shadow: 0 0 20px rgba(0, 85, 255, 0.3);
  }
  100% {
    box-shadow: 0 0 0 rgba(0, 85, 255, 0);
  }
}

/* Apply animations to site elements */

/* Page Load Animations */
.site-header {
  animation: slideDown 0.5s ease-out;
}

.hero-content h1 {
  animation: slideUp 0.6s ease-out 0.2s both;
}

.hero-content p {
  animation: slideUp 0.6s ease-out 0.4s both;
}

.cta-buttons {
  animation: slideUp 0.6s ease-out 0.6s both;
}

/* Feature Card Animations */
.feature-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.feature-card:hover .feature-icon {
  animation: pulse 1s ease infinite;
}

/* Button Hover Effects */
.btn {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.5s ease, height 0.5s ease;
}

.btn:hover::after {
  width: 200%;
  height: 200%;
}

/* Navigation Link Hover Effect */
.main-nav a {
  position: relative;
}

.main-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--color-primary);
  transition: width 0.3s ease;
}

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

/* Testimonial Card Hover */
.testimonial {
  transition: transform 0.3s ease;
}

.testimonial:hover {
  transform: translateY(-5px);
}

/* Team Member Image Hover */
.member-image {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

.member-image img {
  transition: transform 0.5s ease;
}

.team-member:hover .member-image {
  box-shadow: var(--shadow-lg);
}

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

/* Blog Card Animation */
.blog-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.blog-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.blog-card .post-image img {
  transition: transform 0.5s ease;
}

.blog-card:hover .post-image img {
  transform: scale(1.05);
}

/* Social Icon Hover Animation */
.social-links a {
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.social-links a:hover {
  transform: translateY(-3px);
}

/* Form Input Focus Animation */
input:focus, textarea:focus, select:focus {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Button Focus Animation */
.btn:focus {
  animation: glow 1.5s ease infinite;
}

/* CTA Section Hover */
.cta-section {
  transition: background-color 0.5s ease;
}

.cta-section:hover {
  background-color: var(--color-primary-dark);
}

/* Logo Hover Animation */
.logo a {
  transition: color 0.3s ease;
}

.logo a:hover {
  animation: pulse 1s ease;
}

/* FAQ Question Hover */
.faq-question {
  transition: color 0.3s ease;
}

.faq-question:hover {
  color: var(--color-primary);
}

/* Loading Animation (for async operations) */
.loading::after {
  content: '';
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: var(--color-white);
  animation: spin 1s linear infinite;
  margin-left: 0.5em;
  vertical-align: middle;
}

/* Page Transitions */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.page-transition-exit {
  opacity: 1;
  transform: translateY(0);
}

.page-transition-exit-active {
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Service Icon Animation */
.service-text h2::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: var(--color-primary);
  border-radius: 50%;
  margin-right: 10px;
  transform: translateY(-3px);
  transition: transform 0.3s ease, background-color 0.3s ease;
}

.service-content:hover .service-text h2::before {
  transform: scale(1.5) translateY(-3px);
  background-color: var(--color-primary-light);
}

/* Process Step Animation */
.process-step {
  transition: transform 0.3s ease;
}

.process-step:hover {
  transform: translateY(-5px);
}

.process-step:hover .step-number {
  animation: pulse 1.5s ease infinite;
}

/* Contact Form Submit Button Animation */
button[type="submit"] {
  position: relative;
  overflow: hidden;
}

button[type="submit"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.7s ease;
}

button[type="submit"]:hover::before {
  left: 100%;
}

/* Mobile Menu Toggle Animation */
.mobile-menu-toggle span {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Animated Checkmark for Form Success */
@keyframes checkmark {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
  }
}

.form-success .checkmark {
  animation: checkmark 0.5s ease-in-out;
}

/* Staggered Animation for Features Grid */
.features-grid .feature-card:nth-child(1) {
  animation: slideUp 0.5s ease-out 0.1s both;
}

.features-grid .feature-card:nth-child(2) {
  animation: slideUp 0.5s ease-out 0.2s both;
}

.features-grid .feature-card:nth-child(3) {
  animation: slideUp 0.5s ease-out 0.3s both;
}

.features-grid .feature-card:nth-child(4) {
  animation: slideUp 0.5s ease-out 0.4s both;
}

/* Staggered Animation for Team Members */
.team-grid .team-member:nth-child(1) {
  animation: slideInLeft 0.5s ease-out 0.1s both;
}

.team-grid .team-member:nth-child(2) {
  animation: slideUp 0.5s ease-out 0.2s both;
}

.team-grid .team-member:nth-child(3) {
  animation: slideUp 0.5s ease-out 0.3s both;
}

.team-grid .team-member:nth-child(4) {
  animation: slideInRight 0.5s ease-out 0.4s both;
}

/* Staggered Animation for Blog Cards */
.posts-grid .blog-card {
  animation: fadeIn 0.5s ease-out both;
}

.posts-grid .blog-card:nth-child(even) {
  animation-delay: 0.2s;
}

.posts-grid .blog-card:nth-child(odd) {
  animation-delay: 0.3s;
}

/* Values Cards Animation */
.values-grid .value-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: fadeIn 0.5s ease-out both;
}

.values-grid .value-card:nth-child(1) {
  animation-delay: 0.1s;
}

.values-grid .value-card:nth-child(2) {
  animation-delay: 0.2s;
}

.values-grid .value-card:nth-child(3) {
  animation-delay: 0.3s;
}

.values-grid .value-card:nth-child(4) {
  animation-delay: 0.4s;
}

.values-grid .value-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

/* Process Steps Animation */
.process-steps {
  position: relative;
}

.process-steps::before {
  content: '';
  position: absolute;
  top: 25px;
  left: 25px;
  right: 25px;
  height: 2px;
  background-color: var(--color-gray-300);
  z-index: 1;
}

.process-step {
  position: relative;
  z-index: 2;
}

.step-number {
  transition: background-color 0.3s ease, transform 0.3s ease;
}

.process-step:hover .step-number {
  background-color: var(--color-primary-dark);
  transform: scale(1.1);
}

/* Mobile-specific animations */
@media (max-width: 768px) {
  /* Optimize animations for mobile devices */
  .features-grid .feature-card,
  .team-grid .team-member,
  .values-grid .value-card,
  .posts-grid .blog-card {
    animation-name: fadeIn;
    animation-duration: 0.4s;
  }
  
  /* Mobile menu animation */
  @keyframes mobileMenuSlide {
    from {
      transform: translateY(-20px);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
  
  .mobile-menu-open .main-nav {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--color-white);
    padding: var(--spacing-4);
    box-shadow: var(--shadow-md);
    animation: mobileMenuSlide 0.3s ease-out;
  }
  
  .mobile-menu-open .main-nav ul {
    flex-direction: column;
  }
  
  .mobile-menu-open .main-nav li {
    margin: var(--spacing-2) 0;
  }
}