/* ===== BALLICA CAFE - ANIMATIONS CSS ===== */

/* ===== KEYFRAME ANIMATIONS ===== */

@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);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ===== SCROLL ANIMATIONS ===== */

.animate-element {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-element.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Specific animation delays for staggered effects */
.animate-element:nth-child(1) { transition-delay: 0.1s; }
.animate-element:nth-child(2) { transition-delay: 0.2s; }
.animate-element:nth-child(3) { transition-delay: 0.3s; }
.animate-element:nth-child(4) { transition-delay: 0.4s; }
.animate-element:nth-child(5) { transition-delay: 0.5s; }
.animate-element:nth-child(6) { transition-delay: 0.6s; }

/* ===== HERO SLIDER ANIMATIONS ===== */

.hero-slide {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-slide .hero-content {
    animation: fadeInUp 1s ease-out 0.5s both;
}

.hero-slide .hero-title {
    animation: fadeInUp 1s ease-out 0.7s both;
}

.hero-slide .hero-subtitle {
    animation: fadeInUp 1s ease-out 0.9s both;
}

.hero-slide .hero-buttons {
    animation: fadeInUp 1s ease-out 1.1s both;
}

/* Slider loading animation */
.hero-slider.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: shimmer 2s infinite;
    z-index: 1;
}

/* ===== NAVIGATION ANIMATIONS ===== */

.nav-menu {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

}

.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* Mobile menu animations */
.mobile-menu {
    transition: all 0.3s ease;
}

.mobile-menu.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.hamburger-line {
    transition: all 0.3s ease;
}

/* Mobile menu slide animation */
@media (max-width: 768px) {
    .nav-menu {
        transform: translateX(0%);
        opacity: 0;
    }
    
    .nav-menu.active {
        transform: translateX(0);
        opacity: 1;
    }
    
    .nav-menu .nav-link {
        opacity: 0;
        transform: translateX(20px);
        transition: all 0.3s ease;
    }
    
    .nav-menu.active .nav-link {
        opacity: 1;
        transform: translateX(0);
    }
    
    .nav-menu.active .nav-link:nth-child(1) { transition-delay: 0.1s; }
    .nav-menu.active .nav-link:nth-child(2) { transition-delay: 0.2s; }
    .nav-menu.active .nav-link:nth-child(3) { transition-delay: 0.3s; }
    .nav-menu.active .nav-link:nth-child(4) { transition-delay: 0.4s; }
}

/* ===== BUTTON ANIMATIONS ===== */

.btn-primary,
.btn-secondary,
.hero-btn,
.product-btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary::before,
.btn-secondary::before,
.hero-btn::before,
.product-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 ease;
}

.btn-primary:hover::before,
.btn-secondary:hover::before,
.hero-btn:hover::before,
.product-btn:hover::before {
    left: 100%;
}

.btn-primary:hover,
.hero-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.3);
}

.btn-secondary:hover,
.product-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn-primary:active,
.btn-secondary:active,
.hero-btn:active,
.product-btn:active {
    transform: translateY(0);
}

/* ===== CARD ANIMATIONS ===== */

.product-card,
.service-item,
.gallery-item {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.service-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.gallery-item {
    overflow: hidden;
    cursor: pointer;
}

.gallery-item:hover {
    transform: scale(1.05);
}

.gallery-item img {
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

/* ===== LOADING ANIMATIONS ===== */

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: rotate 1s linear infinite;
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ===== MODAL ANIMATIONS ===== */

.modal {
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.show,
.modal[style*="flex"] {
    opacity: 1;
    visibility: visible;
}

.modal-content,
.lightbox-content {
    transform: scale(0.8) translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal.show .modal-content,
.modal[style*="flex"] .modal-content,
.lightbox[style*="flex"] .lightbox-content {
    transform: scale(1) translateY(0);
}

/* ===== HEADER SCROLL ANIMATIONS ===== */

.header {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.header.header-hidden {
    transform: translateY(-100%);
}

/* ===== HOVER EFFECTS ===== */

.hover-lift {
    transition: transform 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
}

.hover-scale {
    transition: transform 0.3s ease;
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-rotate {
    transition: transform 0.3s ease;
}

.hover-rotate:hover {
    transform: rotate(5deg);
}

/* ===== TEXT ANIMATIONS ===== */

.text-reveal {
    overflow: hidden;
}

.text-reveal span {
    display: inline-block;
    opacity: 0;
    transform: translateY(100%);
    animation: slideInUp 0.6s ease forwards;
}

.text-reveal span:nth-child(1) { animation-delay: 0.1s; }
.text-reveal span:nth-child(2) { animation-delay: 0.2s; }
.text-reveal span:nth-child(3) { animation-delay: 0.3s; }
.text-reveal span:nth-child(4) { animation-delay: 0.4s; }
.text-reveal span:nth-child(5) { animation-delay: 0.5s; }

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--primary-color);
    white-space: nowrap;
    animation: typing 3s 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-color); }
}

/* ===== SCROLL PROGRESS INDICATOR ===== */

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    z-index: 9999;
    transition: width 0.1s ease;
}

/* ===== FLOATING ELEMENTS ===== */

.float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.float-delayed {
    animation: float 3s ease-in-out infinite 1.5s;
}

/* ===== PARALLAX EFFECTS ===== */

.parallax-element {
    transition: transform 0.1s ease-out;
}

/* ===== ACCESSIBILITY ANIMATIONS ===== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */

.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* ===== CUSTOM EASING FUNCTIONS ===== */

.ease-out-quart {
    transition-timing-function: cubic-bezier(0.25, 1, 0.5, 1);
}

.ease-in-out-quart {
    transition-timing-function: cubic-bezier(0.76, 0, 0.24, 1);
}

.ease-out-expo {
    transition-timing-function: cubic-bezier(0.19, 1, 0.22, 1);
}

/* ===== RESPONSIVE ANIMATIONS ===== */

@media (max-width: 768px) {
    .animate-element {
        transform: translateY(20px);
    }
    
    .product-card:hover {
        transform: translateY(-5px) scale(1.01);
    }
    
    .hero-slide .hero-content {
        animation-delay: 0.3s;
    }
}

@media (max-width: 480px) {
    .animate-element {
        transform: translateY(15px);
    }
    
    .btn-primary:hover,
    .btn-secondary:hover,
    .hero-btn:hover,
    .product-btn:hover {
        transform: translateY(-1px);
    }
}