/*
 * Jump.Ui.Components.DevExpress — the field components drawn by a DevExpress control.
 *
 * Loads after jump-ui.css and reuses its --jump-ui-field-* tokens, so a date field measures and
 * colours the same as the text field beside it. DevExpress reads several surfaces from its own
 * variables and from selectors three or four classes deep; the doubled classes below are there to
 * win over those, not by accident.
 */

:root {
    --jump-ui-icon-ink: var(--jump-ui-label-ink, #557097);
    --jump-ui-icon-active-ink: var(--jump-ui-field-focus-border, #62a8ff);
    --jump-ui-popup-border: #dbe7f6;
    --jump-ui-popup-radius: 8px;
    --jump-ui-popup-shadow: 0 12px 30px rgba(16, 42, 84, .10);
    --jump-ui-popup-header-background: #fbfdff;
    --jump-ui-popup-title: #003d8f;
    --jump-ui-popup-accent: #0057b8;
    --jump-ui-popup-accent-hover: #004a9e;
    --jump-ui-popup-control-border: #cfdded;
    --jump-ui-popup-muted: #7890ad;
    --jump-ui-popup-faint: #9fb1c9;
    --jump-ui-popup-hover: #eef5ff;
    --jump-ui-calendar-selected: #004987;
    --jump-ui-calendar-day-size: 30px;
}

/* The field: same box as .jump-ui-control, for the date, the select and the multiple select alike. */
.jump-ui-date.dxbl-text-edit,
.jump-ui-combo.dxbl-text-edit,
.jump-ui-tags.dxbl-text-edit {
    /* The button group draws its corners and its separator from these, not from the box: left at
       DevExpress's 3px and grey, its corners stand out of the 7px border and the separator breaks
       the top and bottom edges. The radius is the inner one, inside the border. */
    --dxbl-text-edit-border-radius: calc(var(--jump-ui-field-radius) - var(--jump-ui-field-border-width));
    --dxbl-text-edit-border-color: var(--jump-ui-field-border);
    width: 100%;
    height: var(--jump-ui-field-height);
    border: var(--jump-ui-field-border-width) solid var(--jump-ui-field-border);
    border-radius: var(--jump-ui-field-radius);
    background: var(--jump-ui-field-background);
    color: var(--jump-ui-field-ink);
    font-size: var(--jump-ui-field-font-size);
}

.jump-ui-date .dxbl-text-edit-input,
.jump-ui-combo .dxbl-text-edit-input,
.jump-ui-tags .dxbl-text-edit-input {
    padding-left: var(--jump-ui-field-padding-x);
    color: var(--jump-ui-field-ink);
    font-weight: var(--jump-ui-field-font-weight);
}

.jump-ui-date .dxbl-text-edit-input::placeholder,
.jump-ui-combo .dxbl-text-edit-input::placeholder,
.jump-ui-tags .dxbl-text-edit-input::placeholder {
    color: var(--jump-ui-field-placeholder);
    font-weight: 400;
    opacity: 1;
}

.jump-ui-date.dxbl-text-edit:focus-within,
.jump-ui-combo.dxbl-text-edit:focus-within,
.jump-ui-tags.dxbl-text-edit:focus-within {
    border-color: var(--jump-ui-field-focus-border);
    box-shadow: 0 0 0 3px var(--jump-ui-field-focus-ring);
}

.jump-ui-date .dxbl-edit-btn-dropdown,
.jump-ui-combo .dxbl-edit-btn-dropdown,
.jump-ui-tags .dxbl-edit-btn-dropdown {
    background: transparent;
}

.jump-ui-date--readonly.dxbl-text-edit,
.jump-ui-combo--readonly.dxbl-text-edit,
.jump-ui-tags--readonly.dxbl-text-edit {
    background: var(--jump-ui-field-readonly-background);
}

.jump-ui-date--disabled.dxbl-text-edit,
.jump-ui-combo--disabled.dxbl-text-edit,
.jump-ui-tags--disabled.dxbl-text-edit {
    background: var(--jump-ui-field-disabled-background);
}

.jump-ui-date--disabled .dxbl-text-edit-input,
.jump-ui-combo--disabled .dxbl-text-edit-input,
.jump-ui-tags--disabled .dxbl-text-edit-input {
    color: var(--jump-ui-field-disabled-ink);
}

.jump-ui-field--invalid .jump-ui-date.dxbl-text-edit,
.jump-ui-field--invalid .jump-ui-combo.dxbl-text-edit,
.jump-ui-field--invalid .jump-ui-tags.dxbl-text-edit {
    border-color: var(--jump-ui-field-invalid);
}

.jump-ui-field--required .jump-ui-date.dxbl-text-edit,
.jump-ui-field--required .jump-ui-combo.dxbl-text-edit,
.jump-ui-field--required .jump-ui-tags.dxbl-text-edit {
    outline: 1px solid var(--jump-ui-field-required);
}

/* A multiple select grows with its tags: the field height is its minimum, not its height. */
.jump-ui-tags.dxbl-text-edit {
    --jump-ui-tags-inset: 6px;
    height: auto;
    min-height: var(--jump-ui-field-height);
}

/* The tag box insets its content by 6px for the tags; the text takes the rest of the field padding,
   so an empty box starts its placeholder where the other fields start their text. */
.jump-ui-tags.dxbl-text-edit .dxbl-text-edit-input {
    padding-left: calc(var(--jump-ui-field-padding-x) - var(--jump-ui-tags-inset));
}

/* Icons: masks over a token colour, so they need no icon font and follow the theme. */
.jump-ui-date-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-color: var(--jump-ui-icon-ink);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'%3E%3Crect x='2' y='3' width='12' height='11' rx='2'/%3E%3Cpath d='M2 6.75h12M5.25 1.5v3M10.75 1.5v3'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'%3E%3Crect x='2' y='3' width='12' height='11' rx='2'/%3E%3Cpath d='M2 6.75h12M5.25 1.5v3M10.75 1.5v3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.jump-ui-date-icon--time {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='M8 4.75V8l2.25 1.5'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='M8 4.75V8l2.25 1.5'/%3E%3C/svg%3E");
}

.jump-ui-date .dxbl-btn:hover .jump-ui-date-icon,
.jump-ui-date.dxbl-text-edit:focus-within .jump-ui-date-icon {
    background-color: var(--jump-ui-icon-active-ink);
}

.jump-ui-select-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    background-color: var(--jump-ui-icon-ink);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.jump-ui-combo .dxbl-btn:hover .jump-ui-select-icon,
.jump-ui-combo.dxbl-text-edit:focus-within .jump-ui-select-icon {
    background-color: var(--jump-ui-icon-active-ink);
}

/* A select that cannot be typed in opens on a click anywhere in the box, so the box says so. */
.jump-ui-combo:not(.jump-ui-combo--readonly):not(.jump-ui-combo--disabled) .dxbl-text-edit-input[readonly] {
    cursor: pointer;
}

/* The drop-down: the jump-dialog frame. It is a dxbl-dropdown-dialog on a wide screen and a
   dxbl-modal-dialog on a narrow one, so every rule is written against the shared class. */
.jump-ui-date-dropdown.jump-ui-date-dropdown,
.jump-ui-date-dropdown.jump-ui-date-dropdown .dxbl-modal-content {
    --dxbl-popup-bg: var(--jump-ui-field-background);
    --dxbl-edit-dropdown-bg: var(--jump-ui-field-background);
}

.jump-ui-date-dropdown.jump-ui-date-dropdown {
    overflow: hidden;
    border: 1px solid var(--jump-ui-popup-border);
    border-radius: var(--jump-ui-popup-radius);
    background: var(--jump-ui-field-background);
    box-shadow: var(--jump-ui-popup-shadow);
}

.jump-ui-date-dropdown .dxbl-calendar {
    border: 0;
    background: var(--jump-ui-field-background);
    color: var(--jump-ui-field-ink);
    font-family: inherit;
}

.jump-ui-date-dropdown .dxbl-calendar-header,
.jump-ui-date-dropdown .dxbl-tabs {
    background: var(--jump-ui-popup-header-background);
    border-bottom: 1px solid var(--jump-ui-popup-border);
}

.jump-ui-date-dropdown .dxbl-tabs .dxbl-tabs-item {
    background: transparent;
    color: var(--jump-ui-label-ink);
    font-weight: 700;
}

.jump-ui-date-dropdown .dxbl-tabs .dxbl-tabs-item.dxbl-active {
    color: var(--jump-ui-popup-title);
}

.jump-ui-date-dropdown .dxbl-calendar-header-title-btn {
    color: var(--jump-ui-popup-title);
    font-weight: 800;
}

.jump-ui-date-dropdown .dxbl-calendar-header .dxbl-btn {
    color: var(--jump-ui-popup-accent);
}

.jump-ui-date-dropdown .dxbl-calendar th {
    color: var(--jump-ui-label-ink);
    font-size: 11px;
    font-weight: 700;
    text-transform: lowercase;
}

.jump-ui-date-dropdown .dxbl-calendar-week-number {
    color: var(--jump-ui-popup-faint);
    font-size: 11px;
}

.jump-ui-date-dropdown .dxbl-calendar-day.dxbl-calendar-weekend {
    color: var(--jump-ui-popup-muted);
}

.jump-ui-date-dropdown .dxbl-calendar-day > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--jump-ui-calendar-day-size);
    height: var(--jump-ui-calendar-day-size);
    border-radius: var(--jump-ui-popup-radius);
}

.jump-ui-date-dropdown .dxbl-calendar-day:not(.dxbl-calendar-selected-item):hover {
    background: transparent;
}

.jump-ui-date-dropdown .dxbl-calendar-day:not(.dxbl-calendar-selected-item) > a:hover {
    background: var(--jump-ui-popup-hover);
    color: var(--jump-ui-popup-title);
}

/* The day is drawn on the link; DevExpress draws its own square on the cell, so that one goes. */
.jump-ui-date-dropdown.jump-ui-date-dropdown .dxbl-calendar td.dxbl-calendar-day.dxbl-calendar-today,
.jump-ui-date-dropdown.jump-ui-date-dropdown .dxbl-calendar td.dxbl-calendar-day.dxbl-calendar-selected-item {
    border-color: transparent;
    background: transparent;
}

.jump-ui-date-dropdown .dxbl-calendar-day.dxbl-calendar-selected-item::before {
    display: none;
}

.jump-ui-date-dropdown .dxbl-calendar-day.dxbl-calendar-selected-item > a {
    background: var(--jump-ui-calendar-selected);
    color: #fff;
    font-weight: 700;
}

.jump-ui-date-dropdown .dxbl-calendar-day.dxbl-calendar-today > a {
    box-shadow: inset 0 0 0 1.5px var(--jump-ui-popup-accent);
    font-weight: 700;
}

/* The footer: jump-dialog buttons, the primary one filled. */
.jump-ui-date-dropdown .dxbl-edit-dropdown-footer {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid var(--jump-ui-popup-border);
    background: var(--jump-ui-field-background);
}

.jump-ui-date-dropdown .dxbl-edit-dropdown-footer .dxbl-btn {
    min-width: 96px;
    min-height: 30px;
    border: 1px solid var(--jump-ui-popup-control-border);
    border-radius: var(--jump-ui-popup-radius);
    background: var(--jump-ui-field-background);
    color: var(--jump-ui-popup-accent);
    font-size: 12px;
    font-weight: 850;
}

.jump-ui-date-dropdown .dxbl-edit-dropdown-footer .dxbl-btn:hover {
    background: #f4f8fd;
}

.jump-ui-date-dropdown .dxbl-edit-dropdown-footer .dxbl-btn.dxbl-btn-primary {
    border-color: var(--jump-ui-popup-accent);
    background: var(--jump-ui-popup-accent);
    color: #fff;
}

.jump-ui-date-dropdown .dxbl-edit-dropdown-footer .dxbl-btn.dxbl-btn-primary:hover {
    background: var(--jump-ui-popup-accent-hover);
}

/* The select list: the same frame as the calendar, the rows in the field's type. DevExpress draws
   the frame from its own variables under a three-class selector, so the variables are what change. */
.jump-ui-select-dropdown.jump-ui-select-dropdown {
    --dxbl-edit-dropdown-bg: var(--jump-ui-field-background);
    --dxbl-edit-dropdown-border-color: var(--jump-ui-popup-border);
    --dxbl-edit-dropdown-border-radius: var(--jump-ui-popup-radius);
    --dxbl-edit-dropdown-box-shadow: var(--jump-ui-popup-shadow);
    overflow: hidden;
}

/* The list sets its own type on its container, so the rows are sized there. */
.jump-ui-select-dropdown .dxbl-list-box-render-container {
    --dxbl-list-box-font-size: var(--jump-ui-field-font-size);
    --dxbl-list-box-color: var(--jump-ui-field-ink);
}
