/**
 * UltimatePOS Design System — tokens
 * Premium enterprise SaaS form language.
 * Primary defaults to #6D28D9; business theme_color (--theme-700) still overrides when set.
 */

:root {
    --primary: var(--theme-700, #6d28d9);
    --primary-hover: var(--theme-800, #5b21b6);
    --primary-active: var(--theme-900, #4c1d95);
    --secondary: #475569;

    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0284c7;

    --background: #f6f7fb;
    --surface: #ffffff;
    --surface-secondary: #f8fafc;
    --surface-elevated: #ffffff;

    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-on-primary: #ffffff;
    --label-color: #6b7280;
    --error-text: #ef4444;
    --error-ring: 0 0 0 4px color-mix(in srgb, #ef4444 18%, transparent);

    --border: #e5e7eb;
    --border-dark: #d1d5db;

    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 14px;
    --radius-xl: 16px;
    --radius-input: 8px;
    --radius-card: 14px;

    --input-height: 40px;
    --input-height-sm: 34px;
    --btn-height: 40px;
    --form-group-gap: 12px;
    --form-section-gap: 12px;
    --card-padding: 20px;
    --input-bg: #ffffff;
    --input-bg-hover: #fafbfc;

    --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.04);
    --shadow-md: 0 8px 24px rgba(17, 24, 39, 0.08);
    --shadow-card: 0 1px 2px rgba(17, 24, 39, 0.04);
    --shadow-input-focus: 0 0 0 3px color-mix(in srgb, var(--primary) 14%, transparent);

    --sidebar-width: 270px;
    --sidebar-collapsed-width: 76px;
    --header-height: 64px;

    --sidebar-glass-bg: rgba(255, 255, 255, 0.72);
    --sidebar-glass-bg-strong: rgba(255, 255, 255, 0.88);
    --sidebar-glass-blur: 24px;
    --sidebar-glass-border: rgba(15, 23, 42, 0.08);
    --sidebar-radius: 14px;
    --nav-item-min-height: 42px;
    --nav-transition: 220ms cubic-bezier(0.32, 0.72, 0, 1);
    --nav-active-tint: color-mix(in srgb, var(--primary) 14%, transparent);

    --focus-ring: var(--shadow-input-focus);
    --primary-gradient: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    --transition-fast: 150ms cubic-bezier(0.32, 0.72, 0, 1);
    --transition: 200ms cubic-bezier(0.32, 0.72, 0, 1);
    --motion-spring: cubic-bezier(0.32, 0.72, 0, 1);
    --scroll-smooth: smooth;
}

[data-theme="dark"] {
    --background: #0f172a;
    --surface: #111827;
    --surface-secondary: #1f2937;
    --surface-elevated: #1e293b;

    --text-primary: #f9fafb;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --label-color: #94a3b8;
    --error-text: #f87171;
    --error-ring: 0 0 0 4px color-mix(in srgb, #f87171 22%, transparent);

    --border: #334155;
    --border-dark: #475569;

    --input-bg: #1f2937;
    --input-bg-hover: #243044;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    --shadow-card: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-input-focus: 0 0 0 4px color-mix(in srgb, var(--primary) 32%, transparent);

    --sidebar-glass-bg: rgba(28, 28, 30, 0.78);
    --sidebar-glass-bg-strong: rgba(36, 36, 38, 0.9);
    --sidebar-glass-border: rgba(255, 255, 255, 0.08);
    --nav-active-tint: color-mix(in srgb, var(--primary) 22%, transparent);

    --focus-ring: var(--shadow-input-focus);
}

@media print {
    html,
    body,
    [data-theme="dark"] {
        --background: #ffffff !important;
        --surface: #ffffff !important;
        --text-primary: #000000 !important;
        --text-secondary: #333333 !important;
        --border: #cccccc !important;
    }

    .ds-theme-toggle,
    .no-print,
    .erp-form-sticky-footer {
        display: none !important;
    }
}

.ds-app-shell {
    background-color: var(--background);
    color: var(--text-primary);
}

.ds-app-shell main,
.ds-app-shell #scrollable-container {
    background-color: var(--background);
}

.ds-app-shell #scrollable-container {
    scroll-behavior: auto;
    overscroll-behavior-y: contain;
}

html.ds-app-shell {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html.ds-app-shell,
    .ds-app-shell #scrollable-container {
        scroll-behavior: auto;
    }
}

.ds-focusable:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}
