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

@layer base {
  :root {
    --background: 210 20% 98%;
    --foreground: 220 39% 11%;
    --card: 0 0% 100%;
    --card-foreground: 220 39% 11%;
    --popover: 0 0% 100%;
    --popover-foreground: 220 39% 11%;
    --primary: 206 52% 21%;
    --primary-foreground: 210 20% 98%;
    --secondary: 212 73% 59%;
    --secondary-foreground: 210 20% 98%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 212 73% 59%;
    --accent-foreground: 210 20% 98%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 206 52% 21%;
    --radius: 0.75rem;

    --gradient-primary: linear-gradient(135deg, #1a2a4e 0%, #6b5b95 100%);
    --gradient-secondary: linear-gradient(135deg, #6b5b95 0%, #8b7ba8 100%);
  }
  .dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;
    --primary: 210 40% 98%;
    --primary-foreground: 222.2 47.4% 11.2%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 212.7 26.8% 83.9%;
  }

  * {
    @apply border-border;
  }
  
  html {
    scroll-behavior: smooth;
  }

  body {
    @apply bg-background text-foreground font-sans antialiased overflow-x-hidden;
    font-family: 'Tajawal', sans-serif;
  }

  /* RTL Support overrides and adjustments */
  [dir="rtl"] {
    text-align: right;
  }

  h1, h2, h3, h4, h5, h6 {
    font-family: 'Cairo', sans-serif;
    @apply font-bold tracking-tight text-slate-900;
  }

  h1 {
    @apply text-4xl md:text-5xl lg:text-6xl leading-tight;
  }

  h2 {
    @apply text-3xl md:text-4xl leading-snug;
  }

  h3 {
    @apply text-2xl md:text-3xl leading-snug;
  }

  p {
    @apply leading-relaxed;
  }
}

@layer components {
  /* Common Card Styles */
  .service-card {
    @apply bg-white p-8 rounded-2xl border border-slate-100 shadow-sm hover:shadow-xl hover:border-blue-200 transition-all duration-300;
  }

  /* Interactive Buttons */
  .btn-primary {
    @apply bg-[#1a3a52] hover:bg-[#2a5b84] text-white rounded-xl shadow-lg hover:shadow-xl transition-all;
  }

  .btn-whatsapp {
    @apply bg-[#25D366] hover:bg-[#1dbf57] text-white rounded-xl shadow-lg hover:shadow-xl transition-all;
  }

  /* Feature Icons Wrapper */
  .icon-wrapper {
    @apply w-14 h-14 shrink-0 rounded-full flex items-center justify-center;
  }
}

@layer utilities {
  .text-shadow {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  }
  
  .perspective-1000 {
    perspective: 1000px;
  }
  
  .smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
}

/* Component Overrides & specific animations outside of Tailwind layers if needed */
.card-3d {
  transform-style: preserve-3d;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-3d:hover {
  transform: translateY(-8px) rotateX(2deg);
  box-shadow: 0 20px 40px rgba(26, 42, 78, 0.15);
}

.button-3d {
  position: relative;
  transform-style: preserve-3d;
  transition: all 0.3s ease;
}

.button-3d::before {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  border-radius: inherit;
  transform: translateZ(-4px);
  opacity: 0.7;
  transition: all 0.3s ease;
}

.button-3d:hover {
  transform: translateY(-4px);
}

.button-3d:hover::before {
  transform: translateZ(-8px);
}

.icon-3d {
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

.icon-3d:hover {
  transform: rotateY(360deg);
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: hsl(var(--background));
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: hsl(var(--primary) / 0.5);
  border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: hsl(var(--primary));
}