@import url('view/main-view.css');
@import url('view/main-view-top-menu.css');
@import url('view/login-view.css');
@import url('view/site-coordinate-check.css');
@import url('view/data-update-reorg.css');

@import url('Bio4.css');

vaadin-form-item.text-xl::part(label) {
    font-size: var(--aura-font-size-xl);
}

/* Only labels of formItems with class 'file-item' */
/*vaadin-form-item.file-item::part(label) {
/*      BLUE !! */
/*    color: var(--aura-accent-contrast-color);
    padding-left: var(--aura-font-size-m);
    padding-bottom: var(--aura-font-size-m);
    width: 4.5em;*/
    /* border: 1px solid var(--aura-accent-contrast-color);*/
/*}*/

.progress-wrapper {
    position: relative;
}

.progress-wrapper > vaadin-progress-bar {
    width: 100%;
}

.progress-wrapper > span.progress-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    font-weight: 600;
    color: white;
}

/* ImportdatawizzardView: row highlight once Taxon/Collection are assigned.
   !important is needed here because the grid's own "row-stripes" theme variant sets a background-color
   on the same ::part(row) with equal-or-higher specificity from its internal stylesheet, which otherwise
   wins the cascade over this page-level rule and silently hides the highlight on every row. */
vaadin-grid::part(import-row-taxon-set) {
    background-color: rgba(255, 235, 59, 0.25) !important;
}

vaadin-grid::part(import-row-collection-set) {
    background-color: rgba(33, 150, 243, 0.2) !important;
}

vaadin-grid::part(import-row-both-set) {
    background-color: rgba(76, 175, 80, 0.2) !important;
}

/* row already imported (objIdObject set) - takes priority over the taxon/collection highlights above */
vaadin-grid::part(import-row-object-set) {
    background-color: darkgray !important;
    color: white;
}

/* TTaxaDetailView, tab Synonyme: the opened taxon itself among its synonym group - light blue.
   !important: see import-row-taxon-set above (row-stripes). */
vaadin-grid::part(taxon-self) {
    background-color: rgba(33, 150, 243, 0.15) !important;
}

/* ImportdatawizzardView: cmbField dropdown item for a target field another column already maps to - stays
   in the list (see isFieldAvailableForColumn) but greyed out and (for pointer input) unclickable; a keyboard
   selection is additionally rejected in code, since pointer-events has no effect on keyboard navigation. */
vaadin-combo-box-item.field-taken {
    opacity: 0.45;
    font-style: italic;
    pointer-events: none;
}

/* TSysFieldListView: a TSysField already used by another row in the field list this grid was opened as a
   lookup for (see TSysFieldListDetailView.openFieldLookup()/setUsedFieldIds()) - dimmed, not disabled, since
   re-picking an already-used field is unusual but not actually invalid. !important for the same reason as
   import-row-object-set above: vaadin-grid's own internal stylesheet sets ::part(row) with equal-or-higher
   specificity, which otherwise wins the cascade and silently hides this. */
vaadin-grid::part(field-used) {
    opacity: 0.5 !important;
    font-style: italic !important;
}

/* TObjectListView opened as the object lookup of a loan item (TLoanItemDetailView.openObjectLookup() /
   markLentObjects()): an object already out on an open loan - greyed out, and also not selectable (that part
   is setItemSelectableProvider + the lookup's select validator, not CSS). !important: see field-used above. */
vaadin-grid::part(object-lent) {
    opacity: 0.45 !important;
    font-style: italic !important;
    cursor: not-allowed;
}

/* TSysFieldListDetailView: yflIdFieldField's own inline dropdown - same "already used by another row"
   idea as vaadin-grid::part(field-used) above, but for a vaadin-combo-box-item (see
   TSysFieldListDetailView.restrictFieldFieldToCurrentTable()'s setClassNameGenerator()). Dimmed, not
   disabled - see that rule's own comment for why "field-taken" (used e.g. by ImportdatawizzardView)
   additionally blocks the pick; this one doesn't. */
vaadin-combo-box-item.field-used {
    opacity: 0.5;
    font-style: italic;
}

/* LookupEntityComboBox: an entry of a plain tlkp... lookup whose ...Active is false - stays in the list (at its
   normal position) but greyed out and, for pointer input, unclickable; a keyboard selection is reverted in code. */
vaadin-combo-box-item.lookup-inactive {
    opacity: 0.45;
    font-style: italic;
    pointer-events: none;
}

/* PublicObjectListView: earthy botanical palette sampled from herbarium-bernense.ch (header/table
   background, olive header row, dark-brown text) instead of the app's default blue/grey theme, since
   this view is the public-facing herbarium page and should read consistently with that sister site. */
.public-object-view {
    background-color: #f2ede7;
}

.public-object-view vaadin-button,
.public-object-view vaadin-combo-box,
.public-object-view vaadin-simple-pagination {
    color: #302516;
}

vaadin-grid.public-object-grid {
    --vaadin-grid-background: #f2ede7;
    --vaadin-grid-border-color: #acac80;
    --vaadin-grid-header-text-color: #f2ede7;
    --vaadin-grid-row-background-color: #f2ede7;
    --vaadin-grid-row-odd-background-color: #d9dacb;
    --vaadin-grid-row-hover-background-color: rgba(157, 156, 105, 0.25);
    color: #302516;
}

/* header row background needs !important - see the "field-used" rule above for why: vaadin-grid's own
   internal stylesheet sets ::part(header-cell) with equal-or-higher specificity from its shadow DOM. */
vaadin-grid.public-object-grid::part(header-cell) {
    background-color: #4a4527 !important;
}

/* ImportDataDetailView: "Assistent" (wizard) button - lighter/brighter green than the dark
   accent-green "Neu" (createAction) button uses, so it stands out as the primary call-to-action. */
vaadin-button.wizzard-button {
    --vaadin-button-background: #4caf50;
    --vaadin-button-text-color: #ffffff;
    border-color: #4caf50;
    font-weight: 600;
}

vaadin-button.wizzard-button:hover {
    --vaadin-button-background: #43a047;
    border-color: #43a047;
}

/* StandardBioDetailView: violet accent while editing a brand-new, not-yet-persisted entity (class toggled by
   updateNewEntityIndicator() - added in onBeforeShow whenever entityStates.isNew() is true, removed again in
   onAfterSave once the entity has actually been written to the database). Overriding the Aura accent color
   (instead of only tinting the background) makes every accent-themed control in the form - focus rings, the
   save button, links - pick up the violet too, without needing per-component overrides here. Only the base
   colours are set: Aura derives text/contrast/surface accents from them again on each of its components. */
.new-entity-view {
    --aura-accent-color-light: #8e24aa;
    --aura-accent-color-dark: #8e24aa;
    --aura-accent-color: light-dark(var(--aura-accent-color-light), var(--aura-accent-color-dark));
    background-color: rgba(142, 36, 170, 0.05);
}

.new-entity-view vaadin-button[theme~="primary"] {
    --vaadin-button-background: #8e24aa;
    --vaadin-button-text-color: #ffffff;
    border-color: #8e24aa;
}

/* TContactDetailView, tab Objekte: the role(s) in which an object references the opened contact. One light,
   semi-transparent colour per role (--bio-cr-*). Each role part only switches its own layer on (--cr-*); the
   "cr" part stacks all layers, so an object with several roles shows the blend of their colours.
   The part names land on every cell (Grid.setPartNameGenerator). The layers are inset box-shadows, NOT
   background(-image): the grid's own theme variants paint the cells' background - row-stripes e.g. is a
   background-image - and overriding it would drop them; an inset shadow is painted above the background and
   inside the border, so stripes stay visible underneath and the border variants are untouched. */
html {
    --bio-cr-origin: rgba(76, 175, 80, 0.25);        /* green */
    --bio-cr-det: rgba(33, 150, 243, 0.22);          /* blue */
    --bio-cr-event: rgba(255, 193, 7, 0.30);         /* yellow */
    --bio-cr-preparation: rgba(156, 39, 176, 0.18);  /* violet */
    --bio-cr-io: rgba(255, 87, 34, 0.20);            /* orange */
}

vaadin-grid::part(cr-origin) { --cr-origin: var(--bio-cr-origin); }
vaadin-grid::part(cr-det) { --cr-det: var(--bio-cr-det); }
vaadin-grid::part(cr-event) { --cr-event: var(--bio-cr-event); }
vaadin-grid::part(cr-preparation) { --cr-preparation: var(--bio-cr-preparation); }
vaadin-grid::part(cr-io) { --cr-io: var(--bio-cr-io); }

vaadin-grid::part(cr) {
    box-shadow:
        inset 0 0 0 100vmax var(--cr-origin, transparent),
        inset 0 0 0 100vmax var(--cr-det, transparent),
        inset 0 0 0 100vmax var(--cr-event, transparent),
        inset 0 0 0 100vmax var(--cr-preparation, transparent),
        inset 0 0 0 100vmax var(--cr-io, transparent);
}

/* Aura theme: only the --aura-* / --vaadin-* tokens are defined, --lumo-* ones are not (a var() without value
   makes the whole declaration fall back to its initial value) */
.contact-role-legend {
    flex-wrap: wrap;
    gap: var(--vaadin-gap-s);
    margin-left: auto;
    padding: 0 var(--vaadin-padding-m);
}

/* the legend items are toggle buttons filtering the grid by role (TContactDetailView.toggleRoleFilter);
   font and height as a grid row (15px, 37px with theme "compact" = 2.5em) */
.contact-role-legend-item {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    min-height: 2.5em;
    padding: 0 var(--vaadin-padding-l);
    border: 1px solid transparent;
    border-radius: var(--vaadin-radius-m);
    font: inherit;
    color: var(--vaadin-text-color);
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 0.15s, border-color 0.15s;
}

.contact-role-legend-item:hover {
    border-color: var(--vaadin-border-color);
}

.contact-role-legend-item:focus-visible {
    outline: 2px solid var(--vaadin-focus-ring-color);
    outline-offset: 1px;
}

.contact-role-legend-item-selected {
    border-color: var(--vaadin-text-color-secondary);
    font-weight: 600;
}

.contact-role-legend-item-dimmed {
    opacity: 0.45;
}

.contact-role-legend-item.cr-origin { background-color: var(--bio-cr-origin); }
.contact-role-legend-item.cr-det { background-color: var(--bio-cr-det); }
.contact-role-legend-item.cr-event { background-color: var(--bio-cr-event); }
.contact-role-legend-item.cr-preparation { background-color: var(--bio-cr-preparation); }
.contact-role-legend-item.cr-io { background-color: var(--bio-cr-io); }
