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

/* ==========================================================================
   APEX PREMIUM UI - UNIFIED DESIGN SYSTEM
   Strict RTL/LTR logical properties, glassmorphism, micro-animations.
   ========================================================================== */

:root {
  /* Ultra-Premium Deep Dark Theme */
  --bg-color: #05050A; /* Deeper space black */
  --bg-surface: rgba(15, 15, 25, 0.65);
  --bg-surface-hover: rgba(25, 25, 40, 0.75);
  
  /* Primary Accents */
  --accent-cyan: #00F0FF;
  --accent-magenta: #FF0055;
  --accent-gold: #F59E0B;
  --accent-blue: #3B82F6;
  --accent-green: #10B981;
  --accent-red: #EF4444;

  /* Typography */
  --text-primary: #FFFFFF;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  /* Borders & Shadows */
  --border-light: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(0, 240, 255, 0.25);
  --glow-cyan: 0 0 20px rgba(0, 240, 255, 0.15);
  --glow-magenta: 0 0 20px rgba(255, 0, 85, 0.15);
  
  /* Layout constraints */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  
  /* Glassmorphism Variables */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-blur: blur(12px) saturate(180%);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
  
  /* Dynamic font setup */
  --font-sans: 'Cairo', 'Tajawal', 'Inter', sans-serif;
  
  /* Logical Properties for RTL */
  --text-x-direction: 1; /* Default LTR, set to -1 in RTL */
}

[dir="rtl"] {
  --text-x-direction: -1;
  --font-sans: 'Cairo', 'Tajawal', 'Inter', sans-serif;
}

[dir="ltr"] {
  --text-x-direction: 1;
  --font-sans: 'Cairo', 'Tajawal', 'Inter', sans-serif;
}

/* ==========================================================================
   CSS RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-block-size: 100vh;
  line-height: 1.7;
  overflow-x: hidden;
  position: relative;
}

/* Base Ambient Glow Background */
body::before {
  content: '';
  position: fixed;
  inset-block-start: 0;
  inset-inline-start: 0;
  inline-size: 100vw;
  block-size: 100vh;
  background: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.08), transparent 50%),
              radial-gradient(circle at 0% 100%, rgba(255, 0, 85, 0.05), transparent 50%),
              radial-gradient(circle at 100% 100%, rgba(0, 240, 255, 0.05), transparent 50%);
  pointer-events: none;
  z-index: -1;
}

/* Typography Overrides */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 700;
  margin-block-end: 0.75rem;
  line-height: 1.3;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: all 0.3s ease;
}

a:hover {
  text-shadow: var(--glow-cyan);
}

/* ==========================================================================
   GLASSMORPHISM UTILITIES
   ========================================================================== */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-block-start-color: rgba(255, 255, 255, 0.15);
  border-inline-start-color: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-panel:hover {
  border-color: var(--border-accent);
  box-shadow: var(--glow-cyan), 0 16px 48px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-4px) scale(1.01);
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-block-start-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--glass-shadow);
  
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(0, 240, 255, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3), var(--glow-cyan);
  transform: translateY(-3px) scale(1.02);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn-premium {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.1), rgba(59, 130, 246, 0.15));
  color: var(--accent-cyan);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: var(--radius-sm);
  padding-block: 0.75rem;
  padding-inline: 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  text-transform: uppercase;
  letter-spacing: 1px; /* letter-spacing: normal */
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn-premium::before {
  content: '';
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: -100%;
  inline-size: 100%;
  block-size: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: inset-inline-start 0.6s ease;
  z-index: -1;
}

.btn-premium:hover {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(59, 130, 246, 0.25));
  border-color: var(--accent-cyan);
  color: #fff;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.4), inset 0 0 10px rgba(0, 240, 255, 0.2);
  transform: translateY(-2px) scale(1.02);
}

.btn-premium:hover::before {
  inset-inline-start: 100%;
}

.btn-premium:active {
  transform: translateY(0) scale(0.98);
}

.btn-solid {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-magenta));
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding-block: 0.8rem;
  padding-inline: 1.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  z-index: 1;
}

.btn-solid::after {
  content: '';
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  inline-size: 100%;
  block-size: 100%;
  background: linear-gradient(135deg, var(--accent-magenta), var(--accent-blue));
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

.btn-solid:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 30px rgba(255, 0, 85, 0.4);
}

.btn-solid:hover::after {
  opacity: 1;
}

.btn-solid:active {
  transform: translateY(-1px) scale(0.98);
}

/* ==========================================================================
   FORMS & INPUTS (AUTO RTL/LTR)
   ========================================================================== */
.form-group {
  margin-block-end: 1.5rem;
  position: relative;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-block-end: 0.5rem;
  font-weight: 500;
}

.glass-input {
  inline-size: 100%;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding-block: 1rem;
  padding-inline: 1.25rem;
  color: var(--text-primary);
  font-family: inherit;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.glass-input:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}

.glass-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.04);
  box-shadow: inset 0 0 10px rgba(0, 240, 255, 0.1), 0 0 15px rgba(0, 240, 255, 0.2);
  transform: translateY(-1px);
}

.glass-input::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   DASHBOARD SPECIFIC
   ========================================================================== */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset-block-start: 0;
  inset-inline-start: 0;
  inline-size: 4px;
  block-size: 100%;
  background: var(--accent-cyan);
  box-shadow: 0 0 15px var(--accent-cyan);
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-block-end: 0.25rem;
}

.stat-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px; /* letter-spacing: normal */
}

/* ==========================================================================
   ANIMATIONS & UTILITIES
   ========================================================================== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeInUp 0.6s ease forwards;
}

.dir-icon {
  transform: scaleX(var(--text-x-direction, 1));
  display: inline-block;
}

.text-gradient {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-magenta));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ==========================================================================
   ARABIC TYPOGRAPHY & RTL COMPLIANCE
   ========================================================================== */
[dir="rtl"] *, :lang(ar) *, :lang(ar) {
  letter-spacing: normal !important;
}

[dir="rtl"] {
  font-size: 16px;
  line-height: 1.8;
}

[dir="rtl"] .form-label, 
[dir="rtl"] .stat-label {
  font-size: 14px !important;
}

[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6 { line-height: 1.6; }
[dir="rtl"] .form-label { font-size: 14px; }
[dir="rtl"] .stat-value { line-height: 1.6; }
[dir="rtl"] .stat-label { font-size: 14px; letter-spacing: normal !important; }
[dir="rtl"] .btn-premium { letter-spacing: normal !important; }
