@tailwind base;
@tailwind components;
@tailwind utilities;

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

[dir="rtl"] .hero-logo {
  flex-direction: row-reverse;
}

[dir="rtl"] .hero-store-buttons {
  flex-direction: row-reverse;
}

[dir="rtl"] .app-stores-buttons {
  flex-direction: row-reverse;
}

[dir="rtl"] .footer-links {
  flex-direction: row-reverse;
}

/* Base styles */
html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

::-webkit-scrollbar-track {
  background: #1f2937;
}

::-webkit-scrollbar-thumb {
  background: #6b7280;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* Focus styles */
*:focus {
  outline: 2px solid #8b5cf6;
  outline-offset: 2px;
}

/* Button focus styles */
button:focus,
a:focus {
  outline: 2px solid #8b5cf6;
  outline-offset: 2px;
}

/* Image optimization */
img {
  max-width: 100%;
  height: auto;
}

/* Video optimization */
video {
  max-width: 100%;
  height: auto;
}

/* Swiper custom styles */
.swiper-slide {
  height: auto;
}

.swiper-pagination-bullet {
  background: #8b5cf6;
}

.swiper-pagination-bullet-active {
  background: #a855f7;
}

/* Animation utilities */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

.animate-slide-in {
  animation: slideIn 0.6s ease-out;
}

/* Responsive utilities */
@media (max-width: 640px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1025px) {
  .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

@layer base {
  html {
    scroll-behavior: smooth;
  }
  
  body {
    @apply antialiased;
  }
}

@layer components {
  /* Portrait Studio 移动端优化样式 */
  .portrait-slide {
    transition: transform 0.3s ease;
  }
  
  .portrait-container {
    position: relative;
    overflow: hidden;
  }
  
  /* ReactCompareSlider 移动端优化 */
  .react-compare-slider {
    width: 100% !important;
    height: auto !important;
    min-height: 300px;
  }
  
  .react-compare-slider__item {
    width: 100% !important;
    height: 100% !important;
  }
  
  .react-compare-slider__item img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
  
  /* 移动端特定优化 */
  @media (max-width: 640px) {
    .portrait-slide {
      max-width: 280px;
    }
    
    .portrait-container {
      aspect-ratio: 3/4;
      border-radius: 0.5rem;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    }
    
    /* Swiper 移动端优化 */
    .swiper-slide-active .portrait-slide {
      transform: scale(1.02);
    }
    
    .swiper-slide:not(.swiper-slide-active) .portrait-slide {
      transform: scale(0.95);
      opacity: 0.8;
    }
    
    /* ReactCompareSlider 移动端优化 */
    .react-compare-slider {
      min-height: 250px !important;
      max-height: 350px !important;
    }
  }
  
  /* 平板端优化 */
  @media (min-width: 641px) and (max-width: 1023px) {
    .portrait-slide {
      max-width: 320px;
    }
    
    .portrait-container {
      box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    }
    
    /* ReactCompareSlider 平板端优化 */
    .react-compare-slider {
      min-height: 400px !important;
      max-height: 500px !important;
    }
  }
  
  /* 桌面端优化 */
  @media (min-width: 1024px) {
    .portrait-slide {
      max-width: 350px;
    }
    
    .portrait-container {
      box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    }
    
    /* ReactCompareSlider 桌面端优化 */
    .react-compare-slider {
      min-height: 500px !important;
      max-height: 600px !important;
    }
  }
}