/* ============================================
   ERP Design System - Professional & Modern
   ============================================ */

:root {
    /* ===== Color Palette - Professional & Vibrant ===== */
    
    /* Primary Colors - Purple Theme */
    --erp-primary-50: #f5f3ff;
    --erp-primary-100: #ede9fe;
    --erp-primary-200: #ddd6fe;
    --erp-primary-300: #c4b5fd;
    --erp-primary-400: #a78bfa;
    --erp-primary-500: #8b5cf6;
    --erp-primary-600: #7c3aed;
    --erp-primary-700: #6d28d9;
    --erp-primary-800: #5b21b6;
    --erp-primary-900: #4c1d95;
    --erp-primary-950: #2e1065;
    
    /* Accent Colors */
    --erp-accent-yellow: #fbbf24;
    --erp-accent-yellow-light: #fde68a;
    --erp-accent-yellow-dark: #f59e0b;
    --erp-accent-cyan: #06b6d4;
    --erp-accent-cyan-light: #67e8f9;
    --erp-accent-cyan-dark: #0891b2;
    
    /* Status Colors */
    --erp-success: #10b981;
    --erp-success-light: #34d399;
    --erp-success-dark: #059669;
    --erp-warning: #f59e0b;
    --erp-warning-light: #fbbf24;
    --erp-warning-dark: #d97706;
    --erp-error: #ef4444;
    --erp-error-light: #f87171;
    --erp-error-dark: #dc2626;
    --erp-info: #3b82f6;
    --erp-info-light: #60a5fa;
    --erp-info-dark: #2563eb;
    
    /* Neutral Colors - Light Theme */
    --erp-gray-50: #f9fafb;
    --erp-gray-100: #f3f4f6;
    --erp-gray-200: #e5e7eb;
    --erp-gray-300: #d1d5db;
    --erp-gray-400: #9ca3af;
    --erp-gray-500: #6b7280;
    --erp-gray-600: #4b5563;
    --erp-gray-700: #374151;
    --erp-gray-800: #1f2937;
    --erp-gray-900: #111827;
    
    /* Dark Theme Colors */
    --erp-dark-bg-primary: #0f172a;
    --erp-dark-bg-secondary: #1e293b;
    --erp-dark-bg-tertiary: #334155;
    --erp-dark-text-primary: #f1f5f9;
    --erp-dark-text-secondary: #cbd5e1;
    --erp-dark-text-tertiary: #94a3b8;
    --erp-dark-border: #334155;
    
    /* Light Theme Colors */
    --erp-light-bg-primary: #ffffff;
    --erp-light-bg-secondary: #f8fafc;
    --erp-light-bg-tertiary: #f1f5f9;
    --erp-light-text-primary: #0f172a;
    --erp-light-text-secondary: #475569;
    --erp-light-text-tertiary: #64748b;
    --erp-light-border: #e2e8f0;
    
    /* Theme Variables (Default: Light) */
    --erp-bg-primary: var(--erp-light-bg-primary);
    --erp-bg-secondary: var(--erp-light-bg-secondary);
    --erp-bg-tertiary: var(--erp-light-bg-tertiary);
    --erp-text-primary: var(--erp-light-text-primary);
    --erp-text-secondary: var(--erp-light-text-secondary);
    --erp-text-tertiary: var(--erp-light-text-tertiary);
    --erp-border: var(--erp-light-border);
    --erp-shadow-color: rgba(0, 0, 0, 0.1);
    
    /* ===== Spacing Scale (8pt grid) ===== */
    --erp-space-0: 0;
    --erp-space-1: 0.25rem;   /* 4px */
    --erp-space-2: 0.5rem;    /* 8px */
    --erp-space-3: 0.75rem;   /* 12px */
    --erp-space-4: 1rem;      /* 16px */
    --erp-space-5: 1.25rem;   /* 20px */
    --erp-space-6: 1.5rem;    /* 24px */
    --erp-space-8: 2rem;       /* 32px */
    --erp-space-10: 2.5rem;   /* 40px */
    --erp-space-12: 3rem;     /* 48px */
    --erp-space-16: 4rem;     /* 64px */
    --erp-space-20: 5rem;     /* 80px */
    --erp-space-24: 6rem;     /* 96px */
    
    /* ===== Typography ===== */
    --erp-font-family: 'Vazirmatn', 'Vazir', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --erp-font-size-xs: 0.75rem;    /* 12px */
    --erp-font-size-sm: 0.875rem;   /* 14px */
    --erp-font-size-base: 1rem;     /* 16px */
    --erp-font-size-lg: 1.125rem;   /* 18px */
    --erp-font-size-xl: 1.25rem;    /* 20px */
    --erp-font-size-2xl: 1.5rem;    /* 24px */
    --erp-font-size-3xl: 1.875rem;  /* 30px */
    --erp-font-size-4xl: 2.25rem;   /* 36px */
    
    --erp-font-weight-normal: 400;
    --erp-font-weight-medium: 500;
    --erp-font-weight-semibold: 600;
    --erp-font-weight-bold: 700;
    --erp-font-weight-extrabold: 800;
    
    --erp-line-height-tight: 1.25;
    --erp-line-height-normal: 1.5;
    --erp-line-height-relaxed: 1.75;
    
    /* ===== Border Radius ===== */
    --erp-radius-sm: 0.5rem;   /* 8px */
    --erp-radius-md: 0.75rem;  /* 12px */
    --erp-radius-lg: 1rem;     /* 16px */
    --erp-radius-xl: 1.25rem;  /* 20px */
    --erp-radius-2xl: 1.5rem;  /* 24px */
    --erp-radius-full: 9999px;
    
    /* ===== Shadows ===== */
    --erp-shadow-sm: 0 1px 2px 0 var(--erp-shadow-color);
    --erp-shadow-md: 0 4px 6px -1px var(--erp-shadow-color), 0 2px 4px -1px var(--erp-shadow-color);
    --erp-shadow-lg: 0 10px 15px -3px var(--erp-shadow-color), 0 4px 6px -2px var(--erp-shadow-color);
    --erp-shadow-xl: 0 20px 25px -5px var(--erp-shadow-color), 0 10px 10px -5px var(--erp-shadow-color);
    --erp-shadow-2xl: 0 25px 50px -12px var(--erp-shadow-color);
    --erp-shadow-inner: inset 0 2px 4px 0 var(--erp-shadow-color);
    
    /* ===== Transitions ===== */
    --erp-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --erp-transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --erp-transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* ===== Z-Index Scale ===== */
    --erp-z-base: 0;
    --erp-z-dropdown: 1000;
    --erp-z-sticky: 1020;
    --erp-z-fixed: 1030;
    --erp-z-modal-backdrop: 1040;
    --erp-z-modal: 1050;
    --erp-z-popover: 1060;
    --erp-z-tooltip: 1070;
    --erp-z-toast: 1080;
    
    /* ===== Layout ===== */
    --erp-header-height: 64px;
    --erp-bottom-nav-height: 72px;
    --erp-content-max-width: 1400px;
    --erp-sidebar-width: 280px;
    
    /* ===== Touch Targets ===== */
    --erp-touch-target: 44px; /* Minimum touch target for mobile */
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
    --erp-bg-primary: var(--erp-dark-bg-primary);
    --erp-bg-secondary: var(--erp-dark-bg-secondary);
    --erp-bg-tertiary: var(--erp-dark-bg-tertiary);
    --erp-text-primary: var(--erp-dark-text-primary);
    --erp-text-secondary: var(--erp-dark-text-secondary);
    --erp-text-tertiary: var(--erp-dark-text-tertiary);
    --erp-border: var(--erp-dark-border);
    --erp-shadow-color: rgba(0, 0, 0, 0.3);
}

/* ===== Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--erp-font-family);
    font-size: var(--erp-font-size-base);
    line-height: var(--erp-line-height-normal);
    color: var(--erp-text-primary);
    background-color: var(--erp-bg-secondary);
    direction: rtl;
    min-height: 100vh;
    transition: background-color var(--erp-transition-base), color var(--erp-transition-base);
}

/* ===== Utility Classes ===== */
.erp-container {
    width: 100%;
    max-width: var(--erp-content-max-width);
    margin: 0 auto;
    padding: 0 var(--erp-space-4);
}

@media (min-width: 768px) {
    .erp-container {
        padding: 0 var(--erp-space-6);
    }
}

@media (min-width: 1024px) {
    .erp-container {
        padding: 0 var(--erp-space-8);
    }
}

/* ===== Safe Area Support for Mobile ===== */
@supports (padding: max(0px)) {
    /* Hide safe-area-top padding in fullscreen/immersive mode */
    .erp-safe-area-top {
        padding-top: var(--erp-space-4);
    }
    
    /* Only use safe-area-inset-top if not in fullscreen mode */
    @media not (display-mode: fullscreen) and not (display-mode: standalone) {
        .erp-safe-area-top {
            padding-top: max(var(--erp-space-4), env(safe-area-inset-top));
        }
    }
    
    .erp-safe-area-bottom {
        padding-bottom: max(var(--erp-space-4), env(safe-area-inset-bottom));
    }
    
    .erp-safe-area-left {
        padding-left: max(var(--erp-space-4), env(safe-area-inset-left));
    }
    
    .erp-safe-area-right {
        padding-right: max(var(--erp-space-4), env(safe-area-inset-right));
    }
}

/* ===== Focus States for Accessibility ===== */
*:focus-visible {
    outline: 2px solid var(--erp-primary-500);
    outline-offset: 2px;
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--erp-bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--erp-gray-400);
    border-radius: var(--erp-radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--erp-gray-500);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--erp-gray-600);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: var(--erp-gray-500);
}
