/* ==========================================================================
   Unified theme
   Single source of truth for typography and color across the whole app
   (admin panel, auth pages, public site, error pages, DST viewer).
   Loaded via includes/theme_head.php — do not hardcode fonts/brand colors
   in pages; use these variables instead.
   ========================================================================== */

:root {
    /* ── Typography ─────────────────────────────────────────────────────── */
    /* IBM Plex Sans Arabic covers Arabic, Latin and Turkish (latin-ext). */
    --font-sans: "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
    --font-mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;

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

    --weight-regular:  400;
    --weight-medium:   500;
    --weight-semibold: 600;
    --weight-bold:     700;

    --leading-tight:  1.3;
    --leading-normal: 1.6;

    /* ── Brand ──────────────────────────────────────────────────────────── */
    --color-primary:        #0f62fe;
    --color-primary-hover:  #0043ce;
    --color-primary-active: #002d9c;
    --color-primary-soft:   rgba(15, 98, 254, 0.10);
    --color-primary-ring:   rgba(15, 98, 254, 0.25);
    --color-on-primary:     #ffffff;

    /* ── Neutrals ───────────────────────────────────────────────────────── */
    --color-bg:       #f4f6f9;
    --color-surface:  #ffffff;
    --color-text:     #161616;
    --color-muted:    #5f6b7a;
    --color-border:   #e0e4ea;

    /* ── Status ─────────────────────────────────────────────────────────── */
    --color-success: #198038;
    --color-warning: #f1c21b;
    --color-danger:  #da1e28;
    --color-info:    #0072c3;

    /* ── Shape ──────────────────────────────────────────────────────────── */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    /* ── Legacy aliases (old variable names used across existing pages) ─── */
    --fb-blue:       var(--color-primary);
    --fb-dark-blue:  var(--color-primary-hover);
    --primary-color: var(--color-primary);
    --primary-hover: var(--color-primary-hover);
    --accent:        var(--color-primary);
    --accent-soft:   var(--color-primary-soft);
}

/* ── Base ─────────────────────────────────────────────────────────────── */
html {
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Form controls don't inherit the font by default */
button,
input,
select,
textarea,
optgroup {
    font-family: inherit;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
    line-height: var(--leading-tight);
}

code, kbd, pre, samp {
    font-family: var(--font-mono);
}

/* Arabic: no letter-spacing tweaks (they break letter joining).
   Line height stays at --leading-normal: IBM Plex Sans Arabic already has
   tall vertical metrics, so extra leading makes rows and buttons bulky. */
[dir="rtl"] *,
html[lang="ar"] * {
    letter-spacing: normal !important;
}

::selection {
    background: var(--color-primary-soft);
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}
