/* Global Styles */
:root {
    --primary-color: #059669;
    --secondary-color: #b45309;
    --shimmer-start: #f0f0f0;
    --shimmer-mid: #e0e0e0;
    --shimmer-end: #f0f0f0;
    --border-radius: 0.5rem;
}

:root[data-theme="light"] {
    --bg-body: #f9fafb;
    --bg-nav: #ffffff;
    --text-main: #1f2937;
    --text-nav: #065f46;
    --shimmer-start: #f0f0f0;
    --shimmer-mid: #e0e0e0;
    --shimmer-end: #f0f0f0;
    --text-muted: #4b5563;
    --card-bg: #ffffff;
}

:root[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-nav: #1e293b;
    --text-nav: #f8fafc;
    --text-main: #f8fafc;
    --shimmer-start: #1e293b;
    --shimmer-mid: #334155;
    --shimmer-end: #1e293b;
    --text-muted: #94a3b8;
    --card-bg: #1e293b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    width: 100%;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    color: var(--text-main);
    background-color: var(--bg-body);
    line-height: 1.6;
    opacity: 0;
    animation: bodyFadeIn 0.8s ease-out forwards;
    overflow-x: hidden;
    width: 100%;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bodyFadeIn {
    from { opacity: 0; } to { opacity: 1; }
}

@keyframes active-pulse {
    0%, 100% { transform: scale(1.2) translateZ(0); opacity: 1; }
    50% { transform: scale(1.5) translateZ(0); opacity: 0.8; box-shadow: 0 0 15px var(--primary-color); }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Shimmer Animation for Skeleton Loading */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Navigation */
nav {
    background-color: var(--bg-nav) !important;
    transition: background-color 0.4s ease, border-color 0.4s ease;
    animation: fadeIn 0.5s ease-out;
}

.nav-link {
    position: relative;
    color: var(--text-nav) !important;
    transition: color 0.4s ease, opacity 0.3s ease;
}

.nav-link svg { color: inherit; }

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -4px;
    left: 0;
    background-color: #b45309;
    transition: width 0.3s ease;
    will-change: width;
}

/* Smooth Scrolling for iOS */
.overflow-y-auto {
    -webkit-overflow-scrolling: touch;
}

.nav-link:hover::after {
    width: 100%;
}

/* Theme-aware utilities */
.text-main {
    color: var(--text-main) !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

.bg-card {
    background-color: var(--card-bg) !important;
}

.bg-body-theme {
    background-color: var(--bg-body) !important;
}

.nav-bg {
    background-color: var(--bg-nav) !important;
}

/* Language Toggle */
.lang-toggle {
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-toggle.active {
    background-color: #059669;
    color: white;
}

/* Banner Logo Optimization */
.brand-logo {
    height: 80px; /* Increased height for maximum visibility */
    width: auto;
    max-width: 100%;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
    backface-visibility: hidden;
}

/* Theme Toggle Icon Logic */
#theme-toggle .sun-icon,
#theme-toggle .moon-icon,
[data-theme-toggle] .sun-icon,
[data-theme-toggle] .moon-icon {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* Footer Clock Styling */
#cambodia-footer-clock {
    transition: color 0.4s ease;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.025em;
    opacity: 0.9;
}

.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    position: relative;
}

.live-dot::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: inherit;
    border-radius: 50%;
    animation: live-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes live-ping {
    75%, 100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

/* Hero Section */
.hero-section {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Relocates text to the lower part */
    align-items: center;      /* Centers text horizontally */
    text-align: center;
    padding-bottom: 3rem;     /* Spacing from the bottom edge */
    background-attachment: fixed;
    background-size: cover;
    background-position: center;
    will-change: transform;
    animation: fadeIn 1.5s ease-out; /* Symmetrical background fade */
}

/* Disable fixed background on mobile for performance */
@media (max-width: 1024px) {
    .hero-section, .hero-slider, #hero-slider { background-attachment: scroll !important; }
}

.hero-section h1 {
    /* Animation properties moved to shadow classes for global "Reveal and Vanish" behavior */
    text-wrap: balance;
    max-width: 900px;
    line-height: 1;
    margin: 0;
}

.hero-section p {
    /* Animation properties moved to shadow classes for global "Reveal and Vanish" behavior */
    line-height: 1;
    margin: 0;
}

/* Cards */
.tour-card {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease;
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.tour-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-8px);
}

/* Unified Image Container: Aspect Ratio & Lazy Loading */
.tour-image-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; /* Consistent 16:9 ratio for all cards */
    overflow: hidden;
    background-color: var(--bg-body); /* Placeholder background while loading */
}
.tour-image-container:has(img.lazy),
.tour-image-container:has(img[data-src]) {
    background: linear-gradient(to right, var(--shimmer-start) 8%, var(--shimmer-mid) 18%, var(--shimmer-end) 33%);
    background-size: 1000px 100%;
    animation: shimmer 1.5s infinite linear;
}

.tour-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease-in-out;
}

/* Stop shimmer when image is loaded */
.tour-image-container:has(img.loaded) {
    animation: none;
    background-image: none;
}

/* Fix for mobile horizontal scroll issues */
.overflow-x-hidden-mobile {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

.filter-btn {
    background-color: #f3f4f6;
    color: #1f2937;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.filter-btn.active {
    background-color: #059669;
    color: white;
    border-color: #059669;
}

.filter-btn:hover {
    border-color: #059669;
    background-color: #ecfdf5;
}

/* Gallery */
.gallery-image {
    cursor: pointer;
    transition: all 0.3s ease;
}

.gallery-image img {
    transition: transform 0.4s ease;
}

/* Forms */
input, textarea, select {
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* Buttons */
button, a.btn {
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

button:active, a.btn:active {
    transform: scale(0.98);
}

/* Footer */
footer {
    animation: fadeIn 0.5s ease-out 0.3s backwards;
}

footer a {
    transition: color 0.3s ease;
}

/* Mobile Menu */
#mobile-menu {
    animation: slideInLeft 0.3s ease-out;
}

.mobile-dropdown {
    transition: all 0.3s ease;
}

/* Responsive Typography */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 1.875rem;
    }
    
    h3 {
        font-size: 1.5rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print Styles */
@media print {
    nav,
    footer,
    .print-hidden {
        display: none;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #059669;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #047857;
}

/* Cinematic Subtitle Shadows */
.hero-title-shadow {
    text-shadow: 0 4px 15px rgba(0,0,0,0.9), 0 2px 30px rgba(0,0,0,0.5), 0 0 60px rgba(0,0,0,0.3);
}
.hero-sub-shadow {
    text-shadow: 0 2px 12px rgba(0,0,0,0.9);
}

/* Utility Classes */
.text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.gradient-text {
    background: linear-gradient(135deg, #059669, #b45309);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(5, 150, 105, 0.3);
    border-radius: 50%;
    border-top-color: #059669;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
        transform: rotate(360deg) translateZ(0);
    }
}

/* Smooth Transitions */
html {
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

/* Link Transitions */
a {
    transition: color 0.3s ease, opacity 0.3s ease;
}

a:hover {
    opacity: 0.8;
}

/* Image Optimization */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Lazy Loading Fade-in Animation */
.lazy, img[data-src] {
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

.reveal-on-scroll {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    will-change: opacity, transform;
}
.reveal-on-scroll.is-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

.loaded {
    opacity: 1;
    transform: translateZ(0);
}

/* Table Styling */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

table th,
table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

table th {
    background-color: #059669;
    color: white;
    font-weight: bold;
}

table tr:hover {
    background-color: #f9fafb;
}

/* 3D Debossed Icon Styles */
.icon-recess {
    width: 60px;
    height: 60px;
    background: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    box-shadow: 
        inset 4px 4px 8px #0a0e18,
        inset -4px -4px 8px #182236;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.icon-recess i {
    color: #333;
    font-size: 1.5rem;
    transition: all 0.5s ease;
    z-index: 2;
}
.icon-recess:hover i {
    color: #fbbf24;
    filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.7));
}
.icon-recess:hover {
    box-shadow:
        inset 2px 2px 4px #080b12,
        inset -2px -2px 4px #1a243a,
        0 0 20px rgba(251, 191, 36, 0.05);
    transform: translateY(-2px);
}

@media (max-width: 640px) {
    .icon-recess {
        width: 48px;
        height: 48px;
    }
    .icon-recess i { font-size: 1.25rem; }
}

/* Marquee Animation */
@keyframes marquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.animate-marquee {
    animation: marquee 45s linear infinite;
    display: inline-flex;
    white-space: nowrap;
    min-width: 100%;
    transform: translateZ(0); /* Hardware Acceleration */
    will-change: transform;
    width: max-content;
    gap: 4rem;
}

/* Global Hero Slider Transition */
#hero-slider {
    /* The opacity transition is handled by #hero-bg-1 and #hero-bg-2 */
    background-blend-mode: overlay;
    background-color: rgba(6, 78, 59, 0.7);
    background-attachment: scroll; /* Performance win */
}

#hero-bg-1, #hero-bg-2 {
    will-change: opacity, transform;
    image-rendering: -webkit-optimize-contrast;
    backface-visibility: hidden;
    transform: translateZ(0);
    /* Haze Reduction Filter: Boosts contrast and depth */
    filter: contrast(1.08) brightness(1.02) saturate(1.05);
}

/* Mobile Optimization: Remove expensive filters to ensure buttery smooth transitions on lower-end devices */
@media (max-width: 768px) {
    #hero-bg-1, #hero-bg-2 { filter: none !important; }
}

/* Hero Gradient Overlay */
.hero-gradient-overlay {
    background-image: linear-gradient(to top, rgba(0, 0, 0, 0.4), transparent, transparent);
    animation: gradientFadeOut 2s ease-out forwards; /* Sync with 2.0s vanish */
    animation-delay: 0s;
}

/* Static subtle vignette for UI visibility on index.html */
.hero-vignette-static {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.3) 0%, transparent 15%);
    pointer-events: none;
}
/* Grand Tour Hero (Index Specific but Global Component) */
/* Slider Indicators */
.slider-ball {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    transition: all 0.5s ease;
    transform: translateZ(0); /* Force GPU Acceleration */
    animation: fadeIn 0.8s ease-out backwards; /* Entrance animation */
    margin-bottom: 4px; /* Space for wrapped indicators on small mobile */
}

.slider-ball:hover {
    transform: scale(1.4) translateZ(0);
    background-color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
}

.slider-ball.active {
    background-color: var(--primary-color);
    animation: active-pulse 2.5s infinite ease-in-out; /* Pulsing animation */
}

/* Utilities */
.tour-thumbnail {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
    backface-visibility: hidden;
}

.tour-thumbnail:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
    border-color: rgba(255, 255, 255, 1);
}
.volunteer-icon {
    transition: transform 0.3s ease-in-out;
}

.volunteer-card:hover .volunteer-icon {
    transform: scale(1.2); /* Scale up the icon on hover */
}

.label-blur { backdrop-filter: blur(12px); background: rgba(0, 0, 0, 0.4); }
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* FAQ Styles */
.faq-answer { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-in-out; }
.faq-item.active .faq-answer { max-height: 1000px; }
.faq-item.active .fa-chevron-down { transform: rotate(180deg); }
.faq-animate { animation: faqFadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
@keyframes faqFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.faq-highlight {
    background-color: rgba(251, 191, 36, 0.3);
    border-bottom: 2px solid #fbbf24;
    border-radius: 2px;
}

/* Google Review Footer Style */
.google-review-footer-container {
    text-align: center;
    padding: 10px;
}
.google-review-footer-link {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: bold;
    font-size: 16px;
    color: #4285F4;
    text-decoration: none;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.google-review-footer-link:hover {
    color: #1a73e8;
    text-decoration: underline;
    transform: scale(1.02);
}
.google-review-footer-link .stars { letter-spacing: 2px; }

/* Cookie Banner */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(10px);
    color: white;
    padding: 1.25rem;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.3);
}

#cookie-banner.show {
    transform: translateY(0);
}
