/*
  ==========================================
  Sharma Interiors - Animations
  CSS Animations & Transitions
  ==========================================
*/

/* ==================== KEYFRAME ANIMATIONS ==================== */

/* Fade In */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Fade In Up */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Fade In Down */
@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide In Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Zoom In */
@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.5);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Bounce */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* Pulse */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Shake */
@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: translateX(-5px);
  }
  20%, 40%, 60%, 80% {
    transform: translateX(5px);
  }
}

/* Rotate */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Slide Down */
@keyframes slideDown {
  from {
    max-height: 0;
    opacity: 0;
  }
  to {
    max-height: 500px;
    opacity: 1;
  }
}

/* Float */
@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Shimmer/Loading */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Counter Animation */
@keyframes countUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== ANIMATION CLASSES ==================== */

/* Fade Animations */
.animate-fade-in {
  animation: fadeIn 0.6s ease-out forwards;
  opacity: 0;
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
  opacity: 0;
}

.animate-fade-in-down {
  animation: fadeInDown 0.6s ease-out forwards;
  opacity: 0;
}

/* Slide Animations */
.animate-slide-left {
  animation: slideInLeft 0.6s ease-out forwards;
  opacity: 0;
}

.animate-slide-right {
  animation: slideInRight 0.6s ease-out forwards;
  opacity: 0;
}

/* Scale Animation */
.animate-scale-in {
  animation: scaleIn 0.5s ease-out forwards;
  opacity: 0;
}

.animate-zoom-in {
  animation: zoomIn 0.5s ease-out forwards;
  opacity: 0;
}

/* Bounce Animation */
.animate-bounce {
  animation: bounce 1s ease infinite;
}

/* Pulse Animation */
.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Shake Animation */
.animate-shake {
  animation: shake 0.5s ease-in-out;
}

/* Float Animation */
.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* Rotate Animation */
.animate-rotate {
  animation: rotate 2s linear infinite;
}

/* ==================== ANIMATION DELAYS ==================== */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }
.delay-600 { animation-delay: 0.6s; }
.delay-700 { animation-delay: 0.7s; }
.delay-800 { animation-delay: 0.8s; }
.delay-900 { animation-delay: 0.9s; }
.delay-1000 { animation-delay: 1s; }

/* ==================== SCROLL ANIMATIONS ==================== */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ==================== HOVER ANIMATIONS ==================== */
.hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.hover-grow {
  transition: transform 0.3s ease;
}

.hover-grow:hover {
  transform: scale(1.05);
}

.hover-shrink {
  transition: transform 0.3s ease;
}

.hover-shrink:hover {
  transform: scale(0.95);
}

/* ==================== LOADING ANIMATIONS ==================== */
.loading-spinner {
  display: inline-block;
  width: 40px;
  height: 40px;
  border: 4px solid var(--color-gray);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: rotate 1s linear infinite;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

.skeleton-loading {
  background: linear-gradient(
    90deg,
    var(--color-gray) 0%,
    var(--color-light-gray) 50%,
    var(--color-gray) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ==================== PAGE TRANSITIONS ==================== */
.page-transition-enter {
  opacity: 0;
  transform: translateY(20px);
}

.page-transition-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.page-transition-exit {
  opacity: 1;
  transform: translateY(0);
}

.page-transition-exit-active {
  opacity: 0;
  transform: translateY(-20px);
  transition: opacity 0.4s ease-in, transform 0.4s ease-in;
}

/* ==================== COUNTER ANIMATION ==================== */
.counter {
  display: inline-block;
  animation: countUp 0.5s ease-out forwards;
}

/* ==================== FORM ANIMATIONS ==================== */
.form-error-shake {
  animation: shake 0.4s ease-in-out;
}

.form-success-bounce {
  animation: bounce 0.6s ease-out;
}

/* Input Focus Animation */
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  transform: scale(1.02);
  transition: transform 0.2s ease;
}

/* ==================== BUTTON ANIMATIONS ==================== */
.btn {
  position: relative;
  overflow: hidden;
}

.btn::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 ease, height 0.6s ease;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

/* ==================== MODAL ANIMATIONS ==================== */
.modal-fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

.modal-fade-out {
  animation: fadeIn 0.3s ease-in reverse forwards;
}

.modal-slide-up {
  animation: slideInUp 0.4s ease-out forwards;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(100px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==================== NOTIFICATION ANIMATIONS ==================== */
.notification-enter {
  animation: slideInRight 0.4s ease-out forwards;
}

.notification-exit {
  animation: slideInRight 0.4s ease-in reverse forwards;
}

/* ==================== ACCORDION ANIMATION ==================== */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease-out;
}

.accordion-content.active {
  max-height: 1000px;
  transition: max-height 0.6s ease-in;
}

/* ==================== IMAGE HOVER EFFECTS ==================== */
.image-zoom {
  overflow: hidden;
}

.image-zoom img {
  transition: transform 0.5s ease;
}

.image-zoom:hover img {
  transform: scale(1.1);
}

.image-overlay-fade {
  position: relative;
}

.image-overlay-fade::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.image-overlay-fade:hover::after {
  opacity: 1;
}

/* ==================== TEXT ANIMATIONS ==================== */
.text-gradient-animate {
  background: linear-gradient(
    90deg,
    var(--color-accent),
    var(--color-primary),
    var(--color-accent)
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 3s linear infinite;
}

.typing-animation {
  overflow: hidden;
  border-right: 2px solid var(--color-accent);
  white-space: nowrap;
  animation: typing 3s steps(40, end), blink 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink {
  50% { border-color: transparent; }
}

/* ==================== STAGGER ANIMATIONS ==================== */
.stagger-fade > * {
  opacity: 0;
  animation: fadeInUp 0.6s ease-out forwards;
}

.stagger-fade > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-fade > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-fade > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-fade > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-fade > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-fade > *:nth-child(6) { animation-delay: 0.6s; }

/* ==================== PERFORMANCE OPTIMIZATIONS ==================== */
.will-animate {
  will-change: transform, opacity;
}

.hardware-accelerate {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

/* ==================== ACCESSIBILITY ==================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
