/* ══════════════════════════════════════════════════════════════
   Hefni Media — Base CSS
   RTL بالكامل، Mobile-First، متغيرات CSS قابلة التحديث
   ══════════════════════════════════════════════════════════════ */

/* ── متغيرات CSS الافتراضية ─────────────────────────────────── */
:root {
  --color-primary:    #0F2A43;
  --color-accent:     #D4A94E;
  --color-bg:         #ffffff;
  --color-bg-alt:     #f8f7f4;
  --color-text:       #1a1a1a;
  --color-text-muted: #6b7280;
  --color-border:     #e5e7eb;
  --color-success:    #22c55e;
  --color-error:      #ef4444;
  --color-warning:    #f59e0b;

  --font-display: 'El Messiri', 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  --font-main:    'Mada', 'Cairo', 'Segoe UI', Tahoma, sans-serif;

  --radius:     10px;
  --shadow:     0 2px 16px rgba(0,0,0,0.07);
  --shadow-md:  0 8px 32px rgba(0,0,0,0.12);
  --transition: 0.22s ease;

  --container:    1200px;
  --gap:          24px;
  --navbar-height: 100px; /* top(16) + pill(68) + gap(16) */
}

/* ── الوضع الليلي — نفس المتغيرات فقط للأسطح/النصوص الفاتحة ──────
   color-primary/accent تبقى كما هي لأنها أصلاً داكنة (هيدر/فوتر/أزرار) */
:root[data-theme="dark"] {
  --color-bg:         #0f1620;
  --color-bg-alt:     #161f2c;
  --color-text:       #e8e6df;
  --color-text-muted: #97a1ac;
  --color-border:     #29394d;
  --shadow:     0 2px 16px rgba(0,0,0,0.35);
  --shadow-md:  0 8px 32px rgba(0,0,0,0.5);
}

/* الانتقال السلس بين الوضعين */
body, .card, .navbar, header { transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease; }

/* ── زر تبديل الوضع الليلي ─────────────────────────────────────── */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  transition: background var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,0.16); transform: scale(1.06); }

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  direction: rtl;
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
ul, ol { list-style: none; }

/* ── Container ─────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}
@media (min-width: 640px)  { .container { padding: 0 28px; } }
@media (min-width: 1024px) { .container { padding: 0 44px; } }

/* ── Typography — El Messiri للعناوين، Mada للنص ──────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(1.9rem, 5.5vw, 3rem);   font-weight: 700; line-height: 1.18; }
h2 { font-size: clamp(1.45rem, 3.8vw, 2.15rem); font-weight: 700; line-height: 1.28; }
h3 { font-size: clamp(1.1rem, 2.5vw, 1.45rem); font-weight: 600; }
p  { font-size: 1rem; line-height: 1.75; }

.text-accent  { color: var(--color-accent); }
.text-primary { color: var(--color-primary); }
.text-muted   { color: var(--color-text-muted); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-sm      { font-size: 0.875rem; }
.text-lg      { font-size: 1.125rem; }
.font-bold    { font-weight: 700; }

/* ── Reveal Animations — فقط عندما يشتغل JS (class="js-reveal" على body) ── */
/* بدون JS = كل شيء مرئي فوراً */
.js-reveal [data-reveal] {
  opacity: 0;
  transition: opacity 0.65s cubic-bezier(0.22,1,0.36,1) var(--rd, 0s),
              transform 0.65s cubic-bezier(0.22,1,0.36,1) var(--rd, 0s);
}
.js-reveal [data-reveal="up"]    { transform: translateY(36px); }
.js-reveal [data-reveal="down"]  { transform: translateY(-24px); }
.js-reveal [data-reveal="left"]  { transform: translateX(36px); }
.js-reveal [data-reveal="right"] { transform: translateX(-36px); }
.js-reveal [data-reveal="scale"] { transform: scale(0.88); }

.js-reveal [data-reveal].revealed {
  opacity: 1;
  transform: none !important;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  text-align: center;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
  box-shadow: 0 4px 14px rgba(212,169,78,0.3);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(212,169,78,0.4); }

.btn-outline {
  background: transparent;
  color: var(--color-accent);
  border-color: var(--color-accent);
}
.btn-outline:hover { background: var(--color-accent); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-ghost:hover { border-color: var(--color-accent); color: var(--color-accent); }

.btn-lg { padding: 15px 36px; font-size: 1.05rem; border-radius: 12px; }
.btn-sm { padding: 8px 16px; font-size: 0.875rem; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 0.9rem; font-weight: 600; }

.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
  direction: rtl;
}
.form-input:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(212,169,78,0.12); }
.form-input.error { border-color: var(--color-error); }

.form-error { font-size: 0.8rem; color: var(--color-error); }
.form-help  { font-size: 0.8rem; color: var(--color-text-muted); }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-primary { background: var(--color-primary); color: #fff; }
.badge-accent  { background: var(--color-accent);  color: #fff; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-error   { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-muted   { background: var(--color-bg-alt); color: var(--color-text-muted); }

/* ── Dividers ───────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid var(--color-border); margin: 24px 0; }

/* ── Section Padding ────────────────────────────────────────────── */
.section    { padding: 72px 0; }
.section-sm { padding: 44px 0; }

/* ── Grid ───────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
.grid-3 { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }

@media (min-width: 640px)  { .grid-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 768px)  { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1024px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

/* ── Flex Utilities ─────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

/* ── Spacing ────────────────────────────────────────────────────── */
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }

/* ── Alerts ─────────────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border-right: 4px solid;
}
.alert-success { background: #dcfce7; border-color: var(--color-success); color: #166534; }
.alert-error   { background: #fee2e2; border-color: var(--color-error);   color: #991b1b; }
.alert-warning { background: #fef3c7; border-color: var(--color-warning); color: #92400e; }
.alert-info    { background: #dbeafe; border-color: #3b82f6;              color: #1e40af; }

/* ── Loading ────────────────────────────────────────────────────── */
.loading-spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--color-bg-alt) 25%, var(--color-border) 50%, var(--color-bg-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Hidden ─────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.invisible { visibility: hidden; }

/* ── Section Header ─────────────────────────────────────────────── */
.section-header { text-align: center; margin-bottom: 52px; }
.section-header h2 { margin-bottom: 14px; }
.section-header p { color: var(--color-text-muted); max-width: 580px; margin: 0 auto; font-size: 1.05rem; }

/* ── WhatsApp Float Button ──────────────────────────────────────── */
.whatsapp-float {
  position: fixed;
  bottom: 28px;
  left: 28px;
  z-index: 1000;
  text-decoration: none;
}

.whatsapp-float-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25D366 0%, #1da851 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 5px 22px rgba(37,211,102,0.42);
  position: relative;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

/* Pulse rings */
.whatsapp-float-icon::before,
.whatsapp-float-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #25D366;
  z-index: -1;
  animation: wa-pulse 2.8s ease-out infinite;
}
.whatsapp-float-icon::after { animation-delay: 1.4s; }

@keyframes wa-pulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  80%  { transform: scale(1.65); opacity: 0; }
  100% { transform: scale(1.65); opacity: 0; }
}

.whatsapp-float-icon svg { width: 30px; height: 30px; fill: #fff; }

.whatsapp-float:hover .whatsapp-float-icon {
  transform: scale(1.1);
  box-shadow: 0 8px 28px rgba(37,211,102,0.55);
}

@keyframes wa-enter {
  from { opacity: 0; transform: scale(0.5) translateY(20px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}
.whatsapp-float.visible {
  animation: wa-enter 0.4s cubic-bezier(0.22,1,0.36,1) both;
}
