/* ==========================================================================
   Onix DateInput (Components/Shared/DateInput.razor, IDE-032) — a date typed
   in the person's date format, the calendar button at the field's end and the
   calendar itself, a popover js/onix-dateinput.js places under the field.
   Colours, radii and shadows are the tokens of onix-theme.css (light and dark).
   ========================================================================== */

.dateinput { position: relative; display: flex; flex-wrap: wrap; align-items: center; min-width: 0; width: 100%; }
.dateinput > .dateinput-text { flex: 1 1 auto; min-width: 0; width: 100%; padding-right: 32px; font-variant-numeric: tabular-nums; }
.dateinput.is-invalid > .dateinput-text { border-color: var(--danger); color: var(--danger-strong); }

.dateinput-pick {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px; padding: 0;
    border: 0; border-radius: 6px; background: none;
    color: var(--muted); cursor: pointer; font: inherit; line-height: 1;
}
/* The field wraps its note: the button stays on the input's row. */
.dateinput:has(> .dateinput-note) > .dateinput-pick { top: 16px; }
.dateinput-pick:hover { background: var(--panel-hover); color: var(--brand-strong); }
.dateinput-pick:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.dateinput-pick:disabled { display: none; }
fieldset:disabled .dateinput-pick { display: none; }

.dateinput-note { flex: 1 0 100%; margin-top: 2px; color: var(--danger-strong); font-size: 0.72rem; line-height: 1.25; }

/* In a toolbar, an inline label or a filter bar the field is as wide as a date — the browser's own date input was —
   not the row's (every date field is a DateInput since 2026-11-07). */
.toolbar .dateinput, label.inline .dateinput, .inline > .dateinput { flex: 0 0 auto; width: 10.5em; }

/* DateTimeInput: the day (a DateInput) and its time side by side. */
.datetime-input { display: flex; align-items: flex-start; gap: 6px; min-width: 0; width: 100%; }
.datetime-input > .dateinput { flex: 1 1 auto; width: auto; }
.datetime-input > .datetime-input__time { flex: 0 0 auto; width: 7.5em; font-variant-numeric: tabular-nums; }
.toolbar .datetime-input, label.inline .datetime-input { width: auto; }
.toolbar .datetime-input > .dateinput, label.inline .datetime-input > .dateinput { width: 10.5em; }

/* ─── The calendar ─────────────────────────────────────────────────────── */

.dateinput-panel {
    position: absolute; inset: auto; left: 0; top: calc(100% + 4px); z-index: 130;
    box-sizing: border-box; width: 264px; margin: 0; padding: 8px;
    background: var(--glass-pop, var(--panel)); color: var(--ink);
    border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-md);
    font-size: 0.84rem; font-weight: 400; text-align: center; text-transform: none; letter-spacing: normal;
}
.dateinput-panel:popover-open { display: block; animation: pop-in 0.12s var(--ease); }

.dateinput-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.dateinput-month { flex: 1 1 auto; font-weight: 650; font-family: var(--font-display, inherit); }
.dateinput-nav {
    width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: none;
    color: var(--ink-soft); font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer;
}
.dateinput-nav:hover { background: var(--panel-hover); color: var(--brand-strong); }

.dateinput-grid { display: grid; width: 100%; }
.dateinput-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dateinput-weekday { padding: 3px 0; color: var(--muted); font-size: 0.7rem; font-weight: 600; text-transform: lowercase; }
.dateinput-cell { padding: 1px; }
.dateinput-day {
    width: 100%; height: 30px; padding: 0; border: 0; border-radius: 8px; background: none;
    color: var(--ink); font: inherit; font-variant-numeric: tabular-nums; cursor: pointer;
}
.dateinput-day:hover { background: var(--panel-hover); color: var(--brand-strong); }
.dateinput-day:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--ring); }
.dateinput-day.is-other { color: var(--muted-2); }
.dateinput-day.is-today { box-shadow: inset 0 0 0 1px var(--brand); font-weight: 650; }
.dateinput-day.is-selected, .dateinput-day.is-selected:hover { background: var(--solid, var(--brand)); color: var(--solid-ink); font-weight: 650; }

.dateinput-foot { display: flex; justify-content: space-between; gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.dateinput-day:disabled, .dateinput-day.is-out { color: var(--muted-2); opacity: 0.45; cursor: not-allowed; background: none; }
.dateinput-foot .button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── ATP-034: a date with its time (WithTime) ─────────────────────────── */

.dateinput-moment { display: flex; align-items: flex-start; gap: 6px; min-width: 0; width: 100%; }
/* Inside a form's <label> the caption rule (.form label span, .form-card label span — app.css: a block in small bold
   type) would undo the field's own layout and type: taken back here, as onix-assist.css does for its menu. */
label span.dateinput, .form label span.dateinput, .form-card label span.dateinput,
label span.dateinput-moment, .form label span.dateinput-moment, .form-card label span.dateinput-moment {
    display: flex; margin: 0; font-size: inherit; font-weight: inherit; color: inherit; text-transform: none; letter-spacing: normal;
}
.dateinput-moment > .dateinput { flex: 1 1 auto; }
.dateinput-moment > .dateinput-time { flex: 0 0 auto; width: 7.5em; min-width: 0; font-variant-numeric: tabular-nums; }

/* ─── ATP-034: the compact field of a grid's filter row ────────────────── */

.dateinput.compact { flex-wrap: nowrap; width: auto; flex: 1 1 auto; min-width: 0; }
.dateinput.compact > .dateinput-text { padding-right: 22px; }
.dateinput.compact > .dateinput-pick { right: 2px; width: 20px; height: 20px; border-radius: 5px; }
.dateinput.compact > .dateinput-pick svg { width: 13px; height: 13px; }
.dateinput.compact:has(> .dateinput-note) > .dateinput-pick { top: 50%; }
/* The refusal floats under the cell instead of making the filter row taller. */
.dateinput.compact > .dateinput-note {
    position: absolute; left: 0; top: calc(100% + 3px); z-index: 20;
    width: max-content; max-width: 240px; margin: 0; padding: 4px 8px;
    background: var(--glass-pop, var(--panel)); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow-md);
    font-weight: 400; text-transform: none; letter-spacing: normal; text-align: left; white-space: normal;
}
