/* ============================================================
   LT controls — BASE (lt-base.css)
   The font, the design tokens (typography, radius, shadows, motion) and the few global rules the LT controls
   need. Colours live in lt-theme.css, loaded before this file. The host keeps its own body/layout rules.
   ============================================================ */

@font-face {
    font-family: "Space Grotesk";
    src: url("../fonts/SpaceGrotesk-VariableFont_wght.ttf") format("truetype-variations");
    font-weight: 300 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* ---------- TYPOGRAPHY ---------- */
    --font-sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "Space Grotesk", ui-monospace, Menlo, monospace;
    --font-code: ui-monospace, "Cascadia Code", Consolas, Menlo, monospace;   /* code (LTCodeViewer): a true monospace */

    --fw-light:    300;
    --fw-regular:  400;
    --fw-medium:   500;
    --fw-semibold: 600;
    --fw-bold:     700;

    /* Font sizes, in px, taken from the design (built on a 16px base). The hosts' root is 14px, so a rem size
       would come out 12.5% smaller than the design: use these tokens instead. */
    --fs-9-5:  9.5px;
    --fs-10:   10px;
    --fs-10-5: 10.5px;
    --fs-11:   11px;
    --fs-11-5: 11.5px;
    --fs-12:   12px;
    --fs-12-5: 12.5px;
    --fs-13:   13px;
    --fs-13-5: 13.5px;
    --fs-14:   14px;
    --fs-15:   15px;
    --fs-16:   16px;
    --fs-17:   17px;
    --fs-19:   19px;
    --fs-20:   20px;
    --fs-22:   22px;
    --fs-23:   23px;

    /* ---------- RADIUS ---------- */
    --radius-xs:   2px;
    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:   14px;
    --radius-xl:   22px;
    --radius-2xl:  32px;
    --radius-pill: 999px;

    /* ---------- SHADOWS ---------- */
    --shadow-xs: 0 1px 2px color-mix(in srgb, var(--brand-dark) 6%, transparent);
    --shadow-sm: 0 2px 6px color-mix(in srgb, var(--brand-dark) 6%, transparent), 0 1px 2px color-mix(in srgb, var(--brand-dark) 4%, transparent);
    --shadow-md: 0 8px 20px color-mix(in srgb, var(--brand-dark) 8%, transparent), 0 2px 4px color-mix(in srgb, var(--brand-dark) 4%, transparent);
    --shadow-lg: 0 20px 40px color-mix(in srgb, var(--brand-dark) 12%, transparent);

    /* ---------- MOTION ---------- */
    --ease-out:   cubic-bezier(0.22, 1, 0.36, 1);
    --dur-fast:   120ms;
    --dur-base:   200ms;
    --dur-slow:   360ms;
}

/* ============================================================
   ICONS — base SVG rules so inline icons (LTButton Icon, the apps' own) stay consistent.
   ============================================================ */
svg.ico {
    display: inline-block;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.5;
    vertical-align: middle;
}

/* ============================================================
   DIALOGS — a Radzen dialog opened with OpenLTDialogAsync ("lt-dialog") has no padding: its LTDialogHeader goes
   edge to edge and the dialog pads its own body.
   ============================================================ */
.lt-dialog .rz-dialog-content {
    padding: 0 !important;
}

/* ============================================================
   FIELDS — global rules shared by the LT fields
   ============================================================ */

/* LTSelect's own field look (border/padding/arrow/focus/disabled), duplicated here as plain global rules. Blazor's
   CSS isolation scopes LTSelect.razor.css to elements rendered by that component, so a plain native
   <div class="lt-select"><select class="lt-select__input"> written in a page (a combo with one or two static
   options that does not need LTSelect's search popup) would otherwise render unstyled. Keep it in sync with
   LTSelect.razor.css by hand; it is the escape hatch for a "simple" select, not a replacement for LTSelect. */
.lt-select {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.lt-select__input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--ubimia-white);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235C6B77' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-position: right 0.7rem center;
    background-repeat: no-repeat;
    background-size: 14px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ubimia-quantum-blue);
    font-size: var(--fs-15);
    padding: 0.7rem 2rem 0.7rem 0.75rem;
    width: 100%;
}

.lt-select__input:focus {
    border-color: var(--ubimia-quantum-blue);
    outline: none;
}

.lt-select__input:disabled {
    background-color: var(--ubimia-ink-050);
    color: var(--fg-muted);
    cursor: not-allowed;
}

/* Read-only: a native select disabled inside <div class="lt-select lt-select--readonly">, or inside a disabled
   <fieldset> (the read-only view of a form), reads as data, dark and semibold, as LTInput / LTSelect with ReadOnly. */
.lt-select--readonly .lt-select__input:disabled,
fieldset:disabled .lt-select__input:disabled {
    -webkit-text-fill-color: var(--ubimia-ink-900);
    color: var(--ubimia-ink-900);
    cursor: default;
    font-weight: var(--fw-semibold);
    opacity: 1;
}

/* Required-field validation state — applied by the page to any LT field's own input/select element, plus a short
   message underneath it, when a required field is left empty at submit time. */
.is-invalid {
    border-color: var(--danger) !important;
}

.lt-field-error {
    color: var(--danger);
    display: block;
    font-size: var(--fs-12);
    margin-top: 0.25rem;
}
