/* Animations Stylesheet
   Professional animations for food industry organization website
   Performance-optimized with GPU acceleration
*/

/* ============================================
   Keyframe Animations
   ============================================ */

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 40px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

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

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translate3d(-40px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translate3d(40px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translate3d(0, 50px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translate3d(0, -30px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translate3d(-60px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translate3d(60px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    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% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.05);
    }
}

@keyframes pulseRing {
    0% {
        transform: scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40% {
        transform: translate3d(0, -15px, 0);
    }
    60% {
        transform: translate3d(0, -8px, 0);
    }
}

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

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

@keyframes flipIn {
    from {
        opacity: 0;
        transform: perspective(400px) rotateY(-90deg);
    }
    to {
        opacity: 1;
        transform: perspective(400px) rotateY(0);
    }
}

@keyframes flipOut {
    from {
        opacity: 1;
        transform: perspective(400px) rotateY(0);
    }
    to {
        opacity: 0;
        transform: perspective(400px) rotateY(90deg);
    }
}

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

@keyframes zoomOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.5);
    }
}

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

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

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

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

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

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

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

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

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

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

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

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

.animate-slideUp {
    animation: slideUp 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-slideDown {
    animation: slideDown 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-slideInLeft {
    animation: slideInLeft 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-slideInRight {
    animation: slideInRight 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.animate-scaleIn {
    animation: scaleIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

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

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

.animate-shake {
    animation: shake 0.5s ease-in-out;
}

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

.animate-flipIn {
    animation: flipIn 0.6s ease forwards;
}

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

.animate-countUp {
    animation: countUp 0.8s ease forwards;
}

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

.reveal {
    opacity: 0;
    transform: translate3d(0, 40px, 0);
    transition: opacity 0.7s ease, transform 0.7s ease;
    will-change: opacity, transform;
}

.reveal.visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.reveal-left {
    opacity: 0;
    transform: translate3d(-40px, 0, 0);
    transition: opacity 0.7s ease, transform 0.7s ease;
    will-change: opacity, transform;
}

.reveal-left.visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.reveal-right {
    opacity: 0;
    transform: translate3d(40px, 0, 0);
    transition: opacity 0.7s ease, transform 0.7s ease;
    will-change: opacity, transform;
}

.reveal-right.visible {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

.reveal-zoom {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.7s ease, transform 0.7s ease;
    will-change: opacity, transform;
}

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

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }
.reveal-delay-6 { transition-delay: 0.6s; }
.reveal-delay-7 { transition-delay: 0.7s; }
.reveal-delay-8 { transition-delay: 0.8s; }

/* ============================================
   Entrance Animations (Page Load)
   ============================================ */

.hero-animate > * {
    opacity: 0;
    animation: fadeInUp 0.8s ease forwards;
}

.hero-animate > *:nth-child(1) { animation-delay: 0.2s; }
.hero-animate > *:nth-child(2) { animation-delay: 0.4s; }
.hero-animate > *:nth-child(3) { animation-delay: 0.6s; }
.hero-animate > *:nth-child(4) { animation-delay: 0.8s; }
.hero-animate > *:nth-child(5) { animation-delay: 1.0s; }
.hero-animate > *:nth-child(6) { animation-delay: 1.2s; }

.card-animate {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.card-animate:nth-child(1) { animation-delay: 0.1s; }
.card-animate:nth-child(2) { animation-delay: 0.2s; }
.card-animate:nth-child(3) { animation-delay: 0.3s; }
.card-animate:nth-child(4) { animation-delay: 0.4s; }

/* ============================================
   Micro-interactions
   ============================================ */

.hover-lift {
    transition: transform var(--transition), box-shadow var(--transition);
}

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

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

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

.hover-underline {
    position: relative;
}

.hover-underline::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary);
    transition: width var(--transition);
}

.hover-underline:hover::after {
    width: 100%;
}

.hover-color-shift {
    transition: color var(--transition);
}

.hover-color-shift:hover {
    color: var(--secondary);
}

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

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

.hover-overlay {
    position: relative;
    overflow: hidden;
}

.hover-overlay::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(27, 58, 92, 0.85) 0%, rgba(15, 40, 67, 0.85) 100%);
    opacity: 0;
    transition: opacity var(--transition);
    z-index: 1;
}

.hover-overlay:hover::before {
    opacity: 1;
}

.hover-overlay > * {
    position: relative;
    z-index: 2;
}

.hover-shine {
    position: relative;
    overflow: hidden;
}

.hover-shine::after {
    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.6s ease;
}

.hover-shine:hover::after {
    left: 100%;
}

/* ============================================
   Loading & Skeleton Animations
   ============================================ */

.skeleton {
    position: relative;
    overflow: hidden;
    background: var(--border-light);
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.5),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: var(--radius);
}

.skeleton-text:last-child {
    width: 80%;
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
}

.skeleton-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

/* ============================================
   Progress & Loading Bars
   ============================================ */

.progress {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    animation: progressBar 2s ease forwards;
}

.progress-bar-striped {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
}

.progress-bar-animated {
    animation: progressBar 2s ease forwards, shimmer 1s linear infinite;
}

/* ============================================
   Scrollbar Animations
   ============================================ */

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    animation: bounce 2s ease-in-out infinite;
}

.scroll-indicator .mouse {
    display: block;
    width: 24px;
    height: 40px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    margin: 0 auto 0.5rem;
    position: relative;
}

.scroll-indicator .mouse::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 8px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    animation: scrollWheel 2s ease-in-out infinite;
}

@keyframes scrollWheel {
    0% {
        opacity: 1;
        transform: translate(-50%, 0);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, 12px);
    }
}

.scroll-indicator .arrow {
    display: block;
    width: 12px;
    height: 12px;
    border-right: 2px solid rgba(255, 255, 255, 0.6);
    border-bottom: 2px solid rgba(255, 255, 255, 0.6);
    margin: 0 auto;
    transform: rotate(45deg);
}

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

.floating {
    animation: float 4s ease-in-out infinite;
}

.floating-delay-1 {
    animation-delay: 0.5s;
}

.floating-delay-2 {
    animation-delay: 1s;
}

.floating-delay-3 {
    animation-delay: 1.5s;
}

.floating-delay-4 {
    animation-delay: 2s;
}

/* ============================================
   Gradient Animations
   ============================================ */

.gradient-animated {
    background-size: 200% 200%;
    animation: gradientShift 5s ease infinite;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 3s ease infinite;
}

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

.toast-enter {
    animation: fadeInRight 0.3s ease forwards;
}

.toast-exit {
    animation: fadeOutRight 0.3s ease forwards;
}

@keyframes fadeOutRight {
    from {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
    to {
        opacity: 0;
        transform: translate3d(100%, 0, 0);
    }
}

/* ============================================
   Accordion Animations
   ============================================ */

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.accordion-content.active {
    max-height: 500px;
}

.accordion-icon {
    transition: transform var(--transition);
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

/* ============================================
   Modal Animations
   ============================================ */

.modal-backdrop {
    animation: fadeIn 0.2s ease forwards;
}

.modal-dialog {
    animation: scaleIn 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.modal-close {
    animation: scaleOut 0.2s ease forwards;
}

/* ============================================
   Dropdown Animations
   ============================================ */

.dropdown-menu-enter {
    animation: fadeInDown 0.2s ease forwards;
}

.dropdown-menu-exit {
    animation: fadeOutUp 0.2s ease forwards;
}

@keyframes fadeOutUp {
    from {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
    to {
        opacity: 0;
        transform: translate3d(0, -10px, 0);
    }
}

/* ============================================
   Carousel Animations
   ============================================ */

.carousel-slide {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.carousel-fade {
    animation: fadeIn 0.5s ease forwards;
}

/* ============================================
   Image Hover Effects
   ============================================ */

.image-hover {
    overflow: hidden;
}

.image-hover img {
    transition: transform var(--transition-slow), filter var(--transition);
}

.image-hover:hover img {
    transform: scale(1.08);
    filter: brightness(1.05);
}

.image-zoom-in {
    overflow: hidden;
}

.image-zoom-in img {
    transition: transform 0.6s ease;
}

.image-zoom-in:hover img {
    transform: scale(1.1);
}

.image-grow {
    overflow: hidden;
}

.image-grow img {
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.image-grow:hover img {
    transform: scale(1.15);
}

/* ============================================
   Icon Animations
   ============================================ */

.icon-spin {
    animation: rotate 2s linear infinite;
}

.icon-pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

.icon-bounce {
    animation: bounce 1s ease-in-out infinite;
}

/* ============================================
   Button Loading State
   ============================================ */

.btn-loading {
    position: relative;
    overflow: hidden;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--bg-white);
    border-radius: 50%;
    animation: rotate 0.8s linear infinite;
}

.btn-loading .btn-text {
    opacity: 0;
}

/* ============================================
   Notification Dot
   ============================================ */

.notification-dot {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 10px;
    height: 10px;
    background: var(--secondary);
    border-radius: 50%;
}

.notification-dot::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border: 2px solid var(--secondary);
    border-radius: 50%;
    animation: pulseRing 1.5s ease-out infinite;
}

/* ============================================
   Card Flip Animation
   ============================================ */

.flip-card {
    perspective: 1000px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.flip-card:hover .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
}

.flip-card-back {
    transform: rotateY(180deg);
}

/* ============================================
   Number Counter Animation
   ============================================ */

.counter-animate {
    display: inline-block;
    animation: countUp 1s ease forwards;
}

/* ============================================
   List Item Stagger
   ============================================ */

.stagger-list li {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

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

/* ============================================
   Testimonial Animation
   ============================================ */

.testimonial-enter {
    animation: fadeInUp 0.6s ease forwards;
}

/* ============================================
   Background Patterns
   ============================================ */

.pattern-dots {
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.15) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: fadeIn 1s ease;
}

.pattern-lines {
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 35px,
        rgba(255, 255, 255, 0.03) 35px,
        rgba(255, 255, 255, 0.03) 70px
    );
}

/* ============================================
   Utility: Animation Duration
   ============================================ */

.duration-100 { animation-duration: 0.1s; }
.duration-200 { animation-duration: 0.2s; }
.duration-300 { animation-duration: 0.3s; }
.duration-500 { animation-duration: 0.5s; }
.duration-700 { animation-duration: 0.7s; }
.duration-1000 { animation-duration: 1s; }

/* ============================================
   Utility: Animation Timing
   ============================================ */

.ease-linear { animation-timing-function: linear; }
.ease-in { animation-timing-function: ease-in; }
.ease-out { animation-timing-function: ease-out; }
.ease-in-out { animation-timing-function: ease-in-out; }

/* ============================================
   Utility: Animation Iteration
   ============================================ */

.iteration-infinite { animation-iteration-count: infinite; }
.iteration-2 { animation-iteration-count: 2; }
.iteration-3 { animation-iteration-count: 3; }

/* ============================================
   GPU Acceleration Hints
   ============================================ */

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

.gpu-opacity {
    will-change: opacity;
}

.gpu-composite {
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* ============================================
   Transition Only Classes
   ============================================ */

.transition-all {
    transition: all var(--transition);
}

.transition-colors {
    transition: color var(--transition-fast),
                background-color var(--transition-fast),
                border-color var(--transition-fast);
}

.transition-transform {
    transition: transform var(--transition);
}

.transition-opacity {
    transition: opacity var(--transition);
}

.transition-shadow {
    transition: box-shadow var(--transition);
}

/* ============================================
   Accessibility: Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .animate-fadeIn,
    .animate-fadeInUp,
    .animate-fadeInDown,
    .animate-fadeInLeft,
    .animate-fadeInRight,
    .animate-slideUp,
    .animate-slideDown,
    .animate-slideInLeft,
    .animate-slideInRight,
    .animate-scaleIn,
    .animate-pulse,
    .animate-bounce,
    .animate-shake,
    .animate-float,
    .animate-flipIn,
    .animate-zoomIn,
    .animate-countUp {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }

    .reveal,
    .reveal-left,
    .reveal-right,
    .reveal-zoom {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .hover-lift,
    .hover-scale,
    .hover-overlay,
    .hover-shine {
        transition: none;
    }

    .floating,
    .scroll-indicator {
        animation: none;
    }

    .gradient-animated,
    .text-gradient {
        animation: none;
    }
}