/**
 * Bistro Suete Restaurant - Animations & Transitions
 * Smooth animations for enhanced user experience
 */

/* ========================================
   FADE ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

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

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

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

/* ========================================
   SCALE ANIMATIONS
   ======================================== */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes scaleOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.9);
    }
}

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

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

/* ========================================
   SLIDE ANIMATIONS
   ======================================== */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

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

@keyframes slideInUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

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

/* ========================================
   ROTATE ANIMATIONS
   ======================================== */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-200deg);
    }
    to {
        opacity: 1;
        transform: rotate(0);
    }
}

/* ========================================
   SHAKE ANIMATION
   ======================================== */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

/* ========================================
   SHIMMER EFFECT
   ======================================== */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

.shimmer {
    background: linear-gradient(
        to right,
        var(--warm-beige) 0%,
        #f0f0f0 50%,
        var(--warm-beige) 100%
    );
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
}

/* ========================================
   UTILITY ANIMATION CLASSES
   ======================================== */
.animate-fadeIn {
    animation: fadeIn 0.5s ease-in-out;
}

.animate-fadeInUp {
    animation: fadeInUp 0.6s ease-out;
}

.animate-fadeInDown {
    animation: fadeInDown 0.6s ease-out;
}

.animate-fadeInLeft {
    animation: fadeInLeft 0.6s ease-out;
}

.animate-fadeInRight {
    animation: fadeInRight 0.6s ease-out;
}

.animate-scaleIn {
    animation: scaleIn 0.4s ease-out;
}

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

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

.animate-shake {
    animation: shake 0.5s;
}

/* ========================================
   SECTION ANIMATIONS ON SCROLL
   ======================================== */
.section-animate {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.section-animate.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children animations */
.stagger-animate > * {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.stagger-animate.visible > *:nth-child(1) {
    transition-delay: 0.1s;
    opacity: 1;
    transform: translateY(0);
}

.stagger-animate.visible > *:nth-child(2) {
    transition-delay: 0.2s;
    opacity: 1;
    transform: translateY(0);
}

.stagger-animate.visible > *:nth-child(3) {
    transition-delay: 0.3s;
    opacity: 1;
    transform: translateY(0);
}

.stagger-animate.visible > *:nth-child(4) {
    transition-delay: 0.4s;
    opacity: 1;
    transform: translateY(0);
}

.stagger-animate.visible > *:nth-child(5) {
    transition-delay: 0.5s;
    opacity: 1;
    transform: translateY(0);
}

.stagger-animate.visible > *:nth-child(6) {
    transition-delay: 0.6s;
    opacity: 1;
    transform: translateY(0);
}

/* ========================================
   HOVER ANIMATIONS
   ======================================== */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.hover-scale {
    transition: transform var(--transition-base);
}

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

.hover-brightness {
    transition: filter var(--transition-base);
}

.hover-brightness:hover {
    filter: brightness(1.1);
}

.hover-glow {
    position: relative;
    transition: all var(--transition-base);
}

.hover-glow::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity var(--transition-base);
    box-shadow: 0 0 20px var(--primary-red);
}

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

/* ========================================
   LOADING ANIMATIONS
   ======================================== */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-red);
    animation: loading-dots 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

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

.loading-bar {
    width: 100%;
    height: 4px;
    background-color: var(--warm-beige);
    overflow: hidden;
    border-radius: 2px;
}

.loading-bar::after {
    content: '';
    display: block;
    width: 30%;
    height: 100%;
    background-color: var(--primary-red);
    animation: loading-bar 1.5s ease-in-out infinite;
}

@keyframes loading-bar {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(400%);
    }
}

/* ========================================
   PAGE TRANSITION
   ======================================== */
.page-transition {
    animation: pageTransition 0.5s ease-in-out;
}

@keyframes pageTransition {
    0% {
        opacity: 0;
        transform: scale(0.98);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========================================
   REVEAL ON SCROLL (for images)
   ======================================== */
.reveal-on-scroll {
    position: relative;
    overflow: hidden;
}

.reveal-on-scroll::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--warm-beige);
    transform: translateX(-100%);
    transition: transform 0.8s cubic-bezier(0.77, 0, 0.175, 1);
}

.reveal-on-scroll.visible::after {
    transform: translateX(100%);
}

/* ========================================
   TEXT ANIMATIONS
   ======================================== */
.text-gradient {
    background: linear-gradient(
        45deg,
        var(--primary-red),
        var(--primary-yellow),
        var(--primary-blue)
    );
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient 3s ease infinite;
}

@keyframes gradient {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.typewriter {
    overflow: hidden;
    border-right: 3px solid var(--primary-red);
    white-space: nowrap;
    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(--primary-red);
    }
}

/* ========================================
   TRANSITION DELAYS (for staggered effects)
   ======================================== */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }
.delay-500 { transition-delay: 500ms; }

/* ========================================
   PERFORMANCE OPTIMIZATION
   Hint browser for hardware acceleration
   ======================================== */
.animate-fadeIn,
.animate-fadeInUp,
.animate-scaleIn,
.hover-lift,
.hover-scale {
    will-change: transform, opacity;
}

/* Clean up will-change after animation */
.animate-fadeIn:not(:hover),
.animate-fadeInUp:not(:hover),
.animate-scaleIn:not(:hover) {
    will-change: auto;
}
