@import url('https://fonts.googleapis.com/css2?family=Almarai:wght@300;400;700;800&family=Inter:wght@300;400;500;600;700&display=swap');


/* ============================================
   تدفق - Modern SaaS Dashboard 2026
   Stripe-inspired / Almarai
   ============================================ */
/* ===== TADFUQ display font (headings) ===== */
@font-face{font-family:'TheYearofHandicrafts';src:url('/assets/fonts/handicrafts/alfont_com_TheYearofHandicrafts-Regular.otf') format('opentype');font-weight:400;font-display:swap}
@font-face{font-family:'TheYearofHandicrafts';src:url('/assets/fonts/handicrafts/alfont_com_TheYearofHandicrafts-Medium.otf') format('opentype');font-weight:500;font-display:swap}
@font-face{font-family:'TheYearofHandicrafts';src:url('/assets/fonts/handicrafts/alfont_com_TheYearofHandicrafts-SemiBold.otf') format('opentype');font-weight:600;font-display:swap}
@font-face{font-family:'TheYearofHandicrafts';src:url('/assets/fonts/handicrafts/alfont_TheYearofHandicrafts-Black.otf') format('opentype');font-weight:900;font-display:swap}
h1,h2,h3,h4{font-family:'TheYearofHandicrafts','Almarai',sans-serif;}
:root {
  /* Background */
  --bg-primary: #F8FAFC;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #F1F5F9;

  /* Sidebar */
  --sidebar-bg: #FFFFFF;
  --sidebar-text: #64748B;
  --sidebar-active: #0097A7;
  --sidebar-hover: rgba(0, 151, 167,0.06);
  --sidebar-border: #E2E8F0;

  /* Text - Slate */
  --text-primary: #0A2D33;
  --text-secondary: #64748B;
  --text-tertiary: #94A3B8;
  --text-inverse: #FFFFFF;

  /* Borders */
  --border: #E2E8F0;
  --border-light: #F1F5F9;

  /* Brand / Accent - Teal */
  --accent: #0097A7;
  --accent-light: #D5F7F2;
  --accent-dark: #00788A;
  --accent-50: rgba(0, 151, 167,0.08);

  /* Status */
  --success: #22C55E;
  --success-bg: #F0FDF4;
  --success-text: #166534;
  --warning: #F59E0B;
  --warning-bg: #FFFBEB;
  --warning-text: #92400E;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --danger-text: #991B1B;
  --info: #3B82F6;
  --info-bg: #EFF6FF;
  --info-text: #1E40AF;

  /* Shadows - Softer */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.06), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.06), 0 4px 6px -2px rgba(0,0,0,0.03);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.06);

  /* Radius - Rounder */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-full: 9999px;

  /* Layout */
  --sidebar-width: 240px;
  --topbar-height: 56px;

  /* Transitions */
  --transition: 150ms ease;
  --transition-fast: 100ms ease;
  --transition-slow: 250ms ease;

  /* Typography - Almarai */
  --font-sans: 'Almarai', 'Inter', system-ui, -apple-system, sans-serif;
  --font-arabic: 'Almarai', 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', 'JetBrains Mono', monospace;

  /* Topbar (ink brand) */
  --topbar-bg: #0A2D33;

  /* Extended neutrals (تُطابق design-tokens في الوضع الفاتح حرفياً) */
  --gray-900: #1E293B;
  --gray-800: #334155;
  --gray-700: #475569;
  --gray-400: #94A3B8;
  --gray-300: #CBD5E1;

  /* Purple (admin/special) */
  --purple: #8B5CF6;
  --purple-bg: #F5F3FF;
  --purple-text: #6D28D9;

  /* Status extras */
  --success-dark: #16A34A;
  --danger-dark: #DC2626;
  --warning-dark: #D97706;

  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.02);

  /* Misc */
  --scrollbar-thumb: #CBD5E1;
  --scrollbar-thumb-hover: #94A3B8;
  --skeleton-a: #F1F5F9;
  --skeleton-b: #E2E8F0;
  --overlay-bg: rgba(15, 23, 42, 0.4);

  color-scheme: light;
}
/* ============================================
   الوضع الليلي — درجات حبر الهوية (#0A2D33)
   يُفعّل بـ data-theme="dark" على <html>
   ============================================ */
[data-theme="dark"] {
  /* Background */
  --bg-primary: #0B1A1F;
  --bg-secondary: #10262D;
  --bg-tertiary: #16333B;

  /* Sidebar */
  --sidebar-bg: #10262D;
  --sidebar-text: #8FB0B8;
  --sidebar-active: #2BC5D4;
  --sidebar-hover: rgba(43, 197, 212, 0.08);
  --sidebar-border: #1C3A43;

  /* Text */
  --text-primary: #E8F1F2;
  --text-secondary: #9DB4BA;
  --text-tertiary: #6E8A91;
  --text-inverse: #0A2D33;

  /* Borders */
  --border: #1F3E47;
  --border-light: #17323A;

  /* Brand / Accent */
  --accent: #2BC5D4;
  --accent-light: rgba(0, 209, 178, 0.14);
  --accent-dark: #0097A7;
  --accent-50: rgba(43, 197, 212, 0.10);

  /* Status */
  --success: #34D399;
  --success-bg: rgba(34, 197, 94, 0.12);
  --success-text: #6EE7A0;
  --warning: #FBBF24;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --warning-text: #FCD34D;
  --danger: #F87171;
  --danger-bg: rgba(239, 68, 68, 0.14);
  --danger-text: #FCA5A5;
  --info: #60A5FA;
  --info-bg: rgba(59, 130, 246, 0.14);
  --info-text: #93C5FD;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.35), 0 1px 2px rgba(0,0,0,0.25);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -1px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.45), 0 4px 6px -2px rgba(0,0,0,0.3);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.4);

  /* Topbar */
  --topbar-bg: #10262D;

  /* Extended neutrals */
  --gray-900: #DFE9EC;
  --gray-800: #C6D6DB;
  --gray-700: #A9C0C7;
  --gray-400: #6E8A91;
  --gray-300: #2A4A53;

  /* Purple */
  --purple: #A78BFA;
  --purple-bg: rgba(139, 92, 246, 0.16);
  --purple-text: #C4B5FD;

  /* Status extras */
  --success-dark: #34D399;
  --danger-dark: #F87171;
  --warning-dark: #FBBF24;

  --shadow-card: 0 1px 3px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.04);

  /* Misc */
  --scrollbar-thumb: #2A4A53;
  --scrollbar-thumb-hover: #3D5C63;
  --skeleton-a: #16333B;
  --skeleton-b: #1F3E47;
  --overlay-bg: rgba(0, 0, 0, 0.6);

  color-scheme: dark;
}
/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-arabic);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  /* الاتجاه يُحدَّد ديناميكياً من dir على <html> (rtl للعربية / ltr للإنجليزية) */
  text-align: start;
  font-size: 14px;
  line-height: 1.65;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  font-weight: 400;
}
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }
button {
  cursor: pointer; border: none; background: none;
  font-family: inherit; font-size: inherit;
}
input, textarea, select {
  font-family: inherit; font-size: inherit;
  border: none; outline: none;
}
table { border-collapse: collapse; width: 100%; }
/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) transparent; }
/* ── Focus styles ── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* ── Selection ── */
::selection {
  background: rgba(0, 151, 167, 0.15);
  color: var(--text-primary);
}
/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
/* ── Skeleton ── */
.skeleton {
  background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 50%, var(--skeleton-a) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
/* ── Overlay / Modal ── */
.overlay {
  position: fixed; inset: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 200ms ease;
}
.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  box-shadow: 0 25px 50px rgba(0,0,0,0.12);
  padding: 28px;
  width: 90%; max-width: 520px; max-height: 85vh;
  overflow-y: auto;
  animation: scaleIn 200ms ease;
}
/* ── Toast ── */
.toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: fit-content;
  max-width: 90vw;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text-primary);
  font-family: var(--font-arabic);
  pointer-events: auto;
  animation: slideInUp 200ms ease;
  min-width: 280px;
}
.toast-exit {
  animation: fadeOut 200ms ease forwards;
}
.toast-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.toast-content {
  flex: 1;
  min-width: 0;
}
.toast-message {
  margin: 0;
  line-height: 1.5;
}
.toast-close {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: color var(--transition);
}
.toast-close:hover {
  color: var(--text-primary);
}
.toast-success { border-inline-start: 3px solid var(--success); }
.toast-error { border-inline-start: 3px solid var(--danger); }
.toast-warning { border-inline-start: 3px solid var(--warning); }
.toast-info { border-inline-start: 3px solid var(--info); }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-8px); } }
/* ── Responsive ── */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; --topbar-height: 56px; }
}
