/* ========================================
   rakez ركز — Design System
   ======================================== */

/* ─── CSS Custom Properties ─── */
:root {
  /* Brand Colors */
  --clr-primary: #5145dc;
  --clr-primary-light: #818cf8;
  --clr-primary-dark: #4338ca;
  --clr-primary-gradient: linear-gradient(135deg, #5145dc, #4338ca);
  --clr-primary-glow: rgba(81, 69, 220, 0.25);
  --clr-primary-subtle: rgba(81, 69, 220, 0.08);

  /* Background Layers */
  --clr-bg: #0b0e14;
  --clr-bg-2: #0f131a;
  --clr-surface: #131924;
  --clr-surface-2: #1a202c;
  --clr-surface-3: #212836;
  --clr-sidebar: #0c1017;
  --clr-bg-base: var(--clr-bg);

  /* Glass Effect */
  --glass-bg: rgba(19, 25, 36, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-hover: rgba(0, 102, 255, 0.06);

  /* Text */
  --clr-text: #f1f5f9;
  --clr-text-muted: #94a3b8;
  --clr-text-dim: #64748b;
  --clr-text-on-primary: #ffffff;

  /* Semantic Colors */
  --clr-success: #10b981;
  --clr-success-bg: rgba(16, 185, 129, 0.1);
  --clr-warning: #f59e0b;
  --clr-warning-bg: rgba(245, 158, 11, 0.1);
  --clr-danger: #ef4444;
  --clr-danger-bg: rgba(239, 68, 68, 0.1);
  --clr-info: #06b6d4;
  --clr-info-bg: rgba(6, 182, 212, 0.1);

  /* Priority Colors */
  --clr-priority-high: #ef4444;
  --clr-priority-med: #f59e0b;
  --clr-priority-low: #10b981;

  /* Borders */
  --border-subtle: 1px solid rgba(255, 255, 255, 0.08);
  --border-glow: 1px solid rgba(81, 69, 220, 0.22);
  --border-card: 1px solid rgba(255, 255, 255, 0.08);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(0, 102, 255, 0.15);
  --shadow-glow-strong: 0 0 50px rgba(0, 102, 255, 0.25);

  /* Typography */
  --font-arabic: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --font-numbers: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  /* Compatibility aliases used by older feature modules */
  --primary-color: var(--clr-primary);
  --surface-color: var(--clr-surface);
  --text-primary: var(--clr-text);
  --text-secondary: var(--clr-text-muted);
  --bg2: var(--clr-bg-2);
  --bg-color: var(--clr-bg);
  --border-color: rgba(255, 255, 255, 0.08);
  --line-color: rgba(255, 255, 255, 0.06);
  --control-bg: rgba(255, 255, 255, 0.06);
  --control-hover-bg: rgba(255, 255, 255, 0.1);
  --control-border: transparent;
  --input-bg: rgba(255, 255, 255, 0.05);
  --input-border: transparent;
  --input-hover-border: rgba(0, 102, 255, 0.45);
  --input-disabled-bg: rgba(255, 255, 255, 0.04);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Border Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;
  --content-max-width: 1400px;

  /* Z-index Scale */
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-overlay: 300;
  --z-modal: 400;
  --z-toast: 500;
}

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

html {
  direction: rtl;
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  color-scheme: dark;
  touch-action: manipulation;
}

/* ─── Light Mode Override ─── */
html.light {
  color-scheme: light;

  /* Brand Colors (slightly darker for contrast on white) */
  --clr-primary: #5145dc;
  --clr-primary-light: #818cf8;
  --clr-primary-dark: #3730a3;
  --clr-primary-gradient: linear-gradient(135deg, #5145dc, #3730a3);
  --clr-primary-glow: rgba(81, 69, 220, 0.15);
  --clr-primary-subtle: rgba(81, 69, 220, 0.06);

  /* Background Layers */
  --clr-bg: #f5f5f9;
  --clr-bg-2: #eeeef4;
  --clr-surface: #ffffff;
  --clr-surface-2: #f8f8fc;
  --clr-surface-3: #f0f0f6;
  --clr-sidebar: #ffffff;
  --clr-bg-base: #f5f5f9;

  /* Glass Effect */
  --glass-bg: rgba(255, 255, 255, 0.75);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-hover: rgba(99, 102, 241, 0.04);

  /* Text */
  --clr-text: #1e293b;
  --clr-text-muted: #64748b;
  --clr-text-dim: #94a3b8;
  --clr-text-on-primary: #ffffff;

  /* Semantic Colors */
  --clr-success: #16a34a;
  --clr-success-bg: rgba(22, 163, 74, 0.08);
  --clr-warning: #d97706;
  --clr-warning-bg: rgba(217, 119, 6, 0.08);
  --clr-danger: #dc2626;
  --clr-danger-bg: rgba(220, 38, 38, 0.08);
  --clr-info: #2563eb;
  --clr-info-bg: rgba(37, 99, 235, 0.08);

  /* Priority Colors */
  --clr-priority-high: #dc2626;
  --clr-priority-med: #d97706;
  --clr-priority-low: #16a34a;

  /* Borders */
  --border-subtle: 1px solid rgba(15, 23, 42, 0.08);
  --border-glow: 1px solid rgba(81, 69, 220, 0.18);
  --border-card: 1px solid rgba(15, 23, 42, 0.08);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.1);
  --shadow-glow-strong: 0 0 40px rgba(99, 102, 241, 0.2);

  /* Card background */
  --clr-bg-card: #ffffff;
  --primary-color: var(--clr-primary);
  --surface-color: var(--clr-surface);
  --text-primary: var(--clr-text);
  --text-secondary: var(--clr-text-muted);
  --bg2: var(--clr-bg-2);
  --bg-color: var(--clr-bg);
  --border-color: rgba(15, 23, 42, 0.1);
  --line-color: rgba(15, 23, 42, 0.08);
  --control-bg: #ffffff;
  --control-hover-bg: #f1f5f9;
  --control-border: rgba(148, 163, 184, 0.34);
  --input-bg: #ffffff;
  --input-border: rgba(100, 116, 139, 0.32);
  --input-hover-border: rgba(99, 102, 241, 0.55);
  --input-disabled-bg: #eef2f7;
}

html.light body {
  background-color: var(--clr-bg);
}

html.light body::before {
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(99, 102, 241, 0.04) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(129, 140, 248, 0.03) 0%, transparent 60%);
}

html.light ::-webkit-scrollbar-track {
  background: #f0f0f5;
}

html.light ::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.25);
}

html.light ::-webkit-scrollbar-thumb:hover {
  background: rgba(99, 102, 241, 0.4);
}

/* ─── LTR Mode Override ─── */
html.ltr {
  direction: ltr;
}

body {
  font-family: var(--font-arabic);
  background-color: var(--clr-bg);
  color: var(--clr-text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scrollbar-width: none;
  /* Firefox */
  -ms-overflow-style: none;
  /* IE and Edge */
}

/* Animated gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 20% 0%, rgba(81, 69, 220, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(6, 182, 212, 0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

img,
video {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input,
textarea,
select {
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.3;
}

/* ─── Custom Scrollbar ─── */
::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: transparent;
}

::-webkit-scrollbar-thumb:hover {
  background: transparent;
}

/* ─── Utility Classes ─── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-2 {
  gap: var(--space-2);
}

.gap-3 {
  gap: var(--space-3);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

.w-full {
  width: 100%;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--clr-text-muted);
}

.text-primary {
  color: var(--clr-primary);
}

.font-bold {
  font-weight: 700;
}

.font-semibold {
  font-weight: 600;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

.relative {
  position: relative;
}

/* ─── Glass Card ─── */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition:
    background-color var(--transition-base),
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    transform var(--transition-base);
}


.glass-card.hoverable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

/* ─── Glow Effect ─── */
.glow {
  box-shadow: var(--shadow-glow);
}

.glow-strong {
  box-shadow: var(--shadow-glow-strong);
}

/* ─── Status Badge ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-primary {
  background: var(--clr-primary-subtle);
  color: var(--clr-primary-light);
  border: none;
}

.badge-success {
  background: var(--clr-success-bg);
  color: var(--clr-success);
  border: none;
}

.badge-warning {
  background: var(--clr-warning-bg);
  color: var(--clr-warning);
  border: none;
}

.badge-danger {
  background: var(--clr-danger-bg);
  color: var(--clr-danger);
  border: none;
}

.badge-info {
  background: var(--clr-info-bg);
  color: var(--clr-info);
  border: none;
}

/* ─── Progress Bar ─── */
.progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--clr-primary-dark), var(--clr-primary-light));
  transition: width var(--transition-slow);
}

/* ─── Divider ─── */
.divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  border: none;
  margin: var(--space-4) 0;
}


@media (min-width: 640px) {
  #mbn-popup-menu {
    display: none;
  }
}
