/* ======================
   CSS Variables & Base Styles
   ====================== */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Brand Colors - HSL */
  --background: 0 0% 100%;
  --foreground: 0 0% 10%;
  
  --card: 0 0% 100%;
  --card-foreground: 0 0% 10%;
  
  --popover: 0 0% 100%;
  --popover-foreground: 0 0% 10%;
  
  /* BSE Red - Primary Brand Color */
  --primary: 0 80% 40%;
  --primary-foreground: 0 0% 100%;
  --primary-light: 0 80% 50%;
  --primary-dark: 0 80% 28%;
  
  /* Dark/Black */
  --secondary: 0 0% 10%;
  --secondary-foreground: 0 0% 100%;
  
  --muted: 0 0% 96%;
  --muted-foreground: 0 0% 45%;
  
  --accent: 0 60% 95%;
  --accent-foreground: 0 80% 35%;
  
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  
  --border: 0 0% 88%;
  --input: 0 0% 88%;
  --ring: 0 80% 40%;
  
  --radius: 0.5rem;
  
  /* Custom Design Tokens */
  --hero-gradient: linear-gradient(135deg, hsl(0 0% 8%) 0%, hsl(0 80% 18%) 100%);
  --card-shadow: 0 4px 24px hsl(0 80% 40% / 0.12);
  --card-hover-shadow: 0 8px 40px hsl(0 80% 40% / 0.22);
  --red-glow: 0 0 40px hsl(0 80% 40% / 0.3);
  
  /* Sidebar variables */
  --sidebar-background: 0 0% 98%;
  --sidebar-foreground: 240 5.3% 26.1%;
  --sidebar-primary: 240 5.9% 10%;
  --sidebar-primary-foreground: 0 0% 98%;
  --sidebar-accent: 240 4.8% 95.9%;
  --sidebar-accent-foreground: 240 5.9% 10%;
  --sidebar-border: 220 13% 91%;
  --sidebar-ring: 217.2 91.2% 59.8%;
}

/* Base Styles */
* {
  border-color: hsl(var(--border));
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: 'Inter', 'Tajawal', sans-serif;
  line-height: 1.6;
  direction: rtl;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

/* Arabic text must never have letter-spacing - it breaks glyph joining */
[lang="ar"], [dir="rtl"],
h1[dir="rtl"], h2[dir="rtl"], h3[dir="rtl"],
p[dir="rtl"], span[dir="rtl"],
button[dir="rtl"] {
  letter-spacing: 0 !important;
  word-spacing: normal;
  font-family: 'Tajawal', 'Inter', sans-serif;
}

/* Tailwind applies negative tracking to large text which breaks Arabic */
.text-4xl, .text-5xl, .text-6xl, .text-7xl {
  letter-spacing: normal;
}

/* Override tracking for elements using Arabic font inline */
h1, h2, h3, h4, h5, h6, p, span, a, button, label, option, select, textarea, input {
  font-variant-ligatures: common-ligatures;
}

/* ======================
   Utility Classes
   ====================== */

/* Hero Gradient */
.hero-gradient {
  background: var(--hero-gradient);
}

/* Card Shadows */
.card-shadow {
  box-shadow: var(--card-shadow);
}

.card-hover-shadow {
  box-shadow: var(--card-hover-shadow);
}

/* Red Glow */
.red-glow {
  box-shadow: var(--red-glow);
}

/* Text Gradient */
.text-gradient {
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--primary-light)) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Section Divider */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, hsl(var(--primary)), transparent);
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .container {
    padding: 0 1.5rem;
  }
}

/* Spacing */
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.p-12 { padding: 3rem; }
.p-14 { padding: 3.5rem; }
.p-16 { padding: 4rem; }
.p-24 { padding: 6rem; }

.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.px-12 { padding-left: 3rem; padding-right: 3rem; }
.px-14 { padding-left: 3.5rem; padding-right: 3.5rem; }

.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-3\.5 { padding-top: 0.875rem; padding-bottom: 0.875rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.py-14 { padding-top: 3.5rem; padding-bottom: 3.5rem; }
.py-24 { padding-top: 6rem; padding-bottom: 6rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-16 { margin-bottom: 4rem; }
.mb-24 { margin-bottom: 6rem; }

.mt-2 { margin-top: 0.5rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }

.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }

.mx-4 { margin-left: 1rem; margin-right: 1rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }

/* Flexbox */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.top-0 { top: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.bottom-10 { bottom: 2.5rem; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.z-50 { z-index: 50; }

/* Sizing */
.w-full { width: 100%; }
.w-auto { width: auto; }
.w-10 { width: 2.5rem; }
.w-12 { width: 3rem; }
.w-16 { width: 4rem; }
.w-32 { width: 8rem; }
.w-36 { width: 9rem; }
.w-48 { width: 12rem; }
.w-64 { width: 16rem; }
.w-96 { width: 24rem; }
.w-\[400px\] { width: 400px; }
.w-\[500px\] { width: 500px; }
.w-\[700px\] { width: 700px; }
.w-1\.5 { width: 0.375rem; }

.h-full { height: 100%; }
.h-auto { height: auto; }
.h-10 { height: 2.5rem; }
.h-12 { height: 3rem; }
.h-16 { height: 4rem; }
.h-32 { height: 8rem; }
.h-36 { height: 9rem; }
.h-48 { height: 12rem; }
.h-64 { height: 16rem; }
.h-96 { height: 24rem; }
.h-\[400px\] { height: 400px; }
.h-\[500px\] { height: 500px; }
.h-\[700px\] { height: 700px; }
.h-1\.5 { height: 0.375rem; }
.min-h-screen { min-height: 100vh; }

/* Colors */
.bg-background { background-color: hsl(var(--background)); }
.bg-card { background-color: hsl(var(--card)); }
.bg-primary { background-color: hsl(var(--primary)); }
.bg-secondary { background-color: hsl(var(--secondary)); }
.bg-muted { background-color: hsl(var(--muted)); }
.bg-primary\/10 { background-color: hsl(var(--primary) / 0.1); }
.bg-primary\/8 { background-color: hsl(var(--primary) / 0.08); }
.bg-primary\/5 { background-color: hsl(var(--primary) / 0.05); }
.bg-secondary\/5 { background-color: hsl(var(--secondary) / 0.05); }
.bg-secondary\/95 { background-color: hsl(var(--secondary) / 0.95); }
.bg-muted\/40 { background-color: hsl(var(--muted) / 0.4); }

.text-foreground { color: hsl(var(--foreground)); }
.text-primary { color: hsl(var(--primary)); }
.text-primary-foreground { color: hsl(var(--primary-foreground)); }
.text-secondary-foreground { color: hsl(var(--secondary-foreground)); }
.text-muted-foreground { color: hsl(var(--muted-foreground)); }
.text-primary\/60 { color: hsl(var(--primary) / 0.6); }
.text-primary\/75 { color: hsl(var(--primary) / 0.75); }
.text-primary\/80 { color: hsl(var(--primary) / 0.8); }
.text-primary\/90 { color: hsl(var(--primary) / 0.9); }
.text-primary-foreground\/60 { color: hsl(var(--primary-foreground) / 0.6); }
.text-primary-foreground\/75 { color: hsl(var(--primary-foreground) / 0.75); }
.text-secondary-foreground\/60 { color: hsl(var(--secondary-foreground) / 0.6); }
.text-secondary-foreground\/40 { color: hsl(var(--secondary-foreground) / 0.4); }

/* Border */
.border { border-width: 1px; border-style: solid; border-color: hsl(var(--border)); }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: hsl(var(--border)); }
.border-t { border-top-width: 1px; border-top-style: solid; border-top-color: hsl(var(--border)); }
.border-primary { border-color: hsl(var(--primary)); }
.border-primary\/20 { border-color: hsl(var(--primary) / 0.2); }
.border-primary\/30 { border-color: hsl(var(--primary) / 0.3); }
.border-primary\/40 { border-color: hsl(var(--primary) / 0.4); }
.border-border { border-color: hsl(var(--border)); }
.rounded-lg { border-radius: var(--radius); }
.rounded-xl { border-radius: 0.75rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-full { border-radius: 50%; }

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-5xl { font-size: 3rem; line-height: 1; }
.text-6xl { font-size: 3.75rem; line-height: 1; }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }

.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }
.leading-relaxed { line-height: 1.625; }
.tracking-normal { letter-spacing: 0; }
.tracking-widest { letter-spacing: 0.1em; }
.tracking-\[0\.3em\] { letter-spacing: 0.3em; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.uppercase { text-transform: uppercase; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }

/* Background Effects */
.backdrop-blur-md { backdrop-filter: blur(12px); }
.blur-3xl { filter: blur(64px); }
.blur-xl { filter: blur(24px); }
.drop-shadow-2xl { filter: drop-shadow(0 25px 25px rgb(0 0 0 / 0.15)); }

/* Transitions & Animations */
.transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-colors { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-200 { transition-duration: 200ms; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }

/* Hover States */
.hover\:bg-primary:hover { background-color: hsl(var(--primary)); }
.hover\:bg-primary-light:hover { background-color: hsl(var(--primary-light)); }
.hover\:bg-primary\/10:hover { background-color: hsl(var(--primary) / 0.1); }
.hover\:text-primary:hover { color: hsl(var(--primary)); }
.hover\:text-primary-foreground:hover { color: hsl(var(--primary-foreground)); }
.hover\:text-primary\/80:hover { color: hsl(var(--primary) / 0.8); }
.hover\:border-primary:hover { border-color: hsl(var(--primary)); }
.hover\:border-primary\/30:hover { border-color: hsl(var(--primary) / 0.3); }
.hover\:shadow-lg:hover { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05); }
.hover\:shadow-xl:hover { box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1); }
.hover\:-translate-y-0\.5:hover { transform: translateY(-0.125rem); }
.hover\:-translate-y-1:hover { transform: translateY(-0.25rem); }
.group:hover .group-hover\:bg-primary { background-color: hsl(var(--primary)); }
.group:hover .group-hover\:text-primary-foreground { color: hsl(var(--primary-foreground)); }

/* Transform */
.translate-x-1\/2 { transform: translateX(50%); }
.-translate-x-1\/2 { transform: translateX(-50%); }
.translate-y-1\/2 { transform: translateY(50%); }
.-translate-y-1\/2 { transform: translateY(-50%); }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-visible { overflow: visible; }

/* Display */
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }

/* Object Fit */
.object-contain { object-fit: contain; }
.object-cover { object-fit: cover; }

/* Opacity */
.opacity-30 { opacity: 0.3; }
.opacity-40 { opacity: 0.4; }

/* Cursor */
.pointer-events-none { pointer-events: none; }
.cursor-pointer { cursor: pointer; }

/* Animation */
.animate-bounce {
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(-25%);
    animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
  }
  50% {
    transform: translateY(0);
    animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
  }
}

/* Responsive */
@media (min-width: 640px) {
  .sm\:flex-row { flex-direction: row; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:text-sm { font-size: 0.875rem; line-height: 1.25rem; }
  .sm\:w-auto { width: auto; }
}

@media (min-width: 768px) {
  .md\:flex-row { flex-direction: row; }
  .md\:text-lg { font-size: 1.125rem; line-height: 1.75rem; }
  .md\:text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
  .md\:text-5xl { font-size: 3rem; line-height: 1; }
  .md\:text-6xl { font-size: 3.75rem; line-height: 1; }
  .md\:h-36 { height: 9rem; }
  .md\:w-36 { width: 9rem; }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:p-8 { padding: 2rem; }
  .md\:flex { display: flex; }
  .md\:hidden { display: none; }
  .md\:text-right { text-align: right; }
  .md\:items-start { align-items: flex-start; }
  .md\:text-base { font-size: 1rem; line-height: 1.5rem; }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .xl\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* RTL Support */
[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-1 { margin-left: 0; margin-right: 0.25rem; }
[dir="rtl"] .mr-1 { margin-right: 0; margin-left: 0.25rem; }

/* Form Elements */
input, textarea, select {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--border));
}

input:focus, textarea:focus, select:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

/* Buttons */
button {
  cursor: pointer;
  font-family: inherit;
}

/* Links */
a {
  text-decoration: none;
  color: inherit;
}

/* Remove download appearance from links */
a:not([href^="tel"]):not([href^="mailto"]) {
  text-decoration: none;
}

.focus\:outline-none:focus { outline: none; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2); }
.focus\:ring-primary\/30:focus { box-shadow: 0 0 0 2px hsl(var(--primary) / 0.3); }
.focus\:border-primary:focus { border-color: hsl(var(--primary)); }

/* Resize */
.resize-none { resize: none; }

/* Min/Max Width */
.min-w-0 { min-width: 0px; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-\[1200px\] { max-width: 1200px; }

/* Shadow */
.shadow-md { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -2px rgb(0 0 0 / 0.05); }

/* Special Classes */
.ring-2 { box-shadow: 0 0 0 2px; }
.ring-primary\/30 { box-shadow: 0 0 0 2px hsl(var(--primary) / 0.3); }
