/* Keyframe Animations */

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

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

@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 float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0) rotate(45deg);
    }
    40% {
        transform: translateY(-10px) rotate(45deg);
    }
    60% {
        transform: translateY(-5px) rotate(45deg);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(139, 58, 58, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(139, 58, 58, 0);
    }
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(1);
    }
    75% {
        transform: scale(1.05);
    }
}

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

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

@keyframes rotateGlow {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes wiggle {
    0%, 7% {
        transform: rotateZ(0);
    }
    15% {
        transform: rotateZ(-15deg);
    }
    20% {
        transform: rotateZ(10deg);
    }
    25% {
        transform: rotateZ(-10deg);
    }
    30% {
        transform: rotateZ(6deg);
    }
    35% {
        transform: rotateZ(-4deg);
    }
    40%, 100% {
        transform: rotateZ(0);
    }
}

/* Utility Animation Classes */

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

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

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

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

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

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

.animate-sparkle {
    animation: sparkle 1.5s ease-in-out infinite;
}

.animate-zoom-in {
    animation: zoomIn 0.5s ease forwards;
}

.animate-wiggle {
    animation: wiggle 2s ease-in-out;
}

/* Scroll Reveal Animations */

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.reveal-scale {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

/* Hover Animations */

.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

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

.hover-glow::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, var(--burgundy), var(--army-green));
    opacity: 0;
    z-index: -1;
    border-radius: inherit;
    filter: blur(10px);
    transition: opacity 0.3s ease;
}

.hover-glow:hover::before {
    opacity: 0.3;
}

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

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

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

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

/* Parallax Effects */

.parallax-element {
    transform: translateZ(0);
    will-change: transform;
}

/* Loading Animations */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--beige);
    border-top: 4px solid var(--burgundy);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

.loading-dots {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.loading-dots div {
    position: absolute;
    top: 33px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--burgundy);
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loading-dots div:nth-child(1) {
    left: 8px;
    animation: dots1 0.6s infinite;
}

.loading-dots div:nth-child(2) {
    left: 8px;
    animation: dots2 0.6s infinite;
}

.loading-dots div:nth-child(3) {
    left: 32px;
    animation: dots2 0.6s infinite;
}

.loading-dots div:nth-child(4) {
    left: 56px;
    animation: dots3 0.6s infinite;
}

@keyframes dots1 {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

@keyframes dots3 {
    0% { transform: scale(1); }
    100% { transform: scale(0); }
}

@keyframes dots2 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(24px, 0); }
}

/* Page Transition Animations */

.page-transition-enter {
    opacity: 0;
    transform: translateY(50px);
}

.page-transition-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s ease;
}

.page-transition-exit {
    opacity: 1;
    transform: translateY(0);
}

.page-transition-exit-active {
    opacity: 0;
    transform: translateY(-50px);
    transition: all 0.5s ease;
}

/* Modal Animations */

.modal-enter {
    opacity: 0;
    transform: scale(0.8);
}

.modal-enter-active {
    opacity: 1;
    transform: scale(1);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-exit {
    opacity: 1;
    transform: scale(1);
}

.modal-exit-active {
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease;
}

/* Cart Animation */

.cart-item-enter {
    opacity: 0;
    transform: translateX(100px);
}

.cart-item-enter-active {
    opacity: 1;
    transform: translateX(0);
    transition: all 0.3s ease;
}

.cart-item-exit {
    opacity: 1;
    transform: translateX(0);
}

.cart-item-exit-active {
    opacity: 0;
    transform: translateX(-100px);
    transition: all 0.3s ease;
}

/* Add to Cart Button Animation */

.add-to-cart-success {
    position: relative;
    overflow: hidden;
}

.add-to-cart-success::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    color: white;
    font-size: 1.5rem;
    animation: checkmark 0.5s ease forwards;
}

@keyframes checkmark {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* Confetti Animation */

.confetti {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10000;
}

.confetti-piece {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--gold);
    animation: confetti-fall 3s linear forwards;
}

.confetti-piece:nth-child(2n) {
    background: var(--burgundy);
}

.confetti-piece:nth-child(3n) {
    background: var(--army-green);
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(-100vh) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* Text Animations */

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--burgundy);
    white-space: nowrap;
    margin: 0 auto;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--burgundy); }
}

.text-glow {
    text-shadow: 0 0 10px rgba(139, 58, 58, 0.5);
    animation: text-glow-pulse 2s ease-in-out infinite alternate;
}

@keyframes text-glow-pulse {
    from {
        text-shadow: 0 0 10px rgba(139, 58, 58, 0.5);
    }
    to {
        text-shadow: 0 0 20px rgba(139, 58, 58, 0.8), 0 0 30px rgba(139, 58, 58, 0.6);
    }
}

/* Micro-interactions */

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

.button-ripple::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

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

/* Stagger Animation */

.stagger-animation > * {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.5s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.6s; }

/* Smooth Scrolling */

html {
    scroll-behavior: smooth;
}

/* 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;
    }
}