/* Animation Keyframes */
@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 fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -468px 0;
    }
    100% {
        background-position: 468px 0;
    }
}

/* Animation Classes */
.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
    animation-play-state: paused;
    animation-fill-mode: both;
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
    animation-play-state: paused;
    animation-fill-mode: both;
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
    animation-play-state: paused;
    animation-fill-mode: both;
}

.scale-in {
    animation: scaleIn 0.5s ease-out;
    animation-play-state: paused;
    animation-fill-mode: both;
}

.bounce-in {
    animation: bounceIn 0.8s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

/* Stagger Animations */
.stagger-container .stagger-item {
    opacity: 0;
    animation: fadeInUp 0.6s ease-out;
    animation-play-state: paused;
    animation-fill-mode: both;
    animation-delay: calc(var(--stagger-index) * 0.1s);
}

.stagger-container .stagger-item.animated {
    opacity: 1;
}

/* Hover Animations */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-shine {
    position: relative;
    overflow: hidden;
}

.hover-shine::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;
}

.hover-shine:hover::before {
    left: 100%;
}

/* Modal Animations */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
}

.modal-content {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.7);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 90%;
    max-height: 90%;
    overflow: auto;
}

.modal-content.show {
    transform: scale(1);
    opacity: 1;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-light);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Product Gallery Animations */
.product-gallery .main-image {
    transition: opacity 0.3s ease;
}

.image-thumbnails .thumbnail {
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid transparent;
}

.image-thumbnails .thumbnail:hover,
.image-thumbnails .thumbnail.active {
    border-color: var(--secondary-color);
    transform: scale(1.05);
}

.image-thumbnails .thumbnail.preview {
    transform: scale(1.1);
}

/* Carousel Animations */
.carousel-track {
    transition: transform 0.5s ease;
}

.carousel-slide {
    transition: opacity 0.3s ease;
}

.carousel-btn {
    transition: all 0.3s ease;
}

.carousel-btn:hover:not(:disabled) {
    transform: scale(1.1);
    background: var(--primary-color);
}

.carousel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Form Animations */
.form-control {
    transition: all 0.3s ease;
}

.form-control:focus {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 51, 102, 0.1);
}

.form-control.error {
    border-color: var(--danger-color);
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.field-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    animation: fadeInUp 0.3s ease;
}

.form-message {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    animation: fadeInUp 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.form-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Button Animations */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn::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.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Navigation Animations */
.nav-link {
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--secondary-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Card Hover Effects */
.category-card,
.product-card,
.stat-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.category-card:hover {
    transform: translateY(-10px) scale(1.02);
}

.product-card:hover {
    transform: translateY(-8px) rotateX(5deg);
}

.stat-card:hover {
    transform: translateY(-5px) scale(1.03);
}

/* Text Animation */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Page Transitions */
.page-enter {
    opacity: 0;
    transform: translateY(20px);
}

.page-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

/* Responsive Animation Adjustments */
@media (max-width: 768px) {
    .slide-in-left,
    .slide-in-right {
        animation: fadeInUp 0.6s ease-out;
    }
    
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}