/* Enhanced Animations for FANR Website */

/* ===== BASIC ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== ADVANCED ANIMATIONS ===== */
@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

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

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

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* ===== SCROLL ANIMATIONS ===== */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease-out;
}

.animate-on-scroll.animated {
  opacity: 1;
  transform: translateY(0);
}

.animate-on-scroll-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: all 0.6s ease-out;
}

.animate-on-scroll-left.animated {
  opacity: 1;
  transform: translateX(0);
}

.animate-on-scroll-right {
  opacity: 0;
  transform: translateX(30px);
  transition: all 0.6s ease-out;
}

.animate-on-scroll-right.animated {
  opacity: 1;
  transform: translateX(0);
}

.animate-on-scroll-scale {
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.6s ease-out;
}

.animate-on-scroll-scale.animated {
  opacity: 1;
  transform: scale(1);
}

/* ===== HERO SECTION ANIMATIONS ===== */
.hero-text {
  animation: fadeInLeft 0.8s ease-out;
}

.hero-visual {
  animation: fadeInRight 0.8s ease-out 0.2s both;
}

.hero-actions {
  animation: fadeInUp 0.8s ease-out 0.4s both;
}

/* ===== ANIMATE CLASS FOR JAVASCRIPT ===== */
.hero-text.animate,
.hero-visual.animate,
.hero-actions.animate {
  opacity: 1 !important;
  transform: translateY(0) translateX(0) !important;
  animation-fill-mode: both !important;
  display: block !important;
  visibility: visible !important;
}

/* Maximum specificity override for hero-visual animations */
html body .hero-visual.animate {
  opacity: 1 !important;
  transform: translateY(0) translateX(0) !important;
  animation: fadeInUp 0.6s ease-out !important;
  display: block !important;
  visibility: visible !important;
}

html body .hero-visual.animate .house-image-card,
html body .hero-visual.animate .experience-badge,
html body .hero-visual.animate .hero-card {
  opacity: 1 !important;
  transform: translateY(0) !important;
  animation: fadeInUp 0.6s ease-out !important;
  display: block !important;
  visibility: visible !important;
}

/* Fallback animation - should work no matter what */
@keyframes simpleFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-visual {
  animation: simpleFadeIn 1s ease-out !important;
}

.hero-visual .house-image-card,
.hero-visual .experience-badge,
.hero-visual .hero-card {
  animation: simpleFadeIn 1s ease-out !important;
}

/* ===== NAVIGATION ANIMATIONS ===== */
.navbar {
  animation: slideInDown 0.6s ease-out;
}

.nav-link {
  transition: all 0.3s ease;
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #00478e, #66b2ff);
  transition: width 0.3s ease;
}

.nav-link:hover::after {
  width: 100%;
}

.nav-link:hover {
  transform: translateY(-2px);
  color: #00478e;
}

/* ===== BUTTON ANIMATIONS ===== */
.btn-primary,
.btn-secondary {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary::before,
.btn-secondary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s ease;
}

.btn-primary:hover::before,
.btn-secondary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 71, 142, 0.3);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 178, 255, 0.3);
}

/* ===== SERVICE CARDS ANIMATIONS ===== */
.service-card {
  transition: all 0.3s ease;
  animation: fadeInUp 0.6s ease-out;
}

.service-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.service-card:hover .service-icon {
  animation: bounce 0.6s ease;
}

.service-icon {
  transition: all 0.3s ease;
}

.service-card:hover .service-icon {
  transform: scale(1.1);
}

/* ===== VISION SECTION ANIMATIONS ===== */
.vision-item {
  transition: all 0.3s ease;
}

.vision-item:hover {
  transform: translateY(-5px);
}

.vision-number {
  animation: pulse 2s infinite;
}

/* ===== PROGRESS BARS ANIMATION ===== */
.progress-bar {
  animation: slideInUp 0.8s ease-out;
  overflow: hidden;
}

.progress-line-fill {
  position: relative;
  height: 100%;
  background: linear-gradient(90deg, #00478e, #66b2ff);
  border-radius: 4px;
  transform: scaleX(0);
  transform-origin: left;
  animation: progressFill 2s ease-out 0.5s both;
  box-shadow: 0 2px 8px rgba(0, 71, 142, 0.3);
}

.progress-line-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  opacity: 0;
  animation: shimmer 3s ease-in-out 2.5s infinite;
}

@keyframes progressFill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes shimmer {
  0% {
    opacity: 0;
    transform: translateX(-100%);
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ===== CONTACT SECTION ANIMATIONS ===== */
.contact-item {
  transition: all 0.3s ease;
}

.contact-item:hover {
  transform: translateX(10px);
}

.social-link {
  transition: all 0.3s ease;
}

.social-link:hover {
  transform: translateY(-5px) scale(1.1);
}

/* ===== FOOTER ANIMATIONS ===== */
.footer {
  animation: fadeInUp 0.8s ease-out;
}

/* ===== LOADING ANIMATIONS ===== */
@keyframes loadingDots {
  0%, 20% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  80%, 100% {
    opacity: 0;
  }
}

.loading-dots::after {
  content: '';
  animation: loadingDots 1.5s infinite;
}

/* ===== PARALLAX EFFECTS ===== */
.parallax-slow {
  transform: translateZ(0);
  will-change: transform;
}

.parallax-medium {
  transform: translateZ(0);
  will-change: transform;
}

.parallax-fast {
  transform: translateZ(0);
  will-change: transform;
}

/* ===== STAGGERED ANIMATIONS ===== */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* ===== RESPONSIVE ANIMATIONS ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
.animated-element {
  will-change: transform, opacity;
  backface-visibility: hidden;
  perspective: 1000px;
}

/* ===== ADDITIONAL ANIMATION EFFECTS ===== */
/* Ripple Effect for Buttons */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  transform: scale(0);
  animation: ripple-animation 0.6s linear;
  pointer-events: none;
}

@keyframes ripple-animation {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

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

.navbar.scrolled {
  background: rgba(255, 255, 255, 0.98) !important;
  box-shadow: 0px 2px 20px 0px rgba(0, 0, 0, 0.15) !important;
  backdrop-filter: blur(10px);
}

/* Loading States */
.loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #00478e;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Page Load Animation */
body {
  opacity: 0;
  transition: opacity 0.5s ease;
}

body.loaded {
  opacity: 1;
}

/* FAQ Answer Animation */
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
  max-height: 200px;
}

/* Enhanced Service Card Animations */
.service-card {
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 71, 142, 0.1), transparent);
  transition: left 0.5s ease;
}

.service-card:hover::before {
  left: 100%;
}

/* Vision Number Counter Animation */
.vision-number {
  font-variant-numeric: tabular-nums;
}

/* Progress Bar Enhancements */
.progress-line-fill {
  position: relative;
  overflow: hidden;
}

.progress-line-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 2s infinite;
}

/* Contact Item Hover Effects */
.contact-item {
  position: relative;
  overflow: hidden;
}

.contact-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0, 71, 142, 0.05), transparent);
  transition: left 0.3s ease;
}

.contact-item:hover::before {
  left: 100%;
}

/* Social Link Enhancements */
.social-link {
  position: relative;
  overflow: hidden;
}

.social-link::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(0, 71, 142, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
}

.social-link:hover::before {
  width: 100%;
  height: 100%;
}

/* Mobile Responsive Animations */
@media (max-width: 768px) {
  .hero-text,
  .hero-visual {
    animation: fadeInUp 0.6s ease-out;
  }
  
  .service-card {
    animation: fadeInUp 0.6s ease-out;
  }
  
  .animate-on-scroll-left,
  .animate-on-scroll-right {
    animation: fadeInUp 0.6s ease-out;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .hero-text,
  .hero-visual,
  .hero-actions {
    animation: none;
  }
  
  .service-card,
  .vision-item,
  .contact-item {
    transition: none;
  }
  
  .navbar {
    transition: none;
  }
}
