@import "tailwindcss";

@theme {
  --color-primary-50: #fefce8;
  --color-primary-100: #fef9c3;
  --color-primary-200: #fef08a;
  --color-primary-300: #fde047;
  --color-primary-400: #facc15;
  --color-primary-500: #eab308;
  --color-primary-600: #ca8a04;
  --color-primary-700: #a16207;
  --color-primary-800: #854d0e;
  --color-primary-900: #713f12;
  --color-primary-950: #422006;
}

@custom-variant dark (&:is(.dark, .dark *));

:root {
  --font-display: "Playfair Display", serif;
  --font-sans: "Inter", sans-serif;
  --font-arabic: "Tajawal", sans-serif;
  --font-arabic-display: "Aref Ruqaa", serif;

  /* Brand Colors - Aqarlak Yellow */
  --color-primary: #f3c346;
  --color-primary-dark: #e5b23a;
  --color-primary-light: #f7cf4a;

  color-scheme: light;
}

html.dark {
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
}

/* Arabic Typography - Apply when RTL is active */
html[dir="rtl"] body {
  font-family: var(--font-arabic), var(--font-sans);
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6,
html[dir="rtl"] .font-display {
  font-family: var(--font-arabic), var(--font-sans);
}

/* Adjust line height for Arabic text */
html[dir="rtl"] body {
  line-height: 1.8;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3 {
  line-height: 1.5;
}

/* Font utility classes for Arabic typography */
.font-arabic {
  font-family: var(--font-arabic), sans-serif;
}

.font-arabic-display {
  font-family: var(--font-arabic-display), serif;
}

/* Decorative font for section/hero headings in RTL */
html[dir="rtl"] .font-display {
  font-family: var(--font-arabic-display), var(--font-display);
}

/* Custom container with proper responsive padding */
.container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

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

@media (min-width: 768px) {
  .container {
    max-width: 768px;
  }
}

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

@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
}

@media (min-width: 1536px) {
  .container {
    max-width: 1536px;
  }
}

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

/* Fade in animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

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

/* Scale in animation */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Slide in from left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide in from right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Pulse animation for loading states */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Animation utility classes */
.animate-fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

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

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

.animate-scale-in {
  animation: scaleIn 0.3s ease-out forwards;
}

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

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

/* Staggered animation delays */
.animate-delay-100 {
  animation-delay: 100ms;
}

.animate-delay-200 {
  animation-delay: 200ms;
}

.animate-delay-300 {
  animation-delay: 300ms;
}

.animate-delay-400 {
  animation-delay: 400ms;
}

.animate-delay-500 {
  animation-delay: 500ms;
}

/* Initially hidden for animations */
.animate-on-scroll {
  opacity: 0;
}

.animate-on-scroll.animated {
  opacity: 1;
}

/* Smooth page transitions */
main {
  animation: fadeIn 0.3s ease-out;
}

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

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

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

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

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

/* Button animations */
.btn-animate {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-animate::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s ease, height 0.6s ease;
}

.btn-animate:hover::after {
  width: 300px;
  height: 300px;
}

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

/* RTL Support - Flip margins for RTL languages */
html[dir="rtl"] .mr-1 { margin-right: 0; margin-left: 0.25rem; }
html[dir="rtl"] .mr-2 { margin-right: 0; margin-left: 0.5rem; }
html[dir="rtl"] .mr-3 { margin-right: 0; margin-left: 0.75rem; }
html[dir="rtl"] .mr-4 { margin-right: 0; margin-left: 1rem; }
html[dir="rtl"] .ml-1 { margin-left: 0; margin-right: 0.25rem; }
html[dir="rtl"] .ml-2 { margin-left: 0; margin-right: 0.5rem; }
html[dir="rtl"] .ml-3 { margin-left: 0; margin-right: 0.75rem; }
html[dir="rtl"] .ml-4 { margin-left: 0; margin-right: 1rem; }
html[dir="rtl"] .left-4 { left: auto; right: 1rem; }
html[dir="rtl"] .right-4 { right: auto; left: 1rem; }
html[dir="rtl"] .text-left { text-align: right; }
html[dir="rtl"] .text-right { text-align: left; }

/* RTL - Flip icons and arrows */
html[dir="rtl"] .rtl-flip { transform: scaleX(-1); }

/* Skeleton loading improvements */
.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Smooth content transition for loading states */
.content-transition {
  transition: opacity 0.2s ease-in-out;
}

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

  html {
    scroll-behavior: auto;
  }
}

/* ========================================
   LEAFLET MAP STYLES
   ======================================== */

/* Ensure map container has proper z-index */
.leaflet-container {
  z-index: 0;
}

/* Dark mode adjustments for map */
.dark .leaflet-container {
  background: rgb(31 41 55);
}

.dark .leaflet-popup-content-wrapper {
  background: rgb(31 41 55);
  color: rgb(209 213 219);
}

.dark .leaflet-popup-tip {
  background: rgb(31 41 55);
}

/* Mobile map touch handling */
.leaflet-container {
  font-family: inherit;
}

/* Fix map attribution in dark mode */
.dark .leaflet-control-attribution {
  background: rgba(31, 41, 55, 0.8);
  color: rgb(156 163 175);
}

.dark .leaflet-control-attribution a {
  color: rgb(209 213 219);
}
