/* ==========================================
   ANIMATIONS & SCROLL REVEALS
   ========================================== */

/* Initial states for scroll reveal */
.reveal-up {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-right {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal-scale {
  opacity: 0;
  transform: scale(0.95);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Active states (added via JS) */
.reveal-active {
  opacity: 1;
  transform: translate(0) scale(1);
}

/* Stagger delays */
.delay-100 { transition-delay: 100ms; }
.delay-200 { transition-delay: 200ms; }
.delay-300 { transition-delay: 300ms; }
.delay-400 { transition-delay: 400ms; }
.delay-500 { transition-delay: 500ms; }

/* Typewriter Cursor Effect */
.typewriter-cursor {
  display: inline-block;
  width: 5px;
  height: 0.9em;
  background-color: var(--color-primary-red);
  margin-left: 6px;
  vertical-align: text-bottom;
}

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

/* ==========================================
   PRELOADER
   ========================================== */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--color-bg-white);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: transform 1.2s cubic-bezier(1, 0, 0, 1);
}

.preloader-finish {
  transform: translateY(-100%);
  pointer-events: none;
}

.loader-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loader-logo {
  width: 280px;
  max-width: 80vw;
  opacity: 0;
  transform: scale(0.95);
  animation: loaderFadeScale 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.loader-logo img {
  width: 100%;
  height: auto;
}

.loader-line {
  width: 0;
  height: 2px;
  background: var(--color-primary-red);
  margin-top: 25px;
  animation: loaderLineExtend 1.8s ease-in-out forwards;
}

.loader-text {
  margin-top: 18px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.35rem;
  color: var(--color-text-dark);
  opacity: 0;
  animation: loaderFade 0.8s 1.2s forwards;
}

@keyframes loaderFadeScale {
  to { opacity: 1; transform: scale(1); }
}

@keyframes loaderLineExtend {
  to { width: 320px; }
}

@keyframes loaderFade {
  to { opacity: 1; }
}

/* ==========================================
   HERO IMAGE AMBIENT ANIMATION
   ========================================== */
.hero-img-drift {
  animation: heroFloat 20s ease-in-out infinite alternate;
}

@keyframes heroFloat {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-15px) translateX(10px) rotate(0.5deg) scale(1.02); }
  100% { transform: translateY(0) scale(1); }
}

.hero-img-wrapper {
  transition: transform 1.5s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}

.hero-img-wrapper img {
  transition: transform 2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================
   CHATBOT FLOATING ANIMATION
   ========================================== */
#n8n-chat-container {
  position: fixed;
  bottom: 40px; /* Restored to lower position since scroll button is hidden */
  right: 30px;
  z-index: 99999;
  overflow: visible !important;
}

@media (max-width: 576px) {
  #n8n-chat-container {
    bottom: 20px;
    right: 15px;
  }
}

/* Aggressive Small Chat Window Override */
#n8n-chat-container div, 
#n8n-chat-container section, 
#n8n-chat-container article {
  max-width: 320px !important;
  max-height: 400px !important;
}

#n8n-chat-container h1, 
#n8n-chat-container h2, 
#n8n-chat-container .chat-header-title {
  font-size: 1rem !important; /* Make title much smaller */
  margin: 0 !important;
  padding: 5px !important;
}

#n8n-chat-container .chat-header {
  padding: 10px !important;
  min-height: auto !important;
}

/* Position the compact window */
.n8n-chat-widget-panel,
#n8n-chat-container > div {
  width: 320px !important;
  height: 400px !important;
  bottom: 90px !important; 
  right: 20px !important;
}

@keyframes chatNudge {
  0% { transform: translateY(0) scale(1.0); }
  50% { transform: translateY(-8px) scale(1.05); }
  100% { transform: translateY(0) scale(1.0); }
}

/* Target the toggle button created by the library */
.n8n-chat-widget {
  animation: chatNudge 4s ease-in-out infinite;
}

/* Optional: Pause animation on hover */
.n8n-chat-widget:hover {
  animation-play-state: paused;
}
