/* Bootstrap 4 style badges */
.label-badge {
  display: inline-block;
  padding: .25em .4em;
  font-size: 75%;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  vertical-align: baseline;
  border-radius: .25rem;
}

/* Small badge for list view */
.label-badge-small {
  font-size: 75%;
  padding: .25em .4em;
}

/* ========== Tag Input Widget ========== */

/* Container: looks like a form input, wraps badges + text field */
.tag-input-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  border: 1px solid #d7d7d7;
  border-radius: 3px;
  padding: 4px 6px;
  background: #fff;
  min-height: 34px;
  cursor: text;
}

.tag-input-container:focus-within {
  border-color: #80b0ee;
  box-shadow: 0 0 3px rgba(128, 176, 238, 0.4);
}

/* Badges area */
.tag-input-badges {
  display: contents;
}

/* Individual tag badge (with close button) */
.label-badge-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: .25em .5em;
  font-size: 85%;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  border-radius: .25rem;
  user-select: none;
}

/* The "x" remove button on each badge */
.tag-remove {
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  line-height: 1;
  opacity: 0.7;
  margin-left: 2px;
}

.tag-remove:hover {
  opacity: 1;
}

/* Text input inside the tag container */
.tag-input-field {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  background: transparent !important;
  padding: 2px 4px !important;
  font-size: 13px;
  flex: 1 1 120px;
  min-width: 120px;
  margin: 0 !important;
  height: auto !important;
  line-height: normal !important;
}

.tag-input-field::placeholder {
  color: #999;
  font-weight: normal;
}

/* Hidden fields container */
.tag-input-hidden-fields {
  display: none;
}

/* ========== Autocomplete Dropdown ========== */

.tag-input-autocomplete.ui-autocomplete {
  max-height: 250px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1050;
}

.tag-input-autocomplete .ui-menu-item-wrapper {
  padding: 5px 8px;
}

/* Badge preview in dropdown */
.tag-input-autocomplete .label-badge {
  pointer-events: none;
}

/* "Create 'name'" option */
.tag-input-create-option {
  color: #1a7f37;
  font-style: italic;
  font-size: 13px;
}

.tag-input-create-option::before {
  content: '+ ';
  font-weight: bold;
}

/* ========== Redmine .tabular overrides ========== */

/* Override .tabular p overflow:hidden for our label field */
.tabular p.issue-label-field,
p.issue-label-field {
  overflow: visible !important;
  padding-inline: 0 !important;
  min-height: auto;
}

/* The heading label */
.tabular label.issue-label-heading,
label.issue-label-heading {
  font-weight: bold;
  display: block !important;
  float: none !important;
  margin-inline-start: 0 !important;
  inline-size: auto !important;
  text-align: start !important;
  margin-bottom: 6px;
}

/* ========== Issue detail view labels ========== */
#issue-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

#issue-labels strong {
  margin-right: 4px;
}

/* ========== Color picker in label form ========== */
.label-color-picker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.label-color-picker input[type="color"] {
  width: 40px;
  height: 30px;
  padding: 2px;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
}
