/* Page Transition Overlay */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--dark-olive) 0%, var(--darker-olive) 100%);
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-transition-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.page-transition-overlay.slide-left {
    transform: translateX(-100%);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-transition-overlay.slide-left.active {
    transform: translateX(0);
}

.page-transition-overlay.slide-right {
    transform: translateX(100%);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-transition-overlay.slide-right.active {
    transform: translateX(0);
}

.page-transition-overlay.fade {
    transition: opacity 0.5s ease-in-out;
}

/* Page content transitions */
body {
    opacity: 1;
    transition: opacity 0.5s ease-in-out;
}

body.page-exiting {
    opacity: 0;
}

body.page-entering {
    animation: pageEnter 0.6s ease-out forwards;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stacked List Animation - Menu Items */
.menu-item-card {
    position: relative;
    z-index: 1;
    transform-origin: center;
}

.menu-item-card.stacked {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-item-card.stacked.animate-in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.menu-item-card.stacked:nth-child(1) { z-index: 7; }
.menu-item-card.stacked:nth-child(2) { z-index: 6; }
.menu-item-card.stacked:nth-child(3) { z-index: 5; }
.menu-item-card.stacked:nth-child(4) { z-index: 4; }
.menu-item-card.stacked:nth-child(5) { z-index: 3; }
.menu-item-card.stacked:nth-child(6) { z-index: 2; }
.menu-item-card.stacked:nth-child(n+7) { z-index: 1; }

/* Gallery items stacked */
.menu-gallery-item.stacked {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-gallery-item.stacked.animate-in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.menu-gallery-item.stacked:nth-child(1) { z-index: 7; transition-delay: 0.1s; }
.menu-gallery-item.stacked:nth-child(2) { z-index: 6; transition-delay: 0.2s; }
.menu-gallery-item.stacked:nth-child(3) { z-index: 5; transition-delay: 0.3s; }
.menu-gallery-item.stacked:nth-child(4) { z-index: 4; transition-delay: 0.4s; }
.menu-gallery-item.stacked:nth-child(5) { z-index: 3; transition-delay: 0.5s; }
.menu-gallery-item.stacked:nth-child(6) { z-index: 2; transition-delay: 0.6s; }
.menu-gallery-item.stacked:nth-child(7) { z-index: 1; transition-delay: 0.7s; }

/* Feature cards stacked */
.feature-card.stacked {
    opacity: 0;
    transform: translateY(30px) rotateX(15deg);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card.stacked.animate-in {
    opacity: 1;
    transform: translateY(0) rotateX(0);
}

.feature-card.stacked:nth-child(1) { z-index: 4; transition-delay: 0.1s; }
.feature-card.stacked:nth-child(2) { z-index: 3; transition-delay: 0.2s; }
.feature-card.stacked:nth-child(3) { z-index: 2; transition-delay: 0.3s; }
.feature-card.stacked:nth-child(4) { z-index: 1; transition-delay: 0.4s; }

/* Gallery items in rooms page */
.gallery-item-room.stacked {
    opacity: 0;
    transform: translateY(50px) scale(0.85);
    transition: all 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item-room.stacked.animate-in {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Menu items hover effect with stacking */
.menu-item-card.stacked:hover {
    transform: translateY(-10px) scale(1.02) !important;
    z-index: 10 !important;
    box-shadow: 0 20px 50px rgba(212, 175, 55, 0.4);
}

.menu-gallery-item.stacked:hover {
    transform: translateY(-15px) scale(1.05) !important;
    z-index: 10 !important;
}

/* Category stacking animation */
.menu-category {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.6s ease-out;
}

.menu-category.animate-in {
    opacity: 1;
    transform: translateX(0);
}

/* Staggered animation for categories */
.menu-category:nth-child(1) { transition-delay: 0.1s; }
.menu-category:nth-child(2) { transition-delay: 0.2s; }
.menu-category:nth-child(3) { transition-delay: 0.3s; }
.menu-category:nth-child(4) { transition-delay: 0.4s; }
.menu-category:nth-child(5) { transition-delay: 0.5s; }
.menu-category:nth-child(6) { transition-delay: 0.6s; }

/* Loading animation */
.page-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--dark-olive) 0%, var(--darker-olive) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.page-loading.hide {
    opacity: 0;
    pointer-events: none;
}

.page-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(212, 175, 55, 0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Enhanced stacking effect with depth */
.menu-item-card.stacked::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), transparent);
    border-radius: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: -1;
}

.menu-item-card.stacked:hover::before {
    opacity: 1;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .menu-item-card.stacked {
        transform: translateY(20px) scale(0.98);
    }

    .menu-gallery-item.stacked {
        transform: translateY(30px) scale(0.95);
    }

    .page-transition-overlay {
        transition: opacity 0.4s ease;
    }
}
