/* ════════════════════════════════════════════════════════════════
   ERP WC Bridge — Master Design System Tokens
   Style: Premium Soft SaaS ERP (WCAG AAA)
   Direction: calm, spacious, soft surfaces, subtle layered shadows,
   refined Persian RTL-first typography, controlled semantic accents.
   These tokens are the single source of truth for all visual decisions.
   ════════════════════════════════════════════════════════════════ */

/* ── Self-hosted Vazirmatn font (no CDN) ─────────────────────── */
@font-face {
	font-family: 'Vazirmatn';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
}

@font-face {
	font-family: 'Vazirmatn';
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url('../fonts/Vazirmatn-Medium.woff2') format('woff2');
}

@font-face {
	font-family: 'Vazirmatn';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url('../fonts/Vazirmatn-SemiBold.woff2') format('woff2');
}

@font-face {
	font-family: 'Vazirmatn';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
}

/* ── Design Tokens ───────────────────────────────────────────── */
:root {
	/* ═══ COLOR — Brand (raw palette) ═══ */
	--erp-color-primary: #0F172A;
	--erp-color-primary-hover: #1E293B;
	--erp-color-accent: #0369A1;
	--erp-color-accent-hover: #075985;
	--erp-color-accent-light: #E0F2FE;

	/* ═══ COLOR — Semantic accents (restrained, purpose-driven) ═══ */
	--erp-color-secondary: #7C3AED;
	--erp-color-secondary-bg: #F5F3FF;
	--erp-color-secondary-border: #DDD6FE;
	--erp-color-violet: #7C3AED;
	--erp-color-violet-bg: #F5F3FF;
	--erp-color-cyan: #0891B2;
	--erp-color-cyan-bg: #ECFEFF;
	--erp-color-emerald: #059669;
	--erp-color-emerald-bg: #ECFDF5;
	--erp-color-amber: #D97706;
	--erp-color-amber-bg: #FFFBEB;
	--erp-color-coral: #E11D48;
	--erp-color-coral-bg: #FFF1F2;

	/* ═══ COLOR — Surfaces (soft premium hierarchy) ═══ */
	--erp-color-bg: #F8FAFC;
	--erp-color-surface: #FFFFFF;
	--erp-color-surface-alt: #F1F5F9;
	--erp-color-surface-hover: #F8FAFC;
	--erp-color-surface-raised: #FFFFFF;
	--erp-color-surface-elevated: #FFFFFF;
	--erp-color-surface-selected: #E0F2FE;
	--erp-color-surface-input: #F8FAFC;

	/* ═══ COLOR — Borders (thin, soft) ═══ */
	--erp-color-border: #E2E8F0;
	--erp-color-border-subtle: #F1F5F9;
	--erp-color-border-strong: #CBD5E1;
	--erp-color-border-inverse: rgba(255, 255, 255, 0.08);

	/* ═══ COLOR — Focus ═══ */
	--erp-color-focus: #0369A1;
	--erp-color-focus-ring: rgba(3, 105, 161, 0.12);
	--erp-focus-ring-width: 3px;

	/* ═══ COLOR — Overlays & soft fills ═══ */
	--erp-color-overlay: rgba(15, 23, 42, 0.5);
	--erp-color-overlay-light: rgba(15, 23, 42, 0.4);
	--erp-color-error-ring: rgba(220, 38, 38, 0.15);
	--erp-color-success-soft: rgba(22, 163, 74, 0.12);
	--erp-color-error-soft: rgba(220, 38, 38, 0.12);
	--erp-color-warning-soft: rgba(217, 119, 6, 0.12);
	--erp-color-nav-hover: rgba(3, 105, 161, 0.15);
	--erp-color-nav-active: rgba(3, 105, 161, 0.20);

	/* ═══ COLOR — Text ═══ */
	--erp-color-text: #0F172A;
	--erp-color-text-primary: #0F172A;
	--erp-color-text-secondary: #475569;
	--erp-color-text-muted: #64748B;
	--erp-color-text-inverse: #FFFFFF;
	--erp-color-text-inverse-secondary: #94A3B8;
	--erp-color-text-inverse-tertiary: #CBD5E1;

	/* Fixed dark surfaces (brand panels, hero overlays) — these never
	   flip in dark mode because the surface itself stays dark. (C39) */
	--erp-color-on-dark: #FFFFFF;
	--erp-color-on-dark-muted: rgba(255, 255, 255, 0.7);
	--erp-color-on-dark-faint: rgba(255, 255, 255, 0.5);

	/* ═══ COLOR — Status (semantic) ═══ */
	--erp-color-pink-bg: #FFF1F2;
	--erp-color-success: #16A34A;
	--erp-color-success-hover: #15803D;
	--erp-color-success-bg: #F0FDF4;
	--erp-color-success-border: #BBF7D0;
	--erp-color-warning: #D97706;
	--erp-color-warning-bg: #FFFBEB;
	--erp-color-warning-border: #FDE68A;
	--erp-color-error: #DC2626;
	--erp-color-error-hover: #B91C1C;
	--erp-color-error-bg: #FEF2F2;
	--erp-color-error-border: #FECACA;
	--erp-color-danger: #DC2626;
	--erp-color-danger-hover: #B91C1C;
	--erp-color-danger-bg: #FEF2F2;
	--erp-color-danger-border: #FECACA;
	--erp-color-info: #2563EB;
	--erp-color-info-bg: #EFF6FF;
	--erp-color-info-border: #BFDBFE;

	/* Contrast-safe status text (≥4.5:1 on their tinted *-bg surfaces).
	   Use for badge/alert/small text; keep base colors for icons/borders. */
	--erp-color-success-text: #15803D;
	--erp-color-warning-text: #B45309;
	--erp-color-error-text: #B91C1C;
	--erp-color-info-text: #1D4ED8;

	/* TYPOGRAPHY — Raw scale */
	--erp-font-family: 'Vazirmatn', 'IRANSans', 'Tahoma', -apple-system, BlinkMacSystemFont, 'Segoe UI', 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-line-height-tight: 1.25;
	--erp-line-height-normal: 1.5;
	--erp-line-height-relaxed: 1.75;
	--erp-line-height-loose: 2;

	/* TYPOGRAPHY — Semantic hierarchy (Persian RTL-first) */
	--erp-text-display-size: 2.25rem;      /* 36px — dashboard hero */
	--erp-text-display-weight: 700;
	--erp-text-display-line: 1.3;
	--erp-text-display-tracking: -0.02em;

	--erp-text-h1-size: 1.875rem;          /* 30px — page title */
	--erp-text-h1-weight: 700;
	--erp-text-h1-line: 1.35;
	--erp-text-h1-tracking: -0.01em;

	--erp-text-h2-size: 1.5rem;            /* 24px — section title */
	--erp-text-h2-weight: 600;
	--erp-text-h2-line: 1.4;
	--erp-text-h2-tracking: -0.01em;

	--erp-text-h3-size: 1.25rem;           /* 20px — card title */
	--erp-text-h3-weight: 600;
	--erp-text-h3-line: 1.45;
	--erp-text-h3-tracking: 0;

	--erp-text-body-size: 0.9375rem;       /* 15px — body text */
	--erp-text-body-weight: 400;
	--erp-text-body-line: 1.6;

	--erp-text-small-size: 0.8125rem;      /* 13px — secondary text */
	--erp-text-small-weight: 400;
	--erp-text-small-line: 1.55;

	--erp-text-caption-size: 0.75rem;      /* 12px — captions, meta */
	--erp-text-caption-weight: 400;
	--erp-text-caption-line: 1.5;

	--erp-text-label-size: 0.8125rem;      /* 13px — form labels */
	--erp-text-label-weight: 500;
	--erp-text-label-line: 1.4;

	--erp-text-kpi-size: 1.75rem;          /* 28px — KPI numbers */
	--erp-text-kpi-weight: 700;
	--erp-text-kpi-line: 1.2;
	--erp-text-kpi-tracking: -0.02em;

	/* SPACING — 4px base unit (refined for breathing room) */
	--erp-space-1: 0.25rem;   /* 4px  — tight inline */
	--erp-space-2: 0.5rem;    /* 8px  — compact gaps */
	--erp-space-3: 0.75rem;   /* 12px — small padding */
	--erp-space-4: 1rem;      /* 16px — base padding */
	--erp-space-5: 1.25rem;   /* 20px — comfortable padding */
	--erp-space-6: 1.5rem;    /* 24px — card padding */
	--erp-space-7: 1.75rem;   /* 28px — section gaps */
	--erp-space-8: 2rem;      /* 32px — large gaps */
	--erp-space-10: 2.5rem;   /* 40px — page sections */
	--erp-space-12: 3rem;     /* 48px — major sections */
	--erp-space-16: 4rem;     /* 64px — page-level spacing */

	/* SPACING — Semantic aliases */
	--erp-space-card-pad: var(--erp-space-6);       /* 24px — card interior */
	--erp-space-card-gap: var(--erp-space-4);       /* 16px — between cards */
	--erp-space-section-gap: var(--erp-space-8);    /* 32px — between sections */
	--erp-space-page-pad: var(--erp-space-6);       /* 24px — page padding */
	--erp-space-form-gap: var(--erp-space-4);       /* 16px — form field gaps */
	--erp-space-tight: var(--erp-space-2);          /* 8px  — tight clusters */

	/* RADIUS — Refined scale (soft premium) */
	--erp-radius-xs: 6px;       /* tags, chips, small controls */
	--erp-radius-sm: 8px;       /* small buttons, badges */
	--erp-radius-md: 10px;      /* buttons, inputs, selects */
	--erp-radius-lg: 14px;      /* cards, panels */
	--erp-radius-xl: 18px;      /* large cards, modals */
	--erp-radius-2xl: 24px;     /* large containers, hero sections */
	--erp-radius-full: 9999px;  /* pills, avatars, toggles */

	/* RADIUS — Semantic aliases */
	--erp-radius-control: var(--erp-radius-md);    /* 10px — buttons, inputs */
	--erp-radius-card: var(--erp-radius-lg);       /* 14px — cards */
	--erp-radius-modal: var(--erp-radius-xl);      /* 18px — modals */

	/* SHADOW — DS2.0 restrained Soft UI: diffuse ambient layers, no hard
	   neumorphic dual-light trickery (invisible on white-over-slate anyway). */
	--erp-shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
	--erp-shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05), 0 4px 12px -4px rgba(15, 23, 42, 0.07);
	--erp-shadow-md: 0 2px 6px -2px rgba(15, 23, 42, 0.07), 0 12px 28px -10px rgba(15, 23, 42, 0.10);
	--erp-shadow-lg: 0 4px 12px -4px rgba(15, 23, 42, 0.09), 0 20px 44px -14px rgba(15, 23, 42, 0.12);
	--erp-shadow-xl: 0 8px 24px -8px rgba(15, 23, 42, 0.11), 0 32px 64px -18px rgba(15, 23, 42, 0.15);
	--erp-shadow-2xl: 0 16px 40px -12px rgba(15, 23, 42, 0.15), 0 40px 96px -24px rgba(15, 23, 42, 0.19);

	/* SHADOW — Semantic aliases */
	--erp-shadow-card: var(--erp-shadow-sm);
	--erp-shadow-card-hover: var(--erp-shadow-md);
	--erp-shadow-dropdown: var(--erp-shadow-lg);
	--erp-shadow-modal: var(--erp-shadow-xl);
	--erp-shadow-toast: var(--erp-shadow-lg);
	--erp-shadow-nav-up: 0 -2px 12px -4px rgba(15, 23, 42, 0.08);

	/* SHADOW — Soft-UI control affordances (DS2.0)
	   inset  = subtle recess for editable fields (identifiable, not mushy)
	   btn    = resting lift for bordered/secondary buttons
	   btn-accent = accent-tinted lift, reserves dominance for primary CTAs */
	--erp-shadow-inset: inset 0 1px 2px rgba(15, 23, 42, 0.05);
	--erp-shadow-btn: 0 1px 2px 0 rgba(15, 23, 42, 0.07);
	--erp-shadow-btn-accent: 0 1px 2px 0 rgba(15, 23, 42, 0.06), 0 3px 10px -3px rgba(3, 105, 161, 0.35);

	/* BORDER */
	--erp-border-width: 1px;
	--erp-border-style: solid;

	/* Z-INDEX */
	--erp-z-sticky: 10;
	--erp-z-sidebar: 100;
	--erp-z-topbar: 90;
	--erp-z-dropdown: 200;
	--erp-z-overlay: 250;
	/* Modals/overlays must dim the entire viewport including the WP admin
	   bar (z-index 99999) — otherwise chrome renders bright over the dimmer. */
	--erp-z-modal: 100000;
	--erp-z-toast: 100010;
	--erp-z-bottombar: 500;
	--erp-z-mobile-drawer: 600;

	/* MOTION — Subtle, calm transitions */
	--erp-ease-out: cubic-bezier(0.33, 1, 0.68, 1);    /* ease-out-quart */
	--erp-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1); /* ease-in-out-quart */
	--erp-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1); /* subtle overshoot */
	--erp-transition-fast: 150ms var(--erp-ease-out);
	--erp-transition-normal: 220ms var(--erp-ease-out);
	--erp-transition-slow: 320ms var(--erp-ease-out);
	--erp-transition-spring: 400ms var(--erp-ease-spring);

	/* BREAKPOINTS (for reference in media queries) */
	--erp-bp-mobile: 640px;
	--erp-bp-tablet: 768px;
	--erp-bp-desktop: 1024px;
	--erp-bp-wide: 1280px;

	/* LAYOUT */
	--erp-sidebar-width: 240px;
	--erp-sidebar-collapsed-width: 64px;
	--erp-content-max-width: 1200px;
	--erp-topbar-height: 56px;

	/* LAYOUT — Customer mobile navigation (C10) */
	--erp-nav-height: 64px;
	--erp-safe-bottom: env(safe-area-inset-bottom, 0px);
	--erp-touch-target: 44px;

	/* SIDEBAR — refined dark surface (softer than primary) */
	--erp-color-sidebar: #1E293B;
	--erp-color-sidebar-hover: #334155;
	--erp-color-sidebar-active: rgba(56, 189, 248, 0.12);
	--erp-color-sidebar-border: rgba(255, 255, 255, 0.06);
	--erp-color-sidebar-text: #CBD5E1;
	--erp-color-sidebar-text-muted: #64748B;
	--erp-color-sidebar-text-active: #F1F5F9;
	--erp-color-sidebar-badge: #EF4444;

	/* TOPBAR */
	--erp-color-topbar-bg: transparent;
	--erp-color-topbar-border: var(--erp-color-border);
}

/* ── Reduced Motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
	:root {
		--erp-transition-fast: 0ms;
		--erp-transition-normal: 0ms;
		--erp-transition-slow: 0ms;
		--erp-transition-spring: 0ms;
	}
}

/* ════════════════════════════════════════════════════════════════
   DARK MODE — Foundation token overrides
   Activated via [data-theme="dark"] on <html> or <body>
   ════════════════════════════════════════════════════════════════ */
[data-theme="dark"] {
	/* Brand */
	--erp-color-primary: #F1F5F9;
	--erp-color-primary-hover: #E2E8F0;
	--erp-color-accent: #38BDF8;
	--erp-color-accent-hover: #7DD3FC;
	--erp-color-accent-light: rgba(56, 189, 248, 0.12);

	/* Semantic accents */
	--erp-color-secondary: #A78BFA;
	--erp-color-secondary-bg: rgba(124, 58, 237, 0.12);
	--erp-color-secondary-border: rgba(167, 139, 250, 0.25);
	--erp-color-violet: #A78BFA;
	--erp-color-violet-bg: rgba(124, 58, 237, 0.12);
	--erp-color-cyan: #22D3EE;
	--erp-color-cyan-bg: rgba(8, 145, 178, 0.12);
	--erp-color-emerald: #34D399;
	--erp-color-emerald-bg: rgba(5, 150, 105, 0.12);
	--erp-color-amber: #FBBF24;
	--erp-color-amber-bg: rgba(217, 119, 6, 0.12);
	--erp-color-coral: #FB7185;
	--erp-color-coral-bg: rgba(225, 29, 72, 0.12);

	/* Surfaces */
	--erp-color-bg: #0B1120;
	--erp-color-surface: #111827;
	--erp-color-surface-alt: #1E293B;
	--erp-color-surface-hover: #1E293B;
	--erp-color-surface-raised: #1E293B;
	--erp-color-surface-elevated: #1E293B;
	--erp-color-surface-selected: rgba(56, 189, 248, 0.12);
	--erp-color-surface-input: #1E293B;

	/* Borders */
	--erp-color-border: #1E293B;
	--erp-color-border-subtle: #172033;
	--erp-color-border-strong: #334155;
	--erp-color-border-inverse: rgba(255, 255, 255, 0.08);

	/* Focus */
	--erp-color-focus: #38BDF8;
	--erp-color-focus-ring: rgba(56, 189, 248, 0.18);

	/* Overlays & soft fills */
	--erp-color-overlay: rgba(0, 0, 0, 0.60);
	--erp-color-overlay-light: rgba(0, 0, 0, 0.50);
	--erp-color-error-ring: rgba(248, 113, 113, 0.18);
	--erp-color-success-soft: rgba(52, 211, 153, 0.15);
	--erp-color-error-soft: rgba(248, 113, 113, 0.15);
	--erp-color-warning-soft: rgba(251, 191, 36, 0.15);
	--erp-color-nav-hover: rgba(56, 189, 248, 0.15);
	--erp-color-nav-active: rgba(56, 189, 248, 0.20);

	/* Text */
	--erp-color-text: #F1F5F9;
	--erp-color-text-primary: #F1F5F9;
	--erp-color-text-secondary: #94A3B8;
	--erp-color-text-muted: #94A3B8;
	--erp-color-text-inverse: #0F172A;
	--erp-color-text-inverse-secondary: #475569;
	--erp-color-text-inverse-tertiary: #94A3B8;

	/* Status */
	--erp-color-success: #34D399;
	--erp-color-success-hover: #6EE7B7;
	--erp-color-success-bg: rgba(16, 163, 74, 0.12);
	--erp-color-success-border: rgba(52, 211, 153, 0.25);
	--erp-color-warning: #FBBF24;
	--erp-color-warning-bg: rgba(217, 119, 6, 0.12);
	--erp-color-warning-border: rgba(251, 191, 36, 0.25);
	--erp-color-error: #F87171;
	--erp-color-error-hover: #FCA5A5;
	--erp-color-error-bg: rgba(220, 38, 38, 0.12);
	--erp-color-error-border: rgba(248, 113, 113, 0.25);
	--erp-color-danger: #F87171;
	--erp-color-danger-hover: #FCA5A5;
	--erp-color-success-text: #6EE7B7;
	--erp-color-warning-text: #FDE68A;
	--erp-color-error-text: #FCA5A5;
	--erp-color-info-text: #93C5FD;
	--erp-color-danger-bg: rgba(220, 38, 38, 0.12);
	--erp-color-danger-border: rgba(248, 113, 113, 0.25);
	--erp-color-info: #60A5FA;
	--erp-color-info-bg: rgba(37, 99, 235, 0.12);
	--erp-color-info-border: rgba(96, 165, 250, 0.25);
	--erp-color-pink-bg: rgba(225, 29, 72, 0.12);

	/* Shadows — deeper for dark surfaces */
	--erp-shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.20);
	--erp-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.24), 0 1px 2px -1px rgba(0, 0, 0, 0.16);
	--erp-shadow-md: 0 2px 8px -2px rgba(0, 0, 0, 0.28), 0 1px 3px -1px rgba(0, 0, 0, 0.16);
	--erp-shadow-lg: 0 4px 16px -4px rgba(0, 0, 0, 0.32), 0 2px 6px -2px rgba(0, 0, 0, 0.20);
	--erp-shadow-xl: 0 8px 32px -8px rgba(0, 0, 0, 0.36), 0 4px 12px -4px rgba(0, 0, 0, 0.24);
	--erp-shadow-2xl: 0 16px 48px -12px rgba(0, 0, 0, 0.40), 0 8px 24px -8px rgba(0, 0, 0, 0.28);
	--erp-shadow-nav-up: 0 -2px 12px -4px rgba(0, 0, 0, 0.40);

	/* Soft-UI control affordances — dark variants */
	--erp-shadow-inset: inset 0 1px 2px rgba(0, 0, 0, 0.35);
	--erp-shadow-btn: 0 1px 2px 0 rgba(0, 0, 0, 0.30);
	--erp-shadow-btn-accent: 0 1px 2px 0 rgba(0, 0, 0, 0.25), 0 3px 10px -3px rgba(56, 189, 248, 0.30);

	/* Sidebar */
	--erp-color-sidebar: #0B1120;
	--erp-color-sidebar-hover: #1E293B;
	--erp-color-sidebar-active: rgba(56, 189, 248, 0.15);
	--erp-color-sidebar-border: rgba(255, 255, 255, 0.04);
	--erp-color-sidebar-text: #94A3B8;
	--erp-color-sidebar-text-muted: #475569;
	--erp-color-sidebar-text-active: #F1F5F9;
}
