/* ============================================
   Dkhoun Design System — CSS Custom Properties
   ============================================ */

/* Montserrat Arabic - Local File */
@font-face {
  font-family: 'Montserrat Arabic';
  src: url('../fonts/ArbFONTS-Montserrat-Arabic-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ---- Brand Colors ---- */
  --color-gold: #B89656;
  --color-dark-gold: #8B6914;
  --color-accent-gold: #C4A265;
  --color-light-gold: #D4C5A0;
  --color-dark: #2C2C2C;
  --color-cream: #F5F0E8;
  --color-white: #FAF7F0;
  --color-pure-white: #FFFFFF;

  /* ---- Extended Palette ---- */
  --color-gold-50: #FBF7F0;
  --color-gold-100: #F3EBDA;
  --color-gold-200: #E8D9B8;
  --color-gold-300: #D4C5A0;
  --color-gold-400: #C4A265;
  --color-gold-500: #B89656;
  --color-gold-600: #A07D3A;
  --color-gold-700: #8B6914;
  --color-gold-800: #6B5010;
  --color-gold-900: #4A370B;

  --color-dark-50: #F5F5F5;
  --color-dark-100: #E0E0E0;
  --color-dark-200: #B0B0B0;
  --color-dark-300: #808080;
  --color-dark-400: #5A5A5A;
  --color-dark-500: #3D3D3D;
  --color-dark-600: #2C2C2C;
  --color-dark-700: #1F1F1F;
  --color-dark-800: #141414;
  --color-dark-900: #0A0A0A;

  /* ---- Semantic Colors ---- */
  --color-success: #2ECC71;
  --color-success-light: #E8F8EF;
  --color-success-dark: #1A9B4B;
  --color-warning: #F39C12;
  --color-warning-light: #FEF5E7;
  --color-warning-dark: #C47E0A;
  --color-danger: #E74C3C;
  --color-danger-light: #FDEDEC;
  --color-danger-dark: #C0392B;
  --color-info: #3498DB;
  --color-info-light: #EBF5FB;
  --color-info-dark: #2176AE;

  /* ---- Priority Colors ---- */
  --priority-critical: #C0392B;
  --priority-high: #E74C3C;
  --priority-medium: #F39C12;
  --priority-low: #2ECC71;
  --priority-none: #95A5A6;

  /* ---- Status Colors ---- */
  --status-open: #3498DB;
  --status-in-progress: #F39C12;
  --status-pending: #9B59B6;
  --status-resolved: #2ECC71;
  --status-closed: #95A5A6;
  --status-active: #2ECC71;
  --status-inactive: #E74C3C;
  --status-maintenance: #F39C12;

  /* ---- Typography ---- */
  --font-primary: 'Montserrat', system-ui, -apple-system, sans-serif;
  --font-arabic: 'Montserrat Arabic', 'Montserrat', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  --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: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  --leading-none: 1;
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;

  --font-thin: 100;
  --font-light: 300;
  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-extrabold: 800;

  --tracking-tight: -0.025em;
  --tracking-normal: 0;
  --tracking-wide: 0.025em;

  /* ---- Spacing Scale ---- */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;
  --space-40: 10rem;
  --space-48: 12rem;

  /* ---- Border Radius ---- */
  --radius-none: 0;
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-3xl: 2rem;
  --radius-full: 9999px;

  /* ---- Shadows ---- */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
  --shadow-inner: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-gold: 0 4px 14px rgba(184, 150, 86, 0.25);
  --shadow-gold-lg: 0 10px 30px rgba(184, 150, 86, 0.3);
  --shadow-dark: 0 4px 14px rgba(44, 44, 44, 0.2);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06), 0 0 1px rgba(0, 0, 0, 0.1);
  --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.1), 0 0 1px rgba(0, 0, 0, 0.1);

  /* ---- 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: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slower: 500ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ---- Z-Index Layers ---- */
  --z-below: -1;
  --z-base: 0;
  --z-raised: 10;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-sidebar: 300;
  --z-header: 400;
  --z-overlay: 500;
  --z-modal: 600;
  --z-toast: 700;
  --z-tooltip: 800;
  --z-max: 9999;

  /* ---- Layout Dimensions ---- */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 72px;
  --header-height: 64px;
  --content-max-width: 1400px;
  --content-padding: var(--space-6);

  /* ---- Glass Morphism ---- */
  --glass-bg: rgba(255, 255, 255, 0.12);
  --glass-bg-strong: rgba(255, 255, 255, 0.2);
  --glass-border: rgba(255, 255, 255, 0.18);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  --glass-blur: blur(16px);
  --glass-blur-strong: blur(24px);

  /* ---- Responsive Breakpoints (as custom props for JS) ---- */
  --bp-xs: 480px;
  --bp-sm: 640px;
  --bp-md: 768px;
  --bp-lg: 1024px;
  --bp-xl: 1280px;
  --bp-2xl: 1536px;

  /* ---- Overlay ---- */
  --overlay-light: rgba(0, 0, 0, 0.3);
  --overlay-medium: rgba(0, 0, 0, 0.5);
  --overlay-dark: rgba(0, 0, 0, 0.7);

  /* ---- Gradients ---- */
  --gradient-gold: linear-gradient(135deg, var(--color-gold) 0%, var(--color-dark-gold) 100%);
  --gradient-gold-soft: linear-gradient(135deg, var(--color-accent-gold) 0%, var(--color-gold) 100%);
  --gradient-dark: linear-gradient(135deg, var(--color-dark) 0%, var(--color-dark-800) 100%);
  --gradient-gold-dark: linear-gradient(135deg, var(--color-gold) 0%, var(--color-dark) 100%);
  --gradient-hero: linear-gradient(160deg, var(--color-gold) 0%, var(--color-dark-gold) 40%, var(--color-dark) 100%);
  --gradient-card: linear-gradient(180deg, var(--color-pure-white) 0%, var(--color-cream) 100%);
  --gradient-sidebar: linear-gradient(180deg, var(--color-dark-700) 0%, var(--color-dark-800) 100%);

  /* ---- Animation Variables ---- */
  --anim-stagger-base: 60ms;
  --anim-duration-reveal: 0.6s;
  --anim-duration-shimmer: 2.5s;
  --anim-ease-reveal: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---- Responsive Breakpoint Mixins via Container Queries ---- */
/* Usage: Wrap sections in a container and use @container */

/* ---- RTL Support ---- */
[dir="rtl"] {
  --font-primary: var(--font-arabic);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  transition: background-color 0.3s ease, color 0.3s ease;
}

html[data-theme="dark"] * {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Exclude elements that need instant transitions for performance */
html[data-theme="dark"] canvas,
html[data-theme="dark"] svg,
html[data-theme="dark"] img,
html[data-theme="dark"] video {
  transition: none;
}

@media (prefers-reduced-motion: reduce) {
  html,
  html[data-theme="dark"] * {
    transition: none !important;
  }
}

body {
  font-family: var(--font-primary);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-dark);
  background-color: var(--color-cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

[dir="rtl"] body {
  font-family: var(--font-arabic);
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Focus Visible ---- */
:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Selection ---- */
::selection {
  background-color: var(--color-gold);
  color: var(--color-pure-white);
}

/* ---- Scrollbar Styling ---- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-cream);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: var(--color-light-gold);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-cream);

  &:hover {
    background: var(--color-accent-gold);
  }
}

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