/* Custom animations and utilities */

/* Fade in with scale */
@keyframes fade-in-scale {
  0% {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.animate-fade-in-scale {
  animation: fade-in-scale 0.5s ease-out forwards;
}

/* Enhanced fade in with rotation */
@keyframes fade-in-rotate {
  0% {
    opacity: 0;
    transform: scale(0.9) rotate(-5deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

.animate-fade-in-rotate {
  animation: fade-in-rotate 0.6s ease-out forwards;
}

/* Slide in from left */
@keyframes slide-in-left {
  0% {
    opacity: 0;
    transform: translateX(-20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-slide-in-left {
  animation: slide-in-left 0.4s ease-out forwards;
}

/* Slide in from right */
@keyframes slide-in-right {
  0% {
    opacity: 0;
    transform: translateX(20px);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

.animate-slide-in-right {
  animation: slide-in-right 0.4s ease-out forwards;
}

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

.animate-float {
  animation: float 3s ease-in-out infinite;
}

/* Fade in up */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fade-in-up 0.6s ease-out forwards;
}

/* Staggered animation delays */
.animation-delay-100 {
  animation-delay: 0.1s;
}

.animation-delay-200 {
  animation-delay: 0.2s;
}

.animation-delay-300 {
  animation-delay: 0.3s;
}

.animation-delay-400 {
  animation-delay: 0.4s;
}

.animation-delay-500 {
  animation-delay: 0.5s;
}

/* Card hover effect */
.card-hover {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
}

.card-hover::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: all 0.6s;
}

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

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

/* Enhanced card hover with shadow glow */
.card-hover-glow:hover {
  box-shadow: 0 25px 50px -12px rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.3);
}

/* Button hover effect */
.btn-hover {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  border-radius: 0.375rem;
}

.btn-hover::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%);
  transform-origin: 50% 50%;
}

.btn-hover:focus:not(:active)::after {
  animation: ripple 1s ease-out;
}

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

.btn-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Enhanced button with gradient border */
.btn-gradient-border {
  position: relative;
  background: transparent;
  border: none;
  z-index: 1;
}

.btn-gradient-border::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 0.375rem;
  z-index: -1;
  padding: 2px;
}

.btn-gradient-border::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  right: 2px;
  bottom: 2px;
  background: white;
  border-radius: 0.25rem;
  z-index: -1;
}

.btn-gradient-border span {
  position: relative;
  z-index: 2;
}

/* Dropdown menu styling */
.dropdown-menu {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.group:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* RTL Support */
[dir="rtl"] {
  direction: rtl;
}

[dir="rtl"] .ml-2 { margin-left: 0; margin-right: 0.5rem; }
[dir="rtl"] .mr-2 { margin-right: 0; margin-left: 0.5rem; }
[dir="rtl"] .ml-4 { margin-left: 0; margin-right: 1rem; }
[dir="rtl"] .mr-4 { margin-right: 0; margin-left: 1rem; }
[dir="rtl"] .ml-10 { margin-left: 0; margin-right: 2.5rem; }

/* Enhanced RTL support */
[dir="rtl"] .float-right { float: left; }
[dir="rtl"] .float-left { float: right; }
[dir="rtl"] .text-right { text-align: left; }
[dir="rtl"] .text-left { text-align: right; }

/* RTL navigation */
[dir="rtl"] .nav-dropdown {
  right: 0;
  left: auto;
}

[dir="rtl"] .nav-dropdown.right-aligned {
  right: auto;
  left: 0;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

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

/* Focus visible */
.focus-visible {
  outline: 2px solid #10b981;
  outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Property thumbnail active state */
.property-thumb.active {
  border: 2px solid #10b981;
}

/* Property thumbnail hover state */
.property-thumb:hover {
  transform: scale(1.05);
  transition: transform 0.2s ease;
}

/* Property thumbnail for mobile */
@media (max-width: 640px) {
  .property-thumb {
    width: 60px;
    height: 60px;
  }
}

/* Loading states */
.loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.dark .loading-overlay {
  background: rgba(30, 41, 59, 0.8);
}

/* Loading button */
.btn-loading {
  position: relative;
  color: transparent;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #10b981;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #059669;
}

/* Dark mode scrollbar */
.dark ::-webkit-scrollbar-track {
  background: #1e293b;
}

.dark ::-webkit-scrollbar-thumb {
  background: #6366f1;
}

/* Thin scrollbar */
.scrollbar-thin::-webkit-scrollbar {
  width: 4px;
}

/* Hidden scrollbar */
.scrollbar-hidden::-webkit-scrollbar {
  display: none;
}

/* Custom scrollbar for specific elements */
.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: #10b981 #f1f5f9;
}

.dark .custom-scrollbar {
  scrollbar-color: #10b981 #1e293b;
}

/* Responsive text */
@media (max-width: 640px) {
  .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .property-card {
    flex-direction: column;
  }
  
  .property-image {
    width: 100%;
    height: 200px;
  }
  
  .property-details {
    width: 100%;
  }
}

/* Medium screens */
@media (min-width: 641px) and (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .property-features {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Large screens */
@media (min-width: 1025px) {
  .dashboard-grid {
    grid-template-columns: 2fr 1fr;
  }
  
  .property-features {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Ultra-wide screens */
@media (min-width: 1440px) {
  .max-w-7xl {
    max-width: 80rem;
  }
  
  .hero-content {
    max-width: 60rem;
  }
}

/* Form focus states */
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Enhanced form elements for mobile */
@media (max-width: 640px) {
  input, select, textarea {
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .btn-full-mobile {
    width: 100%;
  }
}

/* Touch targets */
.touch-target {
  min-height: 44px;
  min-width: 44px;
}

/* Mobile navigation */
.mobile-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  dark:bg-gray-800;
  border-top: 1px solid #e5e7eb;
  dark:border-gray-700;
  z-index: 50;
  padding: 0.5rem 0;
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0;
  text-decoration: none;
  color: #6b7280;
  dark:text-gray-400;
}

.mobile-nav-item.active {
  color: #10b981;
  dark:text-white;
}

.mobile-nav-item i {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

/* Transition utilities */
.transition-all {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

/* Smooth transitions for dark mode */
.dark-mode-transition {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Animation delays for staggered effects */
.animation-stagger-1 {
  animation-delay: 0.1s;
}

.animation-stagger-2 {
  animation-delay: 0.2s;
}

.animation-stagger-3 {
  animation-delay: 0.3s;
}

.animation-stagger-4 {
  animation-delay: 0.4s;
}

.animation-stagger-5 {
  animation-delay: 0.5s;
}

/* Loading spinner */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(16, 185, 129, 0.3);
  border-radius: 50%;
  border-top-color: #10b981;
  animation: spin 1s ease-in-out infinite;
}

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

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: loading 1.5s infinite;
  border-radius: 0.25rem;
}

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

/* Dark mode skeleton */
.dark .skeleton {
  background: linear-gradient(90deg, #2d3748 25%, #4a5568 50%, #2d3748 75%);
  background-size: 200% 100%;
}

/* Enhanced loading spinner with double ring */
.loading-spinner-double {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(16, 185, 129, 0.3);
  border-radius: 50%;
  border-top-color: #10b981;
  animation: spin 1s ease-in-out infinite;
  position: relative;
}

.loading-spinner-double::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  right: 3px;
  bottom: 3px;
  border: 2px solid transparent;
  border-radius: 50%;
  border-top-color: #8b5cf6;
  animation: spin 1.5s ease-in-out infinite reverse;
}

/* Notification animations */
.notification-enter {
  transform: translateX(100%);
  opacity: 0;
}

.notification-enter-active {
  transform: translateX(0);
  opacity: 1;
  transition: all 0.3s ease;
}

.notification-exit {
  transform: translateX(0);
  opacity: 1;
}

.notification-exit-active {
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
}

/* Mobile notifications */
@media (max-width: 640px) {
  .notification {
    width: 90%;
    right: 5%;
    left: 5%;
  }
}

/* Toast notifications */
.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 1rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  z-index: 100;
  transform: translateY(100%);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  background: #10b981;
  color: white;
}

.toast.error {
  background: #ef4444;
  color: white;
}

.toast.info {
  background: #8b5cf6;
  color: white;
}

.toast.warning {
  background: #f59e0b;
  color: white;
}

/* Enhanced Notification Styles */
.notification-enhanced {
  position: relative;
  overflow: hidden;
  border-left: 4px solid;
}

.notification-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, currentColor, transparent);
  animation: progress 5s linear;
}

@keyframes progress {
  from {
    width: 100%;
  }
  to {
    width: 0;
  }
}

/* Property Wishlist Animation */
.wishlist-btn {
  transition: all 0.3s ease;
}

.wishlist-btn.wished {
  color: #ef4444;
  animation: heartBeat 0.6s ease;
}

@keyframes heartBeat {
  0% {
    transform: scale(1);
  }
  14% {
    transform: scale(1.3);
  }
  28% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.3);
  }
  70% {
    transform: scale(1);
  }
}

/* Property Rating Stars */
.rating-stars {
  display: inline-flex;
  color: #d1d5db;
}

.rating-stars .star {
  cursor: pointer;
  transition: all 0.2s ease;
}

.rating-stars .star:hover,
.rating-stars .star.active {
  color: #fbbf24;
  transform: scale(1.1);
}