/* ============================================================
   dx-base.css — Design tokens, CSS reset, layout primitives
   All custom properties are in :root so components can consume them.
   All class names use the dx- prefix to avoid framework collisions.
   ============================================================ */

/* ── Design tokens ────────────────────────────────────────────────────── */
:root {
    /* Brand */
    --dx-color-primary:        #2563EB;
    --dx-color-primary-dark:   #1D4ED8;
    --dx-color-primary-light:  #DBEAFE;
    --dx-color-primary-xlight: #EFF6FF;

    /* Semantic */
    --dx-color-success:        #10B981;
    --dx-color-success-light:  #D1FAE5;
    --dx-color-warning:        #F59E0B;
    --dx-color-warning-light:  #FEF3C7;
    --dx-color-danger:         #EF4444;
    --dx-color-danger-light:   #FEE2E2;
    --dx-color-info:           #3B82F6;
    --dx-color-info-light:     #DBEAFE;

    /* Neutrals */
    --dx-color-text:           #111827;
    --dx-color-text-muted:     #6B7280;
    --dx-color-text-light:     #9CA3AF;
    --dx-bg:                   #FFFFFF;
    --dx-bg-muted:             #F9FAFB;
    --dx-bg-subtle:            #F3F4F6;
    --dx-border:               #E5E7EB;
    --dx-border-strong:        #D1D5DB;

    /* Typography */
    --dx-font:                 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                               'Helvetica Neue', Arial, sans-serif;
    --dx-font-mono:            'SF Mono', 'Fira Code', 'Courier New', monospace;

    --dx-size-xs:              0.75rem;    /* 12px */
    --dx-size-sm:              0.875rem;   /* 14px */
    --dx-size-base:            1rem;       /* 16px */
    --dx-size-lg:              1.125rem;   /* 18px */
    --dx-size-xl:              1.25rem;    /* 20px */
    --dx-size-2xl:             1.5rem;     /* 24px */
    --dx-size-3xl:             1.875rem;   /* 30px */

    /* Spacing (4-point grid) */
    --dx-space-1:              0.25rem;    /* 4px  */
    --dx-space-2:              0.5rem;     /* 8px  */
    --dx-space-3:              0.75rem;    /* 12px */
    --dx-space-4:              1rem;       /* 16px */
    --dx-space-5:              1.25rem;    /* 20px */
    --dx-space-6:              1.5rem;     /* 24px */
    --dx-space-8:              2rem;       /* 32px */
    --dx-space-10:             2.5rem;     /* 40px */
    --dx-space-12:             3rem;       /* 48px */
    --dx-space-16:             4rem;       /* 64px */

    /* Border radius */
    --dx-radius-sm:            0.25rem;
    --dx-radius:               0.5rem;
    --dx-radius-lg:            0.75rem;
    --dx-radius-xl:            1rem;
    --dx-radius-2xl:           1.5rem;
    --dx-radius-full:          9999px;

    /* Shadows */
    --dx-shadow-sm:            0 1px 2px 0 rgb(0 0 0 / 0.05);
    --dx-shadow:               0 1px 3px 0 rgb(0 0 0 / 0.10), 0 1px 2px -1px rgb(0 0 0 / 0.10);
    --dx-shadow-md:            0 4px 6px -1px rgb(0 0 0 / 0.10), 0 2px 4px -2px rgb(0 0 0 / 0.10);
    --dx-shadow-lg:            0 10px 15px -3px rgb(0 0 0 / 0.10), 0 4px 6px -4px rgb(0 0 0 / 0.10);

    /* Transitions */
    --dx-ease:                 150ms ease;
    --dx-ease-slow:            300ms ease;

    /* Z-index stack */
    --dx-z-nav:                50;
    --dx-z-modal:              200;
    --dx-z-toast:              300;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: var(--dx-font);
    font-size: var(--dx-size-base);
    line-height: 1.5;
    color: var(--dx-color-text);
    background-color: var(--dx-bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100%;
}

img, svg, video { display: block; max-width: 100%; }
a { color: var(--dx-color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font: inherit; border: none; background: none; }
input, select, textarea, button { font-family: inherit; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }
h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.25; }

/* ── Typography helpers ───────────────────────────────────────────────── */
.dx-text-xs    { font-size: var(--dx-size-xs); }
.dx-text-sm    { font-size: var(--dx-size-sm); }
.dx-text-lg    { font-size: var(--dx-size-lg); }
.dx-text-xl    { font-size: var(--dx-size-xl); }
.dx-text-muted { color: var(--dx-color-text-muted); }
.dx-text-light { color: var(--dx-color-text-light); }
.dx-font-semi  { font-weight: 600; }
.dx-font-bold  { font-weight: 700; }

/* ── Layout primitives ────────────────────────────────────────────────── */
.dx-container {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: var(--dx-space-4);
}

.dx-page-container {
    padding: var(--dx-space-4);
    max-width: 800px;
    margin-inline: auto;
}

.dx-page-header {
    margin-bottom: var(--dx-space-6);
}

.dx-page-title {
    font-size: var(--dx-size-2xl);
    font-weight: 700;
    color: var(--dx-color-text);
}

/* Flex helpers */
.dx-flex           { display: flex; }
.dx-flex-col       { flex-direction: column; }
.dx-items-center   { align-items: center; }
.dx-justify-between { justify-content: space-between; }
.dx-gap-2          { gap: var(--dx-space-2); }
.dx-gap-4          { gap: var(--dx-space-4); }

/* ── Visibility ───────────────────────────────────────────────────────── */
.dx-hidden { display: none !important; }

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