/* ===========================
   MICRO-INTERACTIONS & ANIMATIONS
   Adventure Park Experience Enhancement
   Costa Rica Adventure Tourism
   =========================== */

/* ===========================
   ADVENTURE-THEMED ANIMATIONS
   =========================== */

/* Zipline swoosh effect */
@keyframes ziplineSwoosh {
  0% {
    transform: translateX(-100px) rotate(-15deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    transform: translateX(calc(100vw + 100px)) rotate(-15deg);
    opacity: 0;
  }
}

.zipline-swoosh {
  position: fixed;
  top: 20%;
  left: -100px;
  z-index: 1000;
  font-size: 2rem;
  pointer-events: none;
  animation: ziplineSwoosh 4s ease-in-out;
}

/* Volcano rumble effect */
@keyframes volcanoRumble {
  0%, 100% { transform: translateX(0); }
  10% { transform: translateX(-2px); }
  20% { transform: translateX(2px); }
  30% { transform: translateX(-2px); }
  40% { transform: translateX(2px); }
  50% { transform: translateX(-1px); }
  60% { transform: translateX(1px); }
  70% { transform: translateX(-1px); }
  80% { transform: translateX(1px); }
  90% { transform: translateX(-1px); }
}

.volcano-rumble {
  animation: volcanoRumble 3s ease-in-out;
}

/* Rainforest breeze effect */
@keyframes rainforestBreeze {
  0%, 100% {
    transform: translateX(0) rotate(0deg);
  }
  25% {
    transform: translateX(3px) rotate(1deg);
  }
  50% {
    transform: translateX(-2px) rotate(-0.5deg);
  }
  75% {
    transform: translateX(1px) rotate(0.5deg);
  }
}

.rainforest-breeze {
  animation: rainforestBreeze 6s ease-in-out infinite;
}

/* Canopy sway animation */
@keyframes canopySway {
  0%, 100% {
    transform: rotate(-1deg) translateY(0);
  }
  50% {
    transform: rotate(1deg) translateY(-2px);
  }
}

.canopy-sway {
  animation: canopySway 8s ease-in-out infinite;
  transform-origin: bottom center;
}

/* ===========================
   INTERACTIVE HOVER EFFECTS
   =========================== */

/* Adventure card interactions */
.adventure-hover {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-base);
}

.adventure-hover::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(
    from 0deg,
    transparent,
    rgba(0, 168, 89, 0.1),
    transparent,
    rgba(255, 111, 0, 0.1),
    transparent
  );
  opacity: 0;
  transition: all var(--transition-base);
  animation: adventureGlow 3s linear infinite paused;
  pointer-events: none;
}

.adventure-hover:hover::before {
  opacity: 1;
  animation-play-state: running;
}

.adventure-hover:hover {
  transform: translateY(-5px) scale(1.02);
  box-shadow: 
    0 15px 35px rgba(0, 168, 89, 0.2),
    0 8px 20px rgba(255, 111, 0, 0.1);
}

@keyframes adventureGlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Button click ripple effect */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.5) 0%,
    transparent 70%
  );
  transition: all 0.5s ease-out;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
}

.btn-ripple:active::after {
  width: 300px;
  height: 300px;
}

/* Navigation link underline animation */
.nav-link-animated {
  position: relative;
  text-decoration: none;
  overflow: hidden;
}

.nav-link-animated::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--primary-green) 0%,
    var(--secondary-green) 50%,
    var(--accent-blue) 100%
  );
  transition: left var(--transition-base);
}

.nav-link-animated:hover::before,
.nav-link-animated:focus::before {
  left: 0;
}

.nav-link-animated:hover::after,
.nav-link-animated:focus::after {
  left: 100%;
}

.nav-link-animated::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(
    90deg,
    var(--accent-blue) 0%,
    var(--secondary-green) 50%,
    var(--primary-green) 100%
  );
  transition: left var(--transition-base) 0.1s;
}

/* ===========================
   LOADING & TRANSITION EFFECTS
   =========================== */

/* Page loading animation */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    var(--primary-green) 0%,
    var(--secondary-green) 100%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.page-loader.loaded {
  opacity: 0;
  pointer-events: none;
}

.loader-content {
  text-align: center;
  color: var(--cloud-white);
}

.loader-logo {
  width: 120px;
  height: 120px;
  margin: 0 auto var(--space-lg);
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid var(--cloud-white);
  border-radius: 50%;
  animation: loaderSpin 1.5s linear infinite;
}

@keyframes loaderSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loader-text {
  font-family: var(--heading-font);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  animation: loaderPulse 2s ease-in-out infinite;
}

.loader-subtext {
  font-family: var(--accent-font);
  font-size: 1.1rem;
  opacity: 0.8;
  animation: loaderPulse 2s ease-in-out infinite 0.5s;
}

@keyframes loaderPulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* Section reveal animations */
.reveal-up {
  opacity: 0;
  transform: translateY(60px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.reveal-left {
  opacity: 0;
  transform: translateX(-60px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal-left.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(60px);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal-scale.revealed {
  opacity: 1;
  transform: scale(1);
}

/* ===========================
   SCROLL-TRIGGERED ANIMATIONS
   =========================== */

/* Parallax scroll indicators */
.scroll-indicator {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(0, 168, 89, 0.2);
  z-index: 100;
}

.scroll-progress {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--primary-green) 0%,
    var(--secondary-green) 50%,
    var(--accent-blue) 100%
  );
  width: 0%;
  transition: width 0.1s ease-out;
}

/* Adventure stats counter animation */
.stat-counter {
  font-family: var(--heading-font);
  font-weight: 800;
  font-size: 2rem;
  color: var(--sunset-orange);
  display: inline-block;
}

.stat-counter.counting {
  animation: statCount 2s ease-out;
}

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

/* ===========================
   INTERACTIVE FEEDBACK
   =========================== */

/* Success feedback animation */
.feedback-success {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--primary-green);
  color: var(--cloud-white);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transform: translateX(400px);
  transition: transform 0.3s ease-out;
  font-family: var(--heading-font);
  font-weight: 600;
}

.feedback-success.show {
  transform: translateX(0);
}

.feedback-success::before {
  content: '✓';
  margin-right: var(--space-sm);
  font-size: 1.2em;
}

/* Error feedback animation */
.feedback-error {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--error-red);
  color: var(--cloud-white);
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transform: translateX(400px);
  transition: transform 0.3s ease-out;
  font-family: var(--heading-font);
  font-weight: 600;
}

.feedback-error.show {
  transform: translateX(0);
}

.feedback-error::before {
  content: '⚠';
  margin-right: var(--space-sm);
  font-size: 1.2em;
}

/* ===========================
   PURA VIDA SPECIAL EFFECTS
   =========================== */

/* Pura Vida celebration animation */
.pura-vida-celebration {
  position: relative;
  overflow: hidden;
}

.pura-vida-celebration::after {
  content: '🎉';
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 2rem;
  opacity: 0;
  animation: puraVidaCelebrate 3s ease-out;
}

@keyframes puraVidaCelebrate {
  0% {
    top: -50px;
    opacity: 0;
    transform: translateX(-50%) scale(0.5);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) scale(1.2);
  }
  80% {
    opacity: 1;
    transform: translateX(-50%) scale(1);
  }
  100% {
    top: -100px;
    opacity: 0;
    transform: translateX(-50%) scale(0.5);
  }
}

/* Costa Rica flag colors wave */
.costa-rica-wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(
    90deg,
    #002868 0%,
    #002868 20%,
    #FFFFFF 20%,
    #FFFFFF 40%,
    #CE1126 40%,
    #CE1126 60%,
    #FFFFFF 60%,
    #FFFFFF 80%,
    #002868 80%,
    #002868 100%
  );
  background-size: 200px 6px;
  animation: costaRicaWave 10s linear infinite;
}

@keyframes costaRicaWave {
  0% { background-position-x: 0; }
  100% { background-position-x: 200px; }
}

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

/* Mobile touch feedback */
@media (max-width: 767px) {
  .adventure-hover:active {
    transform: scale(0.98);
    transition: transform 0.1s ease-out;
  }
  
  .btn-ripple:active {
    transform: scale(0.95);
  }
  
  .nav-link-animated:active {
    background: rgba(0, 168, 89, 0.1);
    border-radius: var(--radius-sm);
  }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 1023px) {
  .adventure-hover:hover {
    transform: translateY(-3px) scale(1.01);
  }
  
  .zipline-swoosh {
    font-size: 1.5rem;
  }
}

/* Desktop enhancements */
@media (min-width: 1024px) {
  .adventure-hover:hover {
    transform: translateY(-8px) scale(1.02);
  }
  
  .btn-ripple:hover {
    transform: translateY(-2px);
  }
  
  .nav-link-animated:hover {
    transform: translateY(-1px);
  }
}

/* ===========================
   ACCESSIBILITY CONSIDERATIONS
   =========================== */

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .zipline-swoosh,
  .volcano-rumble,
  .rainforest-breeze,
  .canopy-sway,
  .adventure-hover::before,
  .loader-logo,
  .loader-text,
  .loader-subtext,
  .stat-counter,
  .pura-vida-celebration::after,
  .costa-rica-wave {
    animation: none;
  }
  
  .reveal-up,
  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .adventure-hover,
  .btn-ripple,
  .nav-link-animated {
    transition: none;
  }
  
  .adventure-hover:hover,
  .btn-ripple:hover,
  .nav-link-animated:hover {
    transform: none;
  }
}

/* High contrast mode */
@media (prefers-contrast: high) {
  .scroll-progress {
    background: #000000;
  }
  
  .feedback-success {
    background: #008000;
    border: 2px solid #000000;
  }
  
  .feedback-error {
    background: #800000;
    border: 2px solid #000000;
  }
  
  .loader-logo {
    border-color: #000000;
    border-top-color: #000000;
  }
}

/* Focus visible for keyboard navigation */
.interactive-element:focus-visible {
  outline: 3px solid var(--accent-blue);
  outline-offset: 2px;
  animation: focusPulse 0.5s ease-in-out;
}

@keyframes focusPulse {
  0%, 100% { 
    outline-color: var(--accent-blue);
    outline-width: 3px;
  }
  50% { 
    outline-color: var(--primary-green);
    outline-width: 4px;
  }
}