/* Bar Centrale Crespino - Animations */

/* ========================================
   ANIMAZIONI DI BASE
======================================== */

/* Fade in con movimento Y */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade in semplice */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Scale in */
@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Slide in da sinistra */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Slide in da destra */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========================================
   CLASSI PER ANIMAZIONI ON SCROLL
======================================== */

.fade-in-up {
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.fade-in-up.in-view {
    opacity: 1;
    transform: translateY(0);
}

.fade-in {
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.fade-in.in-view {
    opacity: 1;
}

.scale-in {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.slide-in-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.slide-in-left.in-view {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.slide-in-right.in-view {
    opacity: 1;
    transform: translateX(0);
}

/* ========================================
   ANIMAZIONI SPECIFICHE PER ELEMENTI
======================================== */

/* Hero animations */
.hero-title {
    animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}

.hero-subtitle {
    animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.4s both;
}

.hero-cta {
    animation: fadeInUp 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.6s both;
}

/* Staggered animations per le card */
.bar-card:nth-child(1) {
    animation-delay: 0.1s;
}

.bar-card:nth-child(2) {
    animation-delay: 0.2s;
}

.bar-card:nth-child(3) {
    animation-delay: 0.3s;
}

.evento-card:nth-child(1) {
    animation-delay: 0.1s;
}

.evento-card:nth-child(2) {
    animation-delay: 0.2s;
}

.evento-card:nth-child(3) {
    animation-delay: 0.3s;
}

.galleria-item:nth-child(1) { animation-delay: 0.1s; }
.galleria-item:nth-child(2) { animation-delay: 0.15s; }
.galleria-item:nth-child(3) { animation-delay: 0.2s; }
.galleria-item:nth-child(4) { animation-delay: 0.25s; }
.galleria-item:nth-child(5) { animation-delay: 0.3s; }
.galleria-item:nth-child(6) { animation-delay: 0.35s; }

/* ========================================
   HOVER ANIMATIONS
======================================== */

/* Glow effect per le icone */
@keyframes glow {
    0%, 100% {
        filter: drop-shadow(0 0 5px rgba(201, 166, 70, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(201, 166, 70, 0.8));
    }
}

.cocktail-icon {
    animation: glow 6s ease-in-out infinite;
}

/* Pulse effect per i bottoni */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(201, 166, 70, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(201, 166, 70, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(201, 166, 70, 0);
    }
}

.btn-primary:hover {
    animation: pulse 1.5s infinite;
}

/* ========================================
   LOADING ANIMATIONS
======================================== */

/* Skeleton loader per le immagini */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton-loader {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite ease-in-out;
}

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

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

/* ========================================
   PARALLAX EFFECTS
======================================== */

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

/* Hero parallax background */
.hero {
    background-attachment: fixed;
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Parallax per le sezioni */
.parallax-section {
    position: relative;
    transform-style: preserve-3d;
}

.parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 120%;
    background-size: cover;
    background-position: center;
    will-change: transform;
    z-index: -1;
}

/* ========================================
   MICRO-INTERACTIONS
======================================== */

/* Hover effect per le card con bordo animato */
@keyframes border-dance {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

.card-border-animated {
    position: relative;
    background: linear-gradient(45deg, var(--gold), var(--wine), var(--gold));
    background-size: 200% 200%;
    animation: border-dance 3s ease infinite;
    padding: 2px;
    border-radius: 8px;
}

.card-border-animated .card-content {
    background: var(--cream);
    border-radius: 6px;
    padding: 2rem;
}

/* Effetto typewriter */
@keyframes typewriter {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.typewriter {
    overflow: hidden;
    border-right: 2px solid var(--gold);
    white-space: nowrap;
    animation: typewriter 3s steps(40) 1s both, blink-caret 0.5s step-end infinite;
}

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

/* ========================================
   ANIMAZIONI PER STATI DI CARICAMENTO
======================================== */

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

.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(--gold);
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

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

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

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

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

/* ========================================
   ANIMAZIONI RESPONSIVE
======================================== */

/* Ridotte per dispositivi mobili */
@media (max-width: 768px) {
    .fade-in-up {
        transform: translateY(8px);
    }
    
    .slide-in-left {
        transform: translateX(-20px);
    }
    
    .slide-in-right {
        transform: translateX(20px);
    }
    
    /* Tempi di animazione più veloci su mobile */
    .fade-in-up,
    .fade-in,
    .scale-in,
    .slide-in-left,
    .slide-in-right {
        transition-duration: 0.2s;
    }
}

/* ========================================
   ANIMAZIONI PER ACCESSIBILITY
======================================== */

/* Rispetta le preferenze di movimento ridotto */
@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;
    }
    
    .parallax-element,
    .parallax-bg {
        transform: none !important;
    }
    
    .hero {
        background-attachment: scroll;
    }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
======================================== */

/* GPU acceleration per elementi animati */
.will-change-transform {
    will-change: transform;
}

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

.hardware-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Contenimento del layout per animazioni */
.contain-layout {
    contain: layout style paint;
}
