/*!
 * bootstrap-tokenfield
 * https://github.com/sliptree/bootstrap-tokenfield
 * Copyright 2013-2014 Sliptree and other contributors; Licensed MIT
 */

/* Light mode (default) styles */
:root {
  --tokenfield-bg: #fff;
  --tokenfield-border: #ccc;
  --token-bg: #ededed;
  --token-border: #d9d9d9;
  --token-hover-border: #b9b9b9;
  --token-active-border: #66afe9;
  --token-duplicate-border: #ebccd1;
  --token-invalid-border: #d9534f;
  --token-text: #333;
  --token-close: #000;
  --tokenfield-disabled-bg: #eee;
  --tokenfield-focus-border: #66afe9;
  --tokenfield-warning-border: #66512c;
  --tokenfield-error-border: #843534;
  --tokenfield-success-border: #2b542c;
}

/* Dark mode styles */
@media (prefers-color-scheme: dark) {
  :root {
    --tokenfield-bg: var(--input-bg, #2d2d2d);
    --tokenfield-border: var(--input-border, #404040);
    --token-bg: var(--nav-bg, #3d3d3d);
    --token-border: var(--border-color, #404040);
    --token-hover-border: var(--link-color, #63a9e8);
    --token-active-border: var(--link-color, #63a9e8);
    --token-duplicate-border: #dc3545;
    --token-invalid-border: #dc3545;
    --token-text: var(--text-color, #e0e0e0);
    --token-close: var(--text-color, #e0e0e0);
    --tokenfield-disabled-bg: var(--nav-bg, #3d3d3d);
    --tokenfield-focus-border: var(--link-color, #63a9e8);
    --tokenfield-warning-border: #ffc107;
    --tokenfield-error-border: #dc3545;
    --tokenfield-success-border: #28a745;
  }
}

@-webkit-keyframes blink {
  0% { border-color: var(--token-border); }
  100% { border-color: var(--token-duplicate-border); }
}

@-moz-keyframes blink {
  0% { border-color: var(--token-border); }
  100% { border-color: var(--token-duplicate-border); }
}

@keyframes blink {
  0% { border-color: var(--token-border); }
  100% { border-color: var(--token-duplicate-border); }
}

.tokenfield {
  height: auto;
  min-height: 34px;
  padding-bottom: 0;
  background-color: var(--tokenfield-bg);
  border-color: var(--tokenfield-border);
}

.tokenfield.focus {
  border-color: var(--tokenfield-focus-border);
  outline: 0;
  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102,175,233,.6);
  box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102,175,233,.6);
}

.tokenfield .token {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid var(--token-border);
  background-color: var(--token-bg);
  white-space: nowrap;
  margin: -1px 5px 5px 0;
  height: 22px;
  vertical-align: top;
  cursor: default;
  color: var(--token-text);
}

.tokenfield .token:hover {
  border-color: var(--token-hover-border);
}

.tokenfield .token.active {
  border-color: var(--token-active-border);
}

.tokenfield .token.duplicate {
  border-color: var(--token-duplicate-border);
  -webkit-animation-name: blink;
  animation-name: blink;
  -webkit-animation-duration: 0.1s;
  animation-duration: 0.1s;
  -webkit-animation-direction: normal;
  animation-direction: normal;
  -webkit-animation-timing-function: ease;
  animation-timing-function: ease;
  -webkit-animation-iteration-count: infinite;
  animation-iteration-count: infinite;
}

.tokenfield .token.invalid {
  background: none;
  border: 1px solid transparent;
  -webkit-border-radius: 0;
  -moz-border-radius: 0;
  border-radius: 0;
  border-bottom: 1px dotted var(--token-invalid-border);
}

.tokenfield .token.invalid.active {
  background: var(--token-bg);
  border: 1px solid var(--token-bg);
  -webkit-border-radius: 3px;
  -moz-border-radius: 3px;
  border-radius: 3px;
}

.tokenfield .token .token-label {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 4px;
  vertical-align: top;
}

.tokenfield .token .close {
  font-family: Arial;
  display: inline-block;
  line-height: 100%;
  font-size: 1.1em;
  line-height: 1.49em;
  margin-left: 5px;
  float: none;
  height: 100%;
  vertical-align: top;
  padding-right: 4px;
  color: var(--token-close);
  opacity: 0.7;
}

.tokenfield .token-input {
  background: none;
  width: 60px;
  min-width: 60px;
  border: 0;
  height: 20px;
  padding: 0;
  margin-bottom: 6px;
  -webkit-box-shadow: none;
  box-shadow: none;
  color: var(--token-text);
}

.tokenfield .token-input:focus {
  border-color: transparent;
  outline: 0;
  -webkit-box-shadow: none;
  box-shadow: none;
}

.tokenfield.disabled {
  cursor: not-allowed;
  background-color: var(--tokenfield-disabled-bg);
  opacity: 0.7;
}

.tokenfield.disabled .token-input {
  cursor: not-allowed;
}

.tokenfield.disabled .token:hover {
  cursor: not-allowed;
  border-color: var(--token-border);
}

.tokenfield.disabled .token:hover .close {
  cursor: not-allowed;
  opacity: 0.2;
}

/* Bootstrap validation states */
.has-warning .tokenfield.focus {
  border-color: var(--tokenfield-warning-border);
  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px #c0a16b;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px #c0a16b;
}

.has-error .tokenfield.focus {
  border-color: var(--tokenfield-error-border);
  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px #ce8483;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px #ce8483;
}

.has-success .tokenfield.focus {
  border-color: var(--tokenfield-success-border);
  -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px #67b168;
  box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 6px #67b168;
}

/* Size variations */
.tokenfield.input-sm,
.input-group-sm .tokenfield {
  min-height: 30px;
  padding-bottom: 0;
}

.input-group-sm .token,
.tokenfield.input-sm .token {
  height: 20px;
  margin-bottom: 4px;
}

.input-group-sm .token-input,
.tokenfield.input-sm .token-input {
  height: 18px;
  margin-bottom: 5px;
}

.tokenfield.input-lg,
.input-group-lg .tokenfield {
  height: auto;
  min-height: 45px;
  padding-bottom: 4px;
}

.input-group-lg .token,
.tokenfield.input-lg .token {
  height: 25px;
}

.input-group-lg .token-label,
.tokenfield.input-lg .token-label {
  line-height: 23px;
}

.input-group-lg .token .close,
.tokenfield.input-lg .token .close {
  line-height: 1.3em;
}

.input-group-lg .token-input,
.tokenfield.input-lg .token-input {
  height: 23px;
  line-height: 23px;
  margin-bottom: 6px;
  vertical-align: top;
}

/* RTL support */
.tokenfield.rtl {
  direction: rtl;
  text-align: right;
}

.tokenfield.rtl .token {
  margin: -1px 0 5px 5px;
}

.tokenfield.rtl .token .token-label {
  padding-left: 0;
  padding-right: 4px;
}
