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

:root {
  /* Ultra-Smooth Motion */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-in-out-smooth: cubic-bezier(0.65, 0, 0.35, 1);
  --transition-fast: 0.15s var(--ease-out-expo);
  --transition-normal: 0.28s var(--ease-out-expo);
  --transition-slow: 0.5s var(--ease-out-expo);
  --transition-bounce: 0.45s var(--ease-spring);
  --scale-hover: 1.02;
  --scale-active: 0.97;

  /* Spacing Grid (8px base) */
  --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;

  /* Refined Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Precision Typography */
  --font-ar: 'Cairo', system-ui, sans-serif;
  --font-en: 'Outfit', system-ui, sans-serif;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  
  /* Blurs for High-End Devices */
  --blur-sm: blur(8px);
  --blur-md: blur(16px);
  --blur-lg: blur(24px);

  /* Z-index hierarchy */
  --z-dropdown: 100;
  --z-sticky: 1000;
  --z-modal: 2000;
  --z-overlay: 3000;
  --z-toast: 5000;
}

/* Light Theme (Clean, Warm, Minimalist) */
:root,
[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  
  /* Fallback glass for weak devices (solid color fallback) */
  --bg-glass-fallback: rgba(255, 255, 255, 0.95);
  --bg-glass: rgba(255, 255, 255, 0.65);
  --bg-glass-hover: rgba(255, 255, 255, 0.85);
  
  --bg-elevated: #ffffff;
  --bg-inset: #e2e8f0;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --color-primary: #4338ca;
  --color-primary-hover: #3730a3;
  --color-primary-light: rgba(67, 56, 202, 0.1);
  --color-primary-muted: rgba(67, 56, 202, 0.05);

  --color-accent: #0ea5e9;
  --color-accent-hover: #0284c7;
  --color-accent-light: rgba(14, 165, 233, 0.1);

  --color-success: #10b981;
  --color-success-light: rgba(16, 185, 129, 0.1);
  --color-warning: #f59e0b;
  --color-warning-light: rgba(245, 158, 11, 0.1);
  --color-danger: #ef4444;
  --color-danger-light: rgba(239, 68, 68, 0.1);

  --border-color: rgba(15, 23, 42, 0.06);
  --border-strong: rgba(15, 23, 42, 0.12);
  --border-focus: rgba(67, 56, 202, 0.4);
  --ring-focus: 0 0 0 3px rgba(67, 56, 202, 0.15);

  --gradient-primary: linear-gradient(135deg, #4338ca 0%, #6366f1 100%);
  --gradient-accent: linear-gradient(135deg, #0ea5e9 0%, #3b82f6 100%);
  --gradient-surface: linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.6) 100%);
  --gradient-border: linear-gradient(135deg, rgba(67, 56, 202, 0.2), rgba(14, 165, 233, 0.15));

  /* Performance-optimized shadows (fewer layers) */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-sm: 0 2px 4px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
  --shadow-md: 0 6px 16px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(15, 23, 42, 0.03);
  --shadow-lg: 0 16px 32px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 24px 48px rgba(15, 23, 42, 0.1);
  --shadow-glow: 0 0 24px rgba(67, 56, 202, 0.15);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.8);

  --badge-admin-bg: rgba(37, 99, 235, 0.1);
  --badge-admin-text: #1d4ed8;
  --badge-mod-bg: rgba(217, 119, 6, 0.1);
  --badge-mod-text: #b45309;
  --badge-dev-bg: rgba(8, 145, 178, 0.1);
  --badge-dev-text: #0e7490;
  --badge-owner-bg: linear-gradient(135deg, #f59e0b, #ef4444);
  --badge-owner-text: #ffffff;

  --bg-mesh:
    radial-gradient(at 0% 0%, rgba(67, 56, 202, 0.08) 0px, transparent 40%),
    radial-gradient(at 100% 0%, rgba(14, 165, 233, 0.06) 0px, transparent 40%),
    radial-gradient(at 50% 100%, rgba(124, 58, 237, 0.04) 0px, transparent 50%);
}

/* Dark Theme (OLED Black, Rich Indigo, High Contrast) */
[data-theme="dark"] {
  /* True black for maximum OLED punch and performance */
  --bg-primary: #000000;
  --bg-secondary: #09090b;
  --bg-tertiary: #121217;
  
  --bg-glass-fallback: rgba(9, 9, 11, 0.95);
  --bg-glass: rgba(9, 9, 11, 0.6);
  --bg-glass-hover: rgba(18, 18, 23, 0.85);
  
  --bg-elevated: #0f0f13;
  --bg-inset: #050505;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #000000;

  /* Neon-glowing primary */
  --color-primary: #818cf8;
  --color-primary-hover: #a5b4fc;
  --color-primary-light: rgba(129, 140, 248, 0.15);
  --color-primary-muted: rgba(129, 140, 248, 0.05);

  --color-accent: #22d3ee;
  --color-accent-hover: #67e8f9;
  --color-accent-light: rgba(34, 211, 238, 0.15);

  --color-success: #34d399;
  --color-success-light: rgba(52, 211, 153, 0.15);
  --color-warning: #fbbf24;
  --color-warning-light: rgba(251, 191, 36, 0.15);
  --color-danger: #f87171;
  --color-danger-light: rgba(248, 113, 113, 0.15);

  --border-color: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --border-focus: rgba(129, 140, 248, 0.6);
  --ring-focus: 0 0 0 3px rgba(129, 140, 248, 0.25);

  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --gradient-surface: linear-gradient(180deg, rgba(15, 15, 19, 0.95) 0%, rgba(9, 9, 11, 0.8) 100%);
  --gradient-border: linear-gradient(135deg, rgba(129, 140, 248, 0.5), rgba(34, 211, 238, 0.3));

  /* Dark mode shadows are mostly pure black for performance */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 16px rgba(0, 0, 0, 0.6), 0 4px 8px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.7), 0 8px 16px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.8);
  --shadow-glow: 0 0 32px rgba(99, 102, 241, 0.25);
  --shadow-inner: inset 0 1px 0 rgba(255, 255, 255, 0.05);

  --badge-admin-bg: rgba(59, 130, 246, 0.15);
  --badge-admin-text: #93c5fd;
  --badge-mod-bg: rgba(251, 191, 36, 0.15);
  --badge-mod-text: #fcd34d;
  --badge-dev-bg: rgba(34, 211, 238, 0.15);
  --badge-dev-text: #67e8f9;
  --badge-owner-bg: linear-gradient(135deg, #f59e0b, #ef4444);
  --badge-owner-text: #ffffff;

  --bg-mesh:
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 40%),
    radial-gradient(at 100% 0%, rgba(34, 211, 238, 0.12) 0px, transparent 40%),
    radial-gradient(at 50% 100%, rgba(139, 92, 246, 0.1) 0px, transparent 50%);
}
