/* ===== TrueMark Design Tokens (M3 & Tailwind Harmonized) ===== */
/* Nguồn sự thật duy nhất cho toàn bộ hệ thống giao diện prototype TrueMark */
/* Chuẩn hóa theo bảng màu Material Design 3, Tailwind theme và màn hình Kết quả xác thực */

:root {
  /* ----- 1. Màu thương hiệu (Brand & Identity) ----- */
  /* Primary: Xanh rừng thẫm (#0F5132) uy quyền bảo chứng Viện Công nghệ Chống làm giả */
  --color-primary: #0F5132;
  --color-primary-dark: #003820;
  --color-primary-hover: #0A3A24;
  --color-primary-soft: #E8F5EE;
  --color-on-primary: #FFFFFF;

  /* Material 3 Primary Container & Fixed Variants */
  --color-primary-container: #0F5132;
  --color-on-primary-container: #84C39B;
  --color-primary-fixed: #B0F1C7;
  --color-primary-fixed-dim: #95D4AC;
  --color-on-primary-fixed: #002111;
  --color-on-primary-fixed-variant: #0F5132;

  /* Secondary: Xanh ngọc bích tươi (#15803D / #16A34A / #006E2D) xác thực hàng thật */
  --color-secondary: #15803D;
  --color-secondary-hover: #006E2D;
  --color-secondary-soft: #DCFCE7;
  --color-on-secondary: #FFFFFF;
  --color-secondary-container: #7CF994;
  --color-on-secondary-container: #007230;
  --color-secondary-fixed: #7FFC97;
  --color-secondary-fixed-dim: #62DF7D;
  --color-on-secondary-fixed: #002109;

  /* Tertiary: Xanh công nghệ / Blockchain (#0EA5E9 / #0284C7 / #00334D) */
  --color-tertiary: #0EA5E9;
  --color-tertiary-hover: #0284C7;
  --color-tertiary-soft: #E0F2FE;
  --color-on-tertiary: #FFFFFF;
  --color-tertiary-container: #004B6D;
  --color-on-tertiary-container: #51BEFF;
  --color-tertiary-fixed: #C9E6FF;
  --color-tertiary-fixed-dim: #89CEFF;

  /* ----- 2. Màu nền & Bề mặt (Surfaces - M3 & Slate Harmonized) ----- */
  --color-bg: #F1F5F9;                      /* Nền body chuẩn app: Slate-100 (rgb(241, 245, 249)) */
  --color-surface: #FFFFFF;                 /* Bề mặt thẻ chính (Card trắng) */
  --color-surface-2: #F8FAFC;               /* Bề mặt phụ: Slate-50 (input, subcard, thông số GTIN) */
  --color-surface-variant: #D3E4FE;
  --color-surface-container: #E5EEFF;
  --color-surface-container-low: #EFF4FF;
  --color-surface-container-high: #DCE9FF;
  --color-surface-container-highest: #D3E4FE;
  --color-surface-container-lowest: #FFFFFF;
  --color-surface-dim: #CBDBF5;
  --color-surface-bright: #F8F9FF;
  --color-surface-inverted: #0F172A;
  --color-on-inverted: #F8FAFC;

  /* ----- 3. Màu chữ (Typography Colors) ----- */
  --color-text: #0F172A;                    /* Chữ chính: Slate-900 (Tương phản 17.85:1 - AAA) */
  --color-text-muted: #64748B;              /* Chữ phụ / mô tả: Slate-500 (Tương phản 4.76:1 - AA) */
  --color-text-faint: #94A3B8;              /* Chú thích mờ / watermark: Slate-400 */
  --color-on-surface: #0B1C30;
  --color-on-surface-variant: #404942;

  /* ----- 4. Viền & Phân cách (Borders & Outlines) ----- */
  --color-border: #E2E8F0;                  /* Viền slate-200 */
  --color-border-subtle: #F1F5F9;           /* Viền slate-100 */
  --color-border-focus: #0F5132;
  --color-outline: #707971;
  --color-outline-variant: #C0C9C0;

  /* ----- 5. Màu trạng thái & Phản hồi (Status & Feedback) ----- */
  /* Thành công / Chính hãng */
  --color-success: #15803D;
  --color-success-dark: #064E3B;
  --color-success-sub: #047857;
  --color-success-soft: #DCFCE7;
  --color-on-success: #FFFFFF;

  /* Cảnh báo / Quét lặp / Khuyến mãi */
  --color-warning: #D97706;
  --color-warning-dark: #B45309;
  --color-warning-soft: #FEF3C7;
  --color-on-warning: #FFFFFF;

  /* Nguy hiểm / Báo giả / Lỗi */
  --color-danger: #DC2626;
  --color-danger-dark: #BA1A1A;
  --color-danger-soft: #FEE2E2;
  --color-danger-container: #FFDAD6;
  --color-on-danger: #FFFFFF;
  --color-on-danger-container: #93000A;

  /* ----- 6. Gradients đặc thù TrueMark (Từ chuẩn HTML) ----- */
  --gradient-header: linear-gradient(135deg, rgb(15, 81, 50) 0%, rgb(21, 128, 61) 100%);
  --gradient-banner-authentic: linear-gradient(180deg, rgb(236, 253, 245) 0%, rgb(255, 255, 255) 65%, rgb(240, 253, 244) 100%);
  --gradient-icon-authentic: linear-gradient(135deg, #10B981 0%, #059669 100%);
  --color-banner-border: rgba(167, 243, 208, 0.6);
  --color-banner-ring: rgba(209, 250, 229, 0.85);

  /* ----- 7. Typography (Phông chữ & Thang kích cỡ) ----- */
  --font-sans: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --text-badge: 11px;                       /* line-height: 14px, weight: 700 */
  --text-xs: 12px;                          /* line-height: 18px */
  --text-code: 13px;                        /* line-height: 16px, weight: 500 */
  --text-sm: 14px;                          /* line-height: 20px */
  --text-md: 16px;                          /* line-height: 24px */
  --text-lg: 18px;                          /* line-height: 24px, weight: 600 */
  --text-xl: 20px;                          /* line-height: 28px, weight: 700 */
  --text-2xl: 22px;                         /* line-height: 28px, weight: 800 */
  --text-3xl: 24px;                         /* line-height: 32px, weight: 700 */
  --text-display-mobile: 28px;              /* line-height: 36px, weight: 800 */
  --text-display: 36px;                     /* line-height: 44px, weight: 800 */

  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* ----- 8. Spacing & Gutters (Bậc chuẩn 4px & 8px) ----- */
  --space-1: 4px;                           /* space-xs: 0.25rem */
  --space-2: 8px;                           /* space-sm: 0.5rem */
  --space-3: 12px;                          /* space-md: 0.75rem */
  --space-4: 16px;                          /* space-lg / gutter: 1rem */
  --space-5: 20px;
  --space-6: 24px;                          /* space-xl / margin-lg: 1.5rem */
  --space-8: 32px;
  --space-10: 40px;
  --gutter: 16px;
  --gutter-sm: 12px;

  /* ----- 9. Bo góc (Border Radii) ----- */
  --radius-xs: 4px;                         /* DEFAULT: 0.25rem */
  --radius-sm: 8px;                         /* lg: 0.5rem */
  --radius-md: 12px;                        /* xl: 0.75rem */
  --radius-lg: 16px;                        /* 2xl: 1rem (Khối Card & Banner) */
  --radius-xl: 20px;
  --radius-full: 9999px;                    /* Nút bấm, badge pill */

  /* ----- 10. Đổ bóng (Elevations & Shadows) ----- */
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(15, 81, 50, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(15, 81, 50, 0.12), 0 4px 8px -2px rgba(15, 23, 42, 0.03);
  --shadow-header: rgba(15, 81, 50, 0.15) 0px 4px 12px, rgba(0, 0, 0, 0.06) 0px 2px 4px;
  --shadow-banner: rgba(16, 185, 129, 0.12) 0px 10px 25px -5px, rgba(16, 185, 129, 0.08) 0px 8px 10px -6px;

  /* ----- 11. Tương tác & Motion ----- */
  --tap-min: 48px;                          /* Nút bấm chuẩn chạm di động (h-12) */
  --tap-min-compact: 44px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 200ms;
}

/* ===== Chế độ tối (Dark Mode) ===== */
:root[data-theme="dark"] {
  --color-primary: #22C55E;
  --color-primary-dark: #16A34A;
  --color-primary-hover: #16A34A;
  --color-primary-soft: rgba(34, 197, 94, 0.15);
  --color-on-primary: #052E16;

  --color-primary-container: #14532D;
  --color-on-primary-container: #B0F1C7;
  --color-primary-fixed: #22C55E;
  --color-primary-fixed-dim: #16A34A;
  --color-on-primary-fixed: #052E16;

  --color-secondary: #34D399;
  --color-secondary-hover: #10B981;
  --color-secondary-soft: rgba(52, 211, 153, 0.15);
  --color-on-secondary: #022C22;
  --color-secondary-container: #064E3B;

  --color-tertiary: #38BDF8;
  --color-tertiary-hover: #0EA5E9;
  --color-tertiary-soft: rgba(56, 189, 248, 0.15);
  --color-on-tertiary: #082F49;
  --color-tertiary-container: #0C4A6E;

  --color-bg: #0B120E;
  --color-surface: #141E18;
  --color-surface-2: #1E2D24;
  --color-surface-variant: #1E2E25;
  --color-surface-container: #16241C;
  --color-surface-container-low: #101B15;
  --color-surface-container-high: #213328;
  --color-surface-container-highest: #283D30;
  --color-surface-container-lowest: #080E0B;
  --color-surface-dim: #0B120E;
  --color-surface-bright: #1E2D24;
  --color-surface-inverted: #F8FAFC;
  --color-on-inverted: #0F172A;

  --color-text: #F1F5F9;
  --color-text-muted: #94A3B8;
  --color-text-faint: #64748B;
  --color-on-surface: #EAF1FF;
  --color-on-surface-variant: #BFC9C0;

  --color-border: #23352A;
  --color-border-subtle: #1A2820;
  --color-border-focus: #22C55E;
  --color-outline: #89938B;
  --color-outline-variant: #404942;

  --color-success: #22C55E;
  --color-success-dark: #15803D;
  --color-success-sub: #4ADE80;
  --color-success-soft: rgba(34, 197, 94, 0.2);
  --color-on-success: #052E16;

  --color-warning: #FBBF24;
  --color-warning-dark: #D97706;
  --color-warning-soft: rgba(251, 191, 36, 0.2);
  --color-on-warning: #451A03;

  --color-danger: #F87171;
  --color-danger-dark: #DC2626;
  --color-danger-soft: rgba(248, 113, 113, 0.2);
  --color-danger-container: #450A0A;
  --color-on-danger: #450A0A;
  --color-on-danger-container: #FFDAD6;

  --gradient-header: linear-gradient(135deg, #0A3A24 0%, #14532D 100%);
  --gradient-banner-authentic: linear-gradient(180deg, rgba(20, 83, 45, 0.4) 0%, #141E18 65%, rgba(20, 83, 45, 0.25) 100%);
  --gradient-icon-authentic: linear-gradient(135deg, #22C55E 0%, #15803D 100%);
  --color-banner-border: rgba(34, 197, 94, 0.3);
  --color-banner-ring: rgba(34, 197, 94, 0.2);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.6);
  --shadow-header: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-banner: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary: #22C55E;
    --color-primary-dark: #16A34A;
    --color-primary-hover: #16A34A;
    --color-primary-soft: rgba(34, 197, 94, 0.15);
    --color-on-primary: #052E16;

    --color-primary-container: #14532D;
    --color-on-primary-container: #B0F1C7;
    --color-primary-fixed: #22C55E;
    --color-primary-fixed-dim: #16A34A;
    --color-on-primary-fixed: #052E16;

    --color-secondary: #34D399;
    --color-secondary-hover: #10B981;
    --color-secondary-soft: rgba(52, 211, 153, 0.15);
    --color-on-secondary: #022C22;
    --color-secondary-container: #064E3B;

    --color-tertiary: #38BDF8;
    --color-tertiary-hover: #0EA5E9;
    --color-tertiary-soft: rgba(56, 189, 248, 0.15);
    --color-on-tertiary: #082F49;
    --color-tertiary-container: #0C4A6E;

    --color-bg: #0B120E;
    --color-surface: #141E18;
    --color-surface-2: #1E2D24;
    --color-surface-variant: #1E2E25;
    --color-surface-container: #16241C;
    --color-surface-container-low: #101B15;
    --color-surface-container-high: #213328;
    --color-surface-container-highest: #283D30;
    --color-surface-container-lowest: #080E0B;
    --color-surface-dim: #0B120E;
    --color-surface-bright: #1E2D24;
    --color-surface-inverted: #F8FAFC;
    --color-on-inverted: #0F172A;

    --color-text: #F1F5F9;
    --color-text-muted: #94A3B8;
    --color-text-faint: #64748B;
    --color-on-surface: #EAF1FF;
    --color-on-surface-variant: #BFC9C0;

    --color-border: #23352A;
    --color-border-subtle: #1A2820;
    --color-border-focus: #22C55E;
    --color-outline: #89938B;
    --color-outline-variant: #404942;

    --color-success: #22C55E;
    --color-success-dark: #15803D;
    --color-success-sub: #4ADE80;
    --color-success-soft: rgba(34, 197, 94, 0.2);
    --color-on-success: #052E16;

    --color-warning: #FBBF24;
    --color-warning-dark: #D97706;
    --color-warning-soft: rgba(251, 191, 36, 0.2);
    --color-on-warning: #451A03;

    --color-danger: #F87171;
    --color-danger-dark: #DC2626;
    --color-danger-soft: rgba(248, 113, 113, 0.2);
    --color-danger-container: #450A0A;
    --color-on-danger: #450A0A;
    --color-on-danger-container: #FFDAD6;

    --gradient-header: linear-gradient(135deg, #0A3A24 0%, #14532D 100%);
    --gradient-banner-authentic: linear-gradient(180deg, rgba(20, 83, 45, 0.4) 0%, #141E18 65%, rgba(20, 83, 45, 0.25) 100%);
    --gradient-icon-authentic: linear-gradient(135deg, #22C55E 0%, #15803D 100%);
    --color-banner-border: rgba(34, 197, 94, 0.3);
    --color-banner-ring: rgba(34, 197, 94, 0.2);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.6);
    --shadow-header: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-banner: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  }
}
