@import "tailwindcss";

/* ---------------------------------------------------------------------------
   DESIGN SYSTEM — Brand & Semantic (class-based dark mode)
   --------------------------------------------------------------------------- */

:root {
  /* الوضع الفاتح: خلفية بيضاء + كلام أسود + الأساسيات من لون الداشبورد */
  --bg: #ffffff;
  --fg: #171717;
  --muted: #525252;
  --card: #ffffff;
  --border: #e5e5e5;
  /* اللون الأساسي من الداشبورد (primary_color_light) يطبق من GeneralSettingsContext */
  --brand-navy: #0a0e1a;
  --brand-yellow: #eab308;
  --brand-white: #fafafa;
  --accent: #eab308;
  --accent-foreground: #a16207;

  --background: var(--bg);
  --foreground: var(--fg);
  --navy: var(--brand-navy);
  --accent-yellow: var(--accent);
  --white: var(--brand-white);
}

.dark {
  /* Brand unchanged */
  --brand-navy: #0a0e1a;
  --brand-yellow: #facc15;
  --brand-white: #fafafa;

  /* Semantic (dark) */
  --bg: #0a0e1a;
  --fg: #f1f5f9;
  --muted: #94a3b8;
  --card: #0f172a;
  --border: #1e293b;
  --accent: #facc15;
  --accent-foreground: var(--accent);

  --background: var(--bg);
  --foreground: var(--fg);
  --navy: var(--brand-navy);
  --accent-yellow: var(--accent);
  --white: var(--brand-white);
}

/* Smooth theme transition */
html {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Tailwind theme mapping */
@theme inline {
  --color-background: var(--bg);
  --color-foreground: var(--fg);
  --color-muted: var(--muted);
  --color-card: var(--card);
  --color-border: var(--border);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-brand-navy: var(--brand-navy);
  --color-brand-yellow: var(--brand-yellow);
  --color-brand-white: var(--brand-white);
  --font-mono: var(--font-geist-mono);
}

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans-en), system-ui, sans-serif;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* RTL: use Arabic font when locale is ar (set on html via DirLangSync) */
[lang="ar"] body,
[data-locale="ar"] body {
  font-family: var(--font-sans-ar), var(--font-sans-en), system-ui, sans-serif;
}

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

/* Section scroll margin for fixed navbar */
section[id] {
  scroll-margin-top: 4.5rem;
}

/* خط زخرفي تحت عناوين الأقسام — بلون الداشبورد للتناسق مع اللوجو والأيقونات */
.section-title-accent {
  position: relative;
  display: inline-block;
}
.section-title-accent::after {
  content: "";
  position: absolute;
  bottom: -0.5rem;
  left: 0;
  width: 3.5rem;
  height: 0.25rem;
  background: var(--accent);
  border-radius: 2px;
}
[dir="rtl"] .section-title-accent::after {
  left: auto;
  right: 0;
}
/* للعناوين اللي في النص في المنتصف */
.section-title-accent-center::after {
  left: 50%;
  transform: translateX(-50%);
}
[dir="rtl"] .section-title-accent-center::after {
  right: 50%;
  left: auto;
  transform: translateX(50%);
}

/* Floating WhatsApp — حركة عائمة + توهج حلقة */
@keyframes float-whatsapp {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}
@keyframes pulse-ring-whatsapp {
  0% {
    transform: scale(1);
    opacity: 0.8;
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5);
  }
  70% {
    opacity: 0.4;
    box-shadow: 0 0 0 12px rgba(37, 211, 102, 0);
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
    box-shadow: 0 0 0 24px rgba(37, 211, 102, 0);
  }
}
.animate-float-whatsapp {
  animation: float-whatsapp 2.5s ease-in-out infinite;
}
/* حلقة التوهج حول الزر — تظهر بوضوح */
.floating-whatsapp-glow {
  position: relative;
  isolation: isolate;
  box-shadow:
    0 0 20px rgba(37, 211, 102, 0.5),
    0 0 40px rgba(37, 211, 102, 0.25);
}
.floating-whatsapp-glow::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 3px solid rgba(37, 211, 102, 0.6);
  animation: pulse-ring-whatsapp 1.8s ease-out infinite;
  pointer-events: none;
  z-index: -1;
}
.floating-whatsapp-glow > * {
  position: relative;
  z-index: 1;
}
.floating-whatsapp-glow:hover {
  box-shadow:
    0 0 28px rgba(37, 211, 102, 0.6),
    0 0 50px rgba(37, 211, 102, 0.35);
}
@media (prefers-reduced-motion: reduce) {
  .animate-float-whatsapp {
    animation: none;
  }
  .floating-whatsapp-glow::before {
    animation: none;
    opacity: 0;
  }
}

/* react-phone-number-input — توافق مع تصميم الفورم */
.PhoneInput {
  --PhoneInputCountryFlag-height: 1.25rem;
  --PhoneInputCountryFlag-borderColor: var(--border);
  --PhoneInputCountrySelectArrow-color: var(--fg);
  --PhoneInputCountrySelectArrow-opacity: 0.6;
  --PhoneInputColor--focus: var(--accent);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--bg);
  padding-right: 0.5rem;
}
.PhoneInputInput {
  background: var(--bg) !important;
  color: var(--fg) !important;
  border: none !important;
  border-radius: 0 0.75rem 0.75rem 0;
  padding: 0.625rem 1rem;
  font-size: 1rem;
  outline: none;
  box-shadow: none !important;
}
.PhoneInputInput:focus {
  box-shadow: none !important;
}
.PhoneInputInput::placeholder {
  color: var(--muted);
}
.PhoneInput--focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.PhoneInputCountrySelectArrow {
  color: var(--fg);
  opacity: 0.6;
}
[dir="rtl"] .PhoneInputCountryIcon {
  margin-left: 0.5rem;
  margin-right: 0;
}
[dir="rtl"] .PhoneInputInput {
  direction: ltr;
  text-align: right;
}
