/* ====================== 
   Advanced Animations CSS
   PowerElectric Website
   ====================== */

/* Performance Optimization */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Enable hardware acceleration for better performance */
.product-card,
.category-card,
.btn,
.navbar,
.hero-section {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* ====================== 
   Loading Animations
   ====================== */

@keyframes electricPulse {
    0%, 100% {
        text-shadow: 0 0 20px #ffd700;
        transform: scale(1);
    }
    33% {
        text-shadow: 0 0 30px #ffd700, 0 0 40px #ff4500;
        transform: scale(1.05);
    }
    66% {
        text-shadow: 0 0 40px #ffd700, 0 0 60px #ff0000;
        transform: scale(1.1);
    }
}

@keyframes energyRing {
    0% {
        transform: scale(0);
        opacity: 1;
        border-color: #ffd700;
    }
    50% {
        border-color: #ff4500;
    }
    100% {
        transform: scale(1);
        opacity: 0;
        border-color: #ff0000;
    }
}

@keyframes textGlow {
    0%, 100% { 
        text-shadow: 0 0 10px #ffd700; 
    }
    50% { 
        text-shadow: 0 0 20px #ffd700, 0 0 30px #ffb000, 0 0 40px #ff4500; 
    }
}

/* ====================== 
   Card Animations
   ====================== */

@keyframes cardHover {
    0% {
        transform: translateY(0) scale(1);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    }
    100% {
        transform: translateY(-15px) scale(1.03);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 0 0 30px rgba(255, 215, 0, 0.3);
    }
}

@keyframes cardClick {
    0% { transform: scale(1); }
    50% { transform: scale(0.98); }
    100% { transform: scale(1); }
}

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

@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 fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ====================== 
   Button Animations
   ====================== */

@keyframes buttonPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

@keyframes buttonSuccess {
    0% { 
        transform: scale(1);
        background: var(--gradient-energy);
    }
    50% { 
        transform: scale(1.05);
        background: linear-gradient(135deg, #28a745, #20c997);
    }
    100% { 
        transform: scale(1);
        background: #28a745;
    }
}

@keyframes buttonHover {
    0% {
        transform: translateY(0);
        box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    }
    100% {
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(255, 215, 0, 0.5);
    }
}

@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

/* ====================== 
   Shopping Cart Animations
   ====================== */

@keyframes cartPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

@keyframes cartBounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -30px, 0);
    }
    70% {
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

@keyframes flyToCart {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(0.8) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.3) rotate(360deg);
        opacity: 0;
    }
}

/* ====================== 
   Wishlist Animations
   ====================== */

@keyframes heartBeat {
    0% { transform: scale(1); }
    25% { transform: scale(1.2); }
    50% { transform: scale(1); }
    75% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes floatingHeart {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) rotate(180deg);
        opacity: 0;
    }
}

@keyframes wishlistPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ====================== 
   Navigation Animations
   ====================== */

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

@keyframes navLinkHover {
    0% {
        transform: translateY(0) scale(1);
    }
    100% {
        transform: translateY(-3px) scale(1.05);
    }
}

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

/* ====================== 
   Search Animations
   ====================== */

@keyframes searchFocus {
    0% {
        transform: scale(1);
        box-shadow: none;
    }
    100% {
        transform: scale(1.02);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    }
}

@keyframes searchPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes clearSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ====================== 
   Form Animations
   ====================== */

@keyframes formShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes inputFocus {
    0% {
        border-color: #ced4da;
        box-shadow: none;
    }
    100% {
        border-color: #ffd700;
        box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
    }
}

@keyframes labelFloat {
    0% {
        transform: translateY(0);
        opacity: 0.7;
    }
    100% {
        transform: translateY(-20px);
        opacity: 1;
    }
}

/* ====================== 
   Special Effects
   ====================== */

@keyframes electricFlash {
    0%, 100% { 
        filter: brightness(1);
        text-shadow: 0 0 5px #ffd700;
    }
    50% { 
        filter: brightness(2);
        text-shadow: 0 0 15px #ffd700, 0 0 25px #ff4500;
    }
}

@keyframes energyFlow {
    0% {
        background-position: 0% 50%;
        opacity: 0.5;
    }
    50% {
        background-position: 100% 50%;
        opacity: 1;
    }
    100% {
        background-position: 0% 50%;
        opacity: 0.5;
    }
}

@keyframes powerGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.4);
    }
    50% {
        box-shadow: 
            0 0 40px rgba(255, 215, 0, 0.7), 
            0 0 80px rgba(255, 0, 0, 0.4),
            0 0 120px rgba(255, 69, 0, 0.2);
    }
}

@keyframes lightningBolt {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }
    25% {
        transform: scale(1.1) rotate(5deg);
        filter: brightness(1.5);
    }
    75% {
        transform: scale(1.05) rotate(-5deg);
        filter: brightness(1.3);
    }
}

/* ====================== 
   Scroll Animations
   ====================== */

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

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

/* ====================== 
   Modal & Lightbox Animations
   ====================== */

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

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

@keyframes imageZoom {
    from {
        transform: scale(0.8);
    }
    to {
        transform: scale(1);
    }
}

/* ====================== 
   Loading States
   ====================== */

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes skeletonLoad {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ====================== 
   Notification Animations
   ====================== */

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

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
    70% {
        transform: scale(0.9);
        opacity: 0.9;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes shakeHorizontal {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ====================== 
   Floating Elements
   ====================== */

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

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

@keyframes bobbing {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    33% {
        transform: translateY(-8px) rotate(1deg);
    }
    66% {
        transform: translateY(-4px) rotate(-1deg);
    }
}

/* ====================== 
   Back to Top Animation
   ====================== */

@keyframes rocketLaunch {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-200px) rotate(45deg);
        opacity: 0;
    }
}

@keyframes backToTopShow {
    from {
        transform: scale(0) rotate(180deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

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

.animate-slide-up {
    animation: slideInUp 0.6s ease forwards;
}

.animate-slide-left {
    animation: slideInLeft 0.6s ease forwards;
}

.animate-slide-right {
    animation: slideInRight 0.6s ease forwards;
}

.animate-fade-in {
    animation: fadeInScale 0.6s ease forwards;
}

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

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

.animate-bobbing {
    animation: bobbing 4s ease-in-out infinite;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.animate-bounce {
    animation: cartBounce 1s ease;
}

.animate-heart {
    animation: heartBeat 0.5s ease;
}

.animate-electric {
    animation: electricFlash 0.1s ease-in-out;
}

.animate-glow {
    animation: powerGlow 2s ease-in-out infinite;
}

/* ====================== 
   Hover State Animations
   ====================== */

.hover-lift {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.hover-lift:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.hover-glow {
    transition: all 0.3s ease;
}

.hover-glow:hover {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg) scale(1.1);
}

.hover-shake {
    transition: transform 0.3s ease;
}

.hover-shake:hover {
    animation: shakeHorizontal 0.5s ease;
}

/* ====================== 
   Loading Skeleton
   ====================== */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeletonLoad 1.5s infinite;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-title {
    height: 24px;
    margin-bottom: 16px;
    border-radius: 4px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-card {
    height: 200px;
    border-radius: 8px;
    margin-bottom: 16px;
}

/* ====================== 
   Progress Indicators
   ====================== */

.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dotBounce 1.4s ease-in-out infinite both;
}

.loading-dots::before {
    content: '...';
    animation: dotBounce 1.4s ease-in-out -0.32s infinite both;
}

.progress-ring {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ====================== 
   Interactive Elements
   ====================== */

.interactive-card {
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

.interactive-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.interactive-card:active {
    animation: cardClick 0.2s ease;
}

.ripple-effect {
    position: relative;
    overflow: hidden;
}

.ripple-effect::before {
    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;
}

.ripple-effect:active::before {
    width: 300px;
    height: 300px;
}

/* ====================== 
   Responsive Animations
   ====================== */

@media (max-width: 768px) {
    .animate-slide-up,
    .animate-slide-left,
    .animate-slide-right,
    .animate-fade-in {
        animation-duration: 0.4s;
    }
    
    .hover-lift:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .interactive-card:hover {
        transform: translateY(-3px) scale(1.01);
    }
}

/* ====================== 
   Accessibility & Performance
   ====================== */

@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;
    }
    
    .animate-float,
    .animate-float-reverse,
    .animate-bobbing,
    .animate-pulse,
    .animate-glow {
        animation: none !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .skeleton {
        background: linear-gradient(90deg, #000 25%, #333 50%, #000 75%);
    }
    
    .ripple-effect::before {
        background: rgba(255, 255, 255, 0.8);
    }
}

/* ====================== 
   Dark Mode Animations
   ====================== */

@media (prefers-color-scheme: dark) {
    .skeleton {
        background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    }
    
    .hover-glow:hover {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
    }
}

/* ====================== 
   Print Styles
   ====================== */

@media print {
    .animate-float,
    .animate-float-reverse,
    .animate-bobbing,
    .animate-pulse,
    .animate-glow,
    .loading-dots,
    .progress-ring {
        animation: none !important;
    }
    
    .hover-lift,
    .hover-glow,
    .hover-rotate,
    .hover-shake,
    .interactive-card {
        transform: none !important;
        box-shadow: none !important;
    }
}

/* ====================== 
   Custom Scroll Animations
   ====================== */

.scroll-reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

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

.scroll-reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scroll-reveal-left.revealed {
    opacity: 1;
    transform: translateX(0);
}

.scroll-reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.scroll-reveal-right.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* ====================== 
   Stagger Animation Delays
   ====================== */

.stagger-delay-1 { animation-delay: 0.1s; }
.stagger-delay-2 { animation-delay: 0.2s; }
.stagger-delay-3 { animation-delay: 0.3s; }
.stagger-delay-4 { animation-delay: 0.4s; }
.stagger-delay-5 { animation-delay: 0.5s; }
.stagger-delay-6 { animation-delay: 0.6s; }

/* ====================== 
   Performance Optimizations
   ====================== */

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

.smooth-transform {
    transform-style: preserve-3d;
    will-change: transform;
}

/* ====================== 
   Final Touches
   ====================== */

.animation-paused {
    animation-play-state: paused !important;
}

.animation-running {
    animation-play-state: running !important;
}

.no-animation {
    animation: none !important;
    transition: none !important;
}

.fast-transition {
    transition-duration: 0.15s !important;
}

.slow-transition {
    transition-duration: 0.8s !important;
}