/* ==========================================================================
   Product Image Rotation Animations - Tintetonerwelt
   ========================================================================== */

/* Base product card animation enhancements */
.product-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

/* Product Image Container */
.product-image {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.product-image-link {
    display: block;
    position: relative;
}

/* Main Product Image */
.product-image img {
    width: 100%;
    height: auto;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   Rotation Animations
   ========================================================================== */

/* Gentle rotation on hover */
.product-image:hover img {
    transform: rotate(5deg) scale(1.1);
    filter: brightness(1.1) contrast(1.05);
}

/* 3D flip effect on click */
.product-image.flip-active {
    perspective: 1000px;
}

.product-image.flip-active img {
    animation: flipImage 1.2s ease-in-out;
}

@keyframes flipImage {
    0% {
        transform: rotateY(0deg) scale(1);
    }
    50% {
        transform: rotateY(180deg) scale(0.8);
        opacity: 0.7;
    }
    100% {
        transform: rotateY(360deg) scale(1);
        opacity: 1;
    }
}

/* Continuous slow rotation animation */
.product-image.rotate-continuous img {
    animation: continuousRotate 8s linear infinite;
}

@keyframes continuousRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Pulse animation */
.product-image.pulse-active img {
    animation: pulseImage 2s ease-in-out infinite;
}

@keyframes pulseImage {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.08);
        opacity: 0.9;
    }
}

/* Wiggle animation */
.product-image.wiggle-active img {
    animation: wiggleImage 0.8s ease-in-out infinite;
}

@keyframes wiggleImage {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(-3deg);
    }
    75% {
        transform: rotate(3deg);
    }
}

/* ==========================================================================
   Color Change Animations
   ========================================================================== */

/* Color tag hover effects */
.color-tag.color-hover {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.color-tag.color-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.color-tag.color-hover:hover::before {
    left: 100%;
}

.color-tag.color-hover:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

/* Image transition effect when color changes */
.product-image.changing-color img {
    animation: colorChangeEffect 0.6s ease-in-out;
}

@keyframes colorChangeEffect {
    0% {
        opacity: 1;
        transform: scale(1);
        filter: hue-rotate(0deg);
    }
    50% {
        opacity: 0.7;
        transform: scale(0.95);
        filter: hue-rotate(180deg);
    }
    100% {
        opacity: 1;
        transform: scale(1);
        filter: hue-rotate(360deg);
    }
}

/* ==========================================================================
   Interactive Effects
   ========================================================================== */

/* Shimmer effect on image load */
.product-image.shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Zoom and rotate combo on double-click */
.product-image.zoom-rotate img {
    animation: zoomRotateCombo 1.5s ease-in-out;
}

@keyframes zoomRotateCombo {
    0% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.3) rotate(180deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
    }
}

/* ==========================================================================
   Loading and Transition States
   ========================================================================== */

/* Loading state */
.product-image.loading img {
    opacity: 0.5;
    filter: blur(2px);
    animation: loadingPulse 1.5s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% {
        opacity: 0.5;
    }
    50% {
        opacity: 0.8;
    }
}

/* Image fade transition */
.product-image.fade-transition img {
    animation: fadeInOut 1s ease-in-out;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   Brand-specific animations
   ========================================================================== */

/* HP brand - Blue glow effect */
.product-card[data-brand="HP"] .product-image:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, rgba(0, 150, 214, 0.2) 0%, transparent 70%);
    z-index: 2;
    pointer-events: none;
}

/* Canon brand - Red glow effect */
.product-card[data-brand="Canon"] .product-image:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, rgba(196, 30, 58, 0.2) 0%, transparent 70%);
    z-index: 2;
    pointer-events: none;
}

/* Brother brand - Orange glow effect */
.product-card[data-brand="Brother"] .product-image:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle, rgba(255, 102, 0, 0.2) 0%, transparent 70%);
    z-index: 2;
    pointer-events: none;
}

/* ==========================================================================
   Mobile Optimizations
   ========================================================================== */

@media (max-width: 768px) {
    /* Reduce animation intensity on mobile for better performance */
    .product-image:hover img {
        transform: rotate(2deg) scale(1.05);
    }
    
    .product-image.flip-active img {
        animation-duration: 0.8s;
    }
    
    .product-image.rotate-continuous img {
        animation-duration: 12s;
    }
    
    /* Disable some animations on very small screens */
    @media (max-width: 480px) {
        .product-image.rotate-continuous img {
            animation: none;
        }
        
        .product-image:hover img {
            transform: scale(1.02);
        }
    }
}

/* ==========================================================================
   Animation Control Classes
   ========================================================================== */

/* Pause all animations */
.animations-paused * {
    animation-play-state: paused !important;
    transition: none !important;
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .product-image img,
    .color-tag,
    .product-card {
        animation: none !important;
        transition: opacity 0.3s ease !important;
    }
    
    .product-image:hover img {
        transform: none !important;
    }
}

/* High performance mode - simplified animations */
.performance-mode .product-image img {
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.performance-mode .product-image:hover img {
    transform: scale(1.02);
}

/* ==========================================================================
   Special Effects for Premium Products
   ========================================================================== */

.product-card.premium .product-image {
    position: relative;
}

.product-card.premium .product-image::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ffd700, #ff6b35, #f7931e, #ffd700);
    background-size: 400% 400%;
    z-index: -1;
    border-radius: 14px;
    animation: premiumGlow 3s ease infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card.premium:hover .product-image::after {
    opacity: 1;
}

@keyframes premiumGlow {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}
