/* ==========================================================================
   All American Spa Repair Services - Animations & Effects
   Smooth animations, scroll effects, and interactive elements
   ========================================================================== */

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@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 {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
  }
}

@keyframes pulseAqua {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.5);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(96, 165, 250, 0);
  }
}

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

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Wave animation for logo */
@keyframes wave {
  0%, 100% {
    transform: rotate(0deg);
  }
  25% {
    transform: rotate(5deg);
  }
  75% {
    transform: rotate(-5deg);
  }
}

/* ==========================================================================
   Animation Classes
   ========================================================================== */

/* Fade Animations */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

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

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

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

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

/* Scale Animation */
.animate-scale-in {
  animation: scaleIn 0.6s ease-out;
}

/* Pulse Animations */
.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-pulse-aqua {
  animation: pulseAqua 2s infinite;
}

/* Bounce Animation */
.animate-bounce {
  animation: bounce 1s ease-in-out infinite;
}

/* Spin Animation */
.animate-spin {
  animation: spin 1s linear infinite;
}

/* Wave Animation */
.animate-wave {
  animation: wave 2s ease-in-out infinite;
}

/* ==========================================================================
   Scroll-Triggered Animations (JavaScript controlled)
   ========================================================================== */

.scroll-animate {
  opacity: 0;
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-animate.visible {
  opacity: 1;
}

.scroll-fade-up {
  opacity: 0;
  transform: translateY(30px);
}

.scroll-fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.scroll-fade-left {
  opacity: 0;
  transform: translateX(-30px);
}

.scroll-fade-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-fade-right {
  opacity: 0;
  transform: translateX(30px);
}

.scroll-fade-right.visible {
  opacity: 1;
  transform: translateX(0);
}

.scroll-scale {
  opacity: 0;
  transform: scale(0.9);
}

.scroll-scale.visible {
  opacity: 1;
  transform: scale(1);
}

/* Stagger delays for sequential animations */
.stagger-1 {
  transition-delay: 0.1s;
}

.stagger-2 {
  transition-delay: 0.2s;
}

.stagger-3 {
  transition-delay: 0.3s;
}

.stagger-4 {
  transition-delay: 0.4s;
}

.stagger-5 {
  transition-delay: 0.5s;
}

.stagger-6 {
  transition-delay: 0.6s;
}

/* ==========================================================================
   Carousel Components
   ========================================================================== */

.carousel {
  position: relative;
  overflow: hidden;
}

.carousel-container {
  display: flex;
  transition: transform 0.5s ease-in-out;
}

.carousel-slide {
  min-width: 100%;
  transition: opacity 0.5s ease-in-out;
}

/* Carousel Navigation */
.carousel-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.carousel-btn {
  background-color: var(--color-secondary);
  border: 2px solid var(--color-primary);
  color: var(--color-primary);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: var(--text-xl);
  box-shadow: var(--shadow-md);
}

.carousel-btn:hover {
  background-color: var(--color-primary);
  color: var(--color-secondary);
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

.carousel-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.carousel-btn:disabled:hover {
  background-color: var(--color-secondary);
  color: var(--color-primary);
  transform: none;
}

/* Carousel Dots */
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.carousel-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background-color: var(--color-gray-300);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.carousel-dot:hover {
  background-color: var(--color-primary-light);
  transform: scale(1.2);
}

.carousel-dot.active {
  background-color: var(--color-primary);
  width: 32px;
  border-radius: 6px;
}

/* ==========================================================================
   Trust Badge Carousel (Horizontal Scrolling)
   ========================================================================== */

.trust-badge-carousel {
  position: relative;
  padding: var(--space-8) 0;
  overflow: hidden;
}

.trust-badge-track {
  display: flex;
  gap: var(--space-8);
  align-items: center;
  transition: transform 0.5s ease-in-out;
}

.trust-badge-item {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  min-width: 180px;
  height: 120px;
}

.trust-badge-item img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: grayscale(0);
  opacity: 0.9;
  transition: all var(--transition-fast);
}

.trust-badge-item:hover img {
  opacity: 1;
  transform: scale(1.05);
}

/* Auto-scroll animation */
.trust-badge-track.auto-scroll {
  animation: scrollBadges 30s linear infinite;
}

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

/* ==========================================================================
   Loading States & Skeletons
   ========================================================================== */

.skeleton {
  background: linear-gradient(90deg,
    var(--color-gray-200) 25%,
    var(--color-gray-100) 50%,
    var(--color-gray-200) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
}

.skeleton-heading {
  height: 2em;
  width: 60%;
  margin-bottom: var(--space-4);
}

.skeleton-button {
  height: 48px;
  width: 150px;
}

.skeleton-card {
  height: 200px;
  border-radius: var(--radius-xl);
}

/* ==========================================================================
   Hover Effects & Micro-interactions
   ========================================================================== */

/* Link Underline Animation */
.link-underline {
  position: relative;
  text-decoration: none;
}

.link-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background-color: var(--color-aqua);
  transition: width var(--transition-fast), left var(--transition-fast);
}

.link-underline:hover::after {
  width: 100%;
  left: 0;
}

/* Icon Rotation on Hover */
.icon-rotate-hover {
  transition: transform var(--transition-fast);
}

.icon-rotate-hover:hover {
  transform: rotate(15deg);
}

/* Icon Bounce on Hover */
.icon-bounce-hover {
  transition: transform var(--transition-fast);
}

.icon-bounce-hover:hover {
  animation: bounce 0.6s ease-in-out;
}

/* Glow Effect */
.glow-hover {
  transition: box-shadow var(--transition-fast);
}

.glow-hover:hover {
  box-shadow: 0 0 20px rgba(96, 165, 250, 0.5);
}

/* ==========================================================================
   Page Transition Effects
   ========================================================================== */

.page-transition {
  animation: fadeIn 0.5s ease-out;
}

/* ==========================================================================
   Micro-Animations & Enhanced Interactions (2025 Design Trends)
   ========================================================================== */

/* Service Card Hover Effects - Lift + Shadow */
.service-card,
.card,
.testimonial-card,
.location-card,
.promo-card {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, box-shadow;
}

.service-card:hover,
.card:hover,
.testimonial-card:hover,
.location-card:hover,
.promo-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15),
              0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Button Hover Animations - Scale + Ripple Effect */
.btn,
.btn-primary,
.btn-secondary,
.btn-white,
.btn-aqua,
.btn-emergency,
.btn-hero,
.btn-form-submit {
  position: relative;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              background-color 0.2s ease;
}

.btn:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-white:hover,
.btn-aqua:hover,
.btn-hero:hover,
.btn-form-submit:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-white:active,
.btn-aqua:active,
.btn-hero:active,
.btn-form-submit:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 0.1s;
}

/* Ripple Effect for Buttons */
@keyframes ripple {
  0% {
    transform: scale(0);
    opacity: 1;
  }
  100% {
    transform: scale(4);
    opacity: 0;
  }
}

.btn::before,
.btn-primary::before,
.btn-emergency::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:hover::before,
.btn-primary:hover::before,
.btn-emergency:hover::before {
  width: 300px;
  height: 300px;
  animation: ripple 0.6s ease-out;
}

/* Ripple Effect (Click Animation) */
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0);
  animation: rippleExpand 0.6s ease-out;
  pointer-events: none;
}

@keyframes rippleExpand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Icon Hover Animations - Float & Rotate */
.icon {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.service-icon .icon:hover,
.trust-badge .icon:hover,
.promo-card .icon:hover {
  transform: translateY(-4px) rotate(5deg);
}

/* Subtle Icon Float Animation */
@keyframes iconFloat {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

.service-icon .icon {
  animation: iconFloat 3s ease-in-out infinite;
}

.service-icon:hover .icon {
  animation-play-state: paused;
}

/* Form Field Focus Animations */
.form-input,
.form-textarea,
.form-select,
.hero-form input,
.hero-form select,
.hero-form textarea {
  transition: border-color 0.3s ease,
              box-shadow 0.3s ease,
              transform 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus,
.hero-form input:focus,
.hero-form select:focus,
.hero-form textarea:focus {
  transform: scale(1.01);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1),
              0 4px 12px rgba(30, 64, 175, 0.15);
}

/* Smooth Label Float on Focus */
@keyframes labelFloat {
  from {
    transform: translateY(0);
    font-size: 1em;
  }
  to {
    transform: translateY(-1.5em);
    font-size: 0.85em;
  }
}

/* Trust Badge Flip Effect */
.trust-badge {
  transition: transform 0.3s ease;
  cursor: default;
}

.trust-badge:hover {
  transform: scale(1.05);
}

/* Testimonial Card Depth Effect */
.testimonial-card {
  transform-style: preserve-3d;
  perspective: 1000px;
}

.testimonial-card:hover {
  transform: translateY(-8px) rotateX(2deg);
}

/* CTA Pulse Animation - Draws Attention */
@keyframes ctaPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(220, 38, 38, 0);
    transform: scale(1.03);
  }
}

.btn-emergency {
  animation: ctaPulse 3s ease-in-out infinite;
}

.btn-emergency:hover {
  animation: none;
}

/* Floating Action Button Enhanced Animation */
.fab-phone {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease;
}

.fab-phone:hover {
  transform: scale(1.15) rotate(5deg);
  box-shadow: 0 12px 30px rgba(220, 38, 38, 0.4);
}

@keyframes fabBounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.fab-phone {
  animation: fabBounce 2s ease-in-out 3s infinite;
}

/* Number Counter Animation */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-number,
.reviews-score {
  animation: countUp 0.8s ease-out;
}

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

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

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

/* Link Hover Underline - Smooth Expand */
a:not(.btn):not(.btn-primary):not(.btn-secondary) {
  position: relative;
  transition: color 0.2s ease;
}

.footer-link,
.desktop-nav a {
  position: relative;
}

.footer-link::after,
.desktop-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: currentColor;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-link:hover::after,
.desktop-nav a:hover::after {
  width: 100%;
}

/* Smooth Dropdown Menu Animation */
.dropdown-menu {
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease,
              transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.services-dropdown:hover .dropdown-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* Star Rating Glow on Hover */
.star-rating {
  transition: transform 0.2s ease;
}

.star-rating:hover {
  transform: scale(1.05);
}

.stars span {
  display: inline-block;
  transition: transform 0.2s ease, color 0.2s ease;
}

.stars:hover span {
  animation: starTwinkle 0.5s ease-in-out;
}

@keyframes starTwinkle {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(30, 64, 175, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Success Checkmark Animation */
@keyframes checkmarkDraw {
  0% {
    stroke-dashoffset: 100;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

.success-checkmark {
  stroke-dasharray: 100;
  animation: checkmarkDraw 0.5s ease-out forwards;
}

/* Scroll Progress Bar */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-aqua));
  z-index: 9999;
  transition: width 0.1s ease-out;
}

/* Tooltip Animation */
.tooltip {
  opacity: 0;
  transform: translateY(-5px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.tooltip.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: all;
}

/* Badge Shine Effect */
@keyframes badgeShine {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

.hero-badge,
.trust-badge {
  background-size: 200% auto;
  transition: all 0.3s ease;
}

.hero-badge:hover {
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0.1) 100%
  );
  animation: badgeShine 1.5s ease-in-out;
}

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

/* Image Fade-in on Load */
img {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

img.loaded {
  opacity: 1;
}

/* Mobile Touch Feedback */
@media (hover: none) and (pointer: coarse) {
  .btn:active,
  .card:active,
  a:active {
    opacity: 0.8;
    transform: scale(0.98);
  }
}

/* ==========================================================================
   Accessibility - Respect User Preferences
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .fab-phone,
  .service-icon .icon,
  .btn-emergency {
    animation: none !important;
  }
}
