/* ================================
   Animations & Transitions
   ================================ */

/* ===== Fade In on Scroll ===== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

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

/* Apply fade-in to sections */
.section > .container {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.section:nth-child(2) > .container { animation-delay: 0.1s; }
.section:nth-child(3) > .container { animation-delay: 0.2s; }
.section:nth-child(4) > .container { animation-delay: 0.3s; }
.section:nth-child(5) > .container { animation-delay: 0.4s; }

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

/* ===== Hero Animations ===== */
.hero-content > * {
    opacity: 0;
    animation: fadeInUp 0.8s ease-out forwards;
}

.hero-title {
    animation-delay: 0.2s;
}

.hero-subtitle {
    animation-delay: 0.4s;
}

.rating {
    animation-delay: 0.6s;
}

.hero-content .btn {
    animation-delay: 0.8s;
}

.hero-scroll {
    animation-delay: 1s;
}

/* ===== Feature Cards Stagger ===== */
.feature-item {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease-out forwards;
}

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

/* ===== Gallery Items Stagger ===== */
.gallery-item {
    opacity: 0;
    transform: scale(0.9);
    animation: fadeInScale 0.6s ease-out forwards;
}

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

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

/* ===== Button Hover Effects ===== */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn span,
.btn svg {
    position: relative;
    z-index: 1;
}

/* ===== Floating Animation for WhatsApp Button ===== */
@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.whatsapp-float:hover {
    animation: float 1s ease-in-out infinite;
}

/* ===== Pulse Animation for Rating Stars ===== */
.stars span {
    display: inline-block;
    animation: starPulse 2s ease-in-out infinite;
}

.stars span:nth-child(1) { animation-delay: 0s; }
.stars span:nth-child(2) { animation-delay: 0.1s; }
.stars span:nth-child(3) { animation-delay: 0.2s; }
.stars span:nth-child(4) { animation-delay: 0.3s; }
.stars span:nth-child(5) { animation-delay: 0.4s; }

@keyframes starPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* ===== Nav Link Hover Effect ===== */
.nav-menu a {
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--accent-teal);
    transform: translateX(-50%);
    transition: width 0.3s ease;
}

.nav-menu a:hover::after {
    width: 80%;
}

/* ===== Image Zoom on Hover ===== */
.tour-image,
.gallery-item {
    overflow: hidden;
}

.tour-image img,
.gallery-item img {
    transition: transform 0.4s ease;
}

.tour-image:hover img,
.gallery-item:hover img {
    transform: scale(1.1);
}

/* ===== Contact Item Hover ===== */
.contact-item {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.contact-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* ===== Tour Badge Animation ===== */
.tour-badge {
    animation: badgeBounce 2s ease-in-out infinite;
}

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

/* ===== Loading Animation (optional) ===== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== Smooth Color Transitions ===== */
a,
button,
.feature-item,
.gallery-item,
.contact-item,
.nav-menu a,
.lang-dropdown button,
.footer-links a {
    transition: all 0.3s ease;
}

/* ===== Focus Visible (Accessibility) ===== */
a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--accent-teal);
    outline-offset: 3px;
    animation: focusPulse 1s ease-in-out infinite;
}

@keyframes focusPulse {
    0%, 100% {
        outline-color: var(--accent-teal);
    }
    50% {
        outline-color: var(--primary-green);
    }
}

/* ===== Shimmer Effect for Placeholders ===== */
.shimmer {
    background: linear-gradient(
        90deg,
        var(--light-gray) 0%,
        var(--light-bg) 50%,
        var(--light-gray) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

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

/* ===== Slide In from Left ===== */
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== Slide In from Right ===== */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== Page Load Animation ===== */
body {
    animation: fadeIn 0.5s ease-out;
}

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

/* ===== Navbar Scroll Animation ===== */
.navbar {
    transition: all 0.3s ease;
}

.navbar.scrolled {
    padding: 0.5rem 0;
}

.navbar.scrolled .nav-brand h2 {
    font-size: 1.25rem;
}

/* ===== Section Reveal on Scroll (JS will add 'revealed' class) ===== */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Price Highlight Animation ===== */
.price {
    position: relative;
}

.price::before {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--accent-teal);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.tour-detail-item:hover .price::before {
    transform: scaleX(1);
}

/* ===== Responsive Animation Adjustments ===== */
@media (max-width: 768px) {
    /* Reduce animation delays on mobile for faster experience */
    .hero-content > *,
    .feature-item,
    .gallery-item {
        animation-duration: 0.5s;
    }

    .feature-item:nth-child(n) { animation-delay: 0.05s; }
    .gallery-item:nth-child(n) { animation-delay: 0.05s; }

    /* Disable parallax on mobile */
    .hero {
        background-attachment: scroll !important;
    }
}

/* ===== Disable Animations for Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .fade-in,
    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }
}
