/* 
 * BERLIN IMMOBILIEN - Animations & Micro-interactions
 * Enhanced animations and interactive elements for the real estate website
 */

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

/* Button Ripple Effect */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%, -50%);
  transform-origin: 50% 50%;
}

.btn-ripple:hover::after {
  animation: ripple 1s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 0.5;
  }
  100% {
    transform: scale(20, 20);
    opacity: 0;
  }
}

/* Card Hover Effects */
.card-hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover-lift:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.card-hover-glow {
  transition: box-shadow 0.3s ease;
}

.card-hover-glow:hover {
  box-shadow: 0 0 20px rgba(120, 115, 245, 0.4);
}

.card-hover-border {
  position: relative;
  transition: transform 0.3s ease;
}

.card-hover-border::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border: 2px solid transparent;
  border-radius: inherit;
  transition: border-color 0.3s ease;
  pointer-events: none;
}

.card-hover-border:hover {
  transform: translateY(-5px);
}

.card-hover-border:hover::after {
  border-color: var(--primary-violet);
}

/* Image Hover Effects */
.img-hover-zoom {
  overflow: hidden;
}

.img-hover-zoom img {
  transition: transform 0.5s ease;
}

.img-hover-zoom:hover img {
  transform: scale(1.1);
}

.img-hover-rotate {
  overflow: hidden;
}

.img-hover-rotate img {
  transition: transform 0.5s ease;
}

.img-hover-rotate:hover img {
  transform: rotate(5deg) scale(1.1);
}

.img-hover-filter {
  overflow: hidden;
}

.img-hover-filter img {
  transition: filter 0.5s ease;
}

.img-hover-filter:hover img {
  filter: brightness(1.1) contrast(1.1) saturate(1.2);
}

/* Link Hover Effects */
.link-hover-underline {
  position: relative;
}

.link-hover-underline::after {
  content: '';
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: -2px;
  left: 0;
  background: linear-gradient(to right, var(--primary-turquoise), var(--primary-violet));
  transform: scaleX(0);
  transform-origin: bottom right;
  transition: transform 0.3s ease;
}

.link-hover-underline:hover::after {
  transform: scaleX(1);
  transform-origin: bottom left;
}

.link-hover-shift {
  transition: transform 0.2s ease;
  display: inline-block;
}

.link-hover-shift:hover {
  transform: translateX(5px);
}

.link-hover-glow {
  transition: text-shadow 0.3s ease;
}

.link-hover-glow:hover {
  text-shadow: 0 0 8px rgba(120, 115, 245, 0.5);
}

/* ===== MICRO-ANIMATIONS ===== */

/* Pulse Animation */
.pulse {
  animation: pulse 2s infinite;
}

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

/* Floating Animation */
.float {
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
  100% {
    transform: translateY(0px);
  }
}

/* Shake Animation */
.shake {
  animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% {
    transform: translate3d(-1px, 0, 0);
  }
  
  20%, 80% {
    transform: translate3d(2px, 0, 0);
  }

  30%, 50%, 70% {
    transform: translate3d(-4px, 0, 0);
  }

  40%, 60% {
    transform: translate3d(4px, 0, 0);
  }
}

/* Bounce Animation */
.bounce {
  animation: bounce 1s infinite;
}

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

/* Fade In Animation */
.fade-in {
  animation: fadeIn 1s ease forwards;
}

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

/* Slide Up Animation */
.slide-up {
  animation: slideUp 0.8s ease forwards;
}

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

/* Slide In Left Animation */
.slide-in-left {
  animation: slideInLeft 0.8s ease forwards;
}

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

/* Slide In Right Animation */
.slide-in-right {
  animation: slideInRight 0.8s ease forwards;
}

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

/* Rotate Animation */
.rotate {
  animation: rotate 10s linear infinite;
}

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

/* ===== SCROLL ANIMATIONS ===== */

/* Fade In On Scroll */
.fade-in-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

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

/* Scale In On Scroll */
.scale-in-scroll {
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scale-in-scroll.visible {
  opacity: 1;
  transform: scale(1);
}

/* Slide In Left On Scroll */
.slide-in-left-scroll {
  opacity: 0;
  transform: translateX(-50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-left-scroll.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Slide In Right On Scroll */
.slide-in-right-scroll {
  opacity: 0;
  transform: translateX(50px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-in-right-scroll.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Staggered Animation Delays */
.stagger-1 { transition-delay: 0.1s; }
.stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; }
.stagger-4 { transition-delay: 0.4s; }
.stagger-5 { transition-delay: 0.5s; }
.stagger-6 { transition-delay: 0.6s; }

/* ===== GRADIENT ANIMATIONS ===== */

/* Animated Gradient Background */
.gradient-animate {
  background: linear-gradient(270deg, var(--primary-turquoise), var(--primary-blue), var(--primary-violet));
  background-size: 600% 600%;
  animation: gradientShift 8s ease infinite;
}

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

/* Gradient Text Animation */
.gradient-text {
  background: linear-gradient(270deg, var(--primary-turquoise), var(--primary-blue), var(--primary-violet));
  background-size: 600% 600%;
  animation: gradientShift 8s ease infinite;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-fill-color: transparent;
}

/* Gradient Border Animation */
.gradient-border {
  position: relative;
  border-radius: var(--radius-md);
}

.gradient-border::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(270deg, var(--primary-turquoise), var(--primary-blue), var(--primary-violet));
  background-size: 600% 600%;
  animation: gradientShift 8s ease infinite;
  border-radius: calc(var(--radius-md) + 2px);
  z-index: -1;
}

/* ===== 3D EFFECTS ===== */

/* 3D Card Tilt Effect */
.tilt-card {
  transform-style: preserve-3d;
  perspective: 1000px;
}

.tilt-card-inner {
  transition: transform 0.5s ease;
  transform-style: preserve-3d;
}

.tilt-card:hover .tilt-card-inner {
  transform: rotateY(10deg) rotateX(10deg);
}

.tilt-card-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform: translateZ(20px);
  pointer-events: none;
}

/* 3D Button Effect */
.btn-3d {
  transform-style: preserve-3d;
  perspective: 1000px;
  transition: transform 0.3s ease;
}

.btn-3d:hover {
  transform: translateY(-5px) translateZ(10px);
}

.btn-3d::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.1);
  transform: translateZ(-10px);
  border-radius: inherit;
}

/* ===== PARALLAX EFFECTS ===== */

/* Basic Parallax */
.parallax-container {
  position: relative;
  height: 400px;
  overflow: hidden;
}

.parallax-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 120%;
  background-size: cover;
  background-position: center;
  transform: translateZ(0);
  will-change: transform;
}

/* Multi-layer Parallax */
.parallax-layer-1 {
  transform: translateZ(-100px) scale(1.15);
}

.parallax-layer-2 {
  transform: translateZ(-50px) scale(1.1);
}

.parallax-layer-3 {
  transform: translateZ(0) scale(1);
}

/* ===== LOADING ANIMATIONS ===== */

/* Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(120, 115, 245, 0.1);
  border-top-color: var(--primary-violet);
  animation: spin 1s linear infinite;
}

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

/* Dots Loading */
.loading-dots {
  display: inline-flex;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  margin: 0 4px;
  background-color: var(--primary-violet);
  border-radius: 50%;
  animation: dots 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dots {
  0%, 100% {
    transform: scale(0.75);
    opacity: 0.5;
  }
  50% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Progress Bar */
.progress-bar {
  height: 4px;
  background-color: var(--neutral-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(to right, var(--primary-turquoise), var(--primary-violet));
  border-radius: var(--radius-full);
  animation: progressFill 2s ease-in-out;
}

@keyframes progressFill {
  from {
    width: 0;
  }
}

/* Skeleton Loading */
.skeleton {
  background: linear-gradient(90deg, var(--neutral-200) 25%, var(--neutral-300) 50%, var(--neutral-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

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

/* ===== NOTIFICATION ANIMATIONS ===== */

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 15px 20px;
  background-color: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform 0.3s ease;
  z-index: var(--z-popover);
}

.toast.show {
  transform: translateX(0);
}

/* Badge Notification */
.badge-notification {
  position: relative;
}

.badge-notification::after {
  content: '';
  position: absolute;
  top: -5px;
  right: -5px;
  width: 10px;
  height: 10px;
  background-color: var(--secondary-red);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* Bell Notification */
.bell-notification {
  position: relative;
}

.bell-notification.active {
  animation: bellRing 1s ease;
}

@keyframes bellRing {
  0%, 100% {
    transform: rotate(0);
  }
  10%, 30%, 50%, 70%, 90% {
    transform: rotate(10deg);
  }
  20%, 40%, 60%, 80% {
    transform: rotate(-10deg);
  }
}

/* ===== FORM ANIMATIONS ===== */

/* Input Focus Effect */
.input-focus-effect {
  position: relative;
}

.input-focus-effect input {
  border: 1px solid var(--neutral-300);
  transition: border-color 0.3s ease;
}

.input-focus-effect::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(to right, var(--primary-turquoise), var(--primary-violet));
  transition: width 0.3s ease;
}

.input-focus-effect input:focus {
  border-color: transparent;
}

.input-focus-effect input:focus ~ ::after {
  width: 100%;
}

/* Checkbox Animation */
.checkbox-animation {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
}

.checkbox-animation input {
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-animation-mark {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  background-color: white;
  border: 2px solid var(--neutral-400);
  border-radius: 4px;
  transition: all 0.3s ease;
}

.checkbox-animation input:checked ~ .checkbox-animation-mark {
  background-color: var(--primary-violet);
  border-color: var(--primary-violet);
}

.checkbox-animation-mark::after {
  content: '';
  position: absolute;
  display: none;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.checkbox-animation input:checked ~ .checkbox-animation-mark::after {
  display: block;
  animation: checkmark 0.2s ease-in-out;
}

@keyframes checkmark {
  0% {
    opacity: 0;
    transform: rotate(45deg) scale(0);
  }
  100% {
    opacity: 1;
    transform: rotate(45deg) scale(1);
  }
}

/* Radio Button Animation */
.radio-animation {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
}

.radio-animation input {
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-animation-mark {
  position: absolute;
  top: 0;
  left: 0;
  width: 20px;
  height: 20px;
  background-color: white;
  border: 2px solid var(--neutral-400);
  border-radius: 50%;
  transition: all 0.3s ease;
}

.radio-animation input:checked ~ .radio-animation-mark {
  border-color: var(--primary-violet);
}

.radio-animation-mark::after {
  content: '';
  position: absolute;
  display: none;
  top: 4px;
  left: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary-violet);
}

.radio-animation input:checked ~ .radio-animation-mark::after {
  display: block;
  animation: radiomark 0.2s ease-in-out;
}

@keyframes radiomark {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===== CURSOR EFFECTS ===== */

/* Custom Cursor */
.custom-cursor {
  position: fixed;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: rgba(120, 115, 245, 0.5);
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: 9999;
  transition: width 0.3s, height 0.3s, background-color 0.3s;
}

.custom-cursor.hover {
  width: 40px;
  height: 40px;
  background-color: rgba(120, 115, 245, 0.3);
}

/* Magnetic Effect */
.magnetic {
  position: relative;
  display: inline-block;
}

/* ===== SCROLL INDICATOR ===== */

/* Progress Bar Scroll Indicator */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 4px;
  background: linear-gradient(to right, var(--primary-turquoise), var(--primary-violet));
  z-index: var(--z-fixed);
}

/* Scroll Down Indicator */
.scroll-down-indicator {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
}

.scroll-down-text {
  margin-bottom: 10px;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.scroll-down-arrow {
  width: 30px;
  height: 50px;
  border: 2px solid white;
  border-radius: 15px;
  position: relative;
}

.scroll-down-arrow::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  width: 6px;
  height: 6px;
  background-color: white;
  border-radius: 50%;
  transform: translateX(-50%);
  animation: scrollDownArrow 2s infinite;
}

@keyframes scrollDownArrow {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
  }
}

/* ===== RESPONSIVE ANIMATIONS ===== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 768px) {
  .tilt-card:hover .tilt-card-inner {
    transform: none;
  }
  
  .card-hover-lift:hover {
    transform: translateY(-5px);
  }
}