/* ============================================
   TAG STYLES
   ============================================ */

/* ---- Tag pills (table display) ---- */

.tag {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  /* Default color — overridden by named variants below */
  background: #E6F1FB;
  color: #185FA5;
}

/* Named color variants */
.tag-general    { background: #E6F1FB; color: #185FA5; }
.tag-production { background: #EAF3DE; color: #3B6D11; }
.tag-stripe     { background: #FAEEDA; color: #854F0B; }
.tag-purple     { background: #F0ECFB; color: #5B3FA0; }
.tag-red        { background: #FCEBEB; color: #A32D2D; }
.tag-teal       { background: #E0F4F1; color: #1A7A6E; }

/* Add-tag button pill */
.tag-add {
  background: var(--color-background-secondary);
  color: var(--color-text-tertiary);
  border: 0.5px dashed var(--color-border-secondary);
  cursor: pointer;
}

.tag-add:hover {
  color: var(--color-text-secondary);
  border-color: var(--color-border-primary);
}

/* Tags container within a cell */
.tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* ---- TAG SELECTOR (form) ---- */
.tag-selector-container {
  position: relative;
}

.tag-input-wrapper {
  position: relative;
  margin-bottom: 15px;
}

.tag-search-input {
  width: 100%;
  padding: 10px 36px 10px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  box-sizing: border-box;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 20px;
  padding-right: 36px;
}

.tag-search-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.tag-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid #ddd;
  border-top: none;
  border-radius: 0 0 4px 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.tag-list {
  padding: 0;
}

.tag-list .dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 15px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  margin: 0;
  border-bottom: 1px solid #f0f0f0;
}

.tag-list .dropdown-item:last-child {
  border-bottom: none;
}

.tag-list .dropdown-item:hover {
  background-color: #f5f5f5;
}

.selected-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
  min-height: 30px;
}

/* ---- TAG INLINE EDITOR (table) ---- */
.tags-editor-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  position: relative;
}

.tags-display {
  display: contents; /* pills and button flow directly into the wrapper flex */
}

.tag-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 13px;
  color: var(--color-text-tertiary);
  transition: color 0.15s;
  flex-shrink: 0;
}

.tag-icon-btn:hover {
  color: var(--color-text-secondary);
}

.tags-placeholder {
  font-size: 13px;
  color: var(--color-text-tertiary);
  font-style: italic;
}

/* Positioning anchor for the absolute dropdown */
.secret-tags-display {
  position: relative;
}

.tag-editor-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: white;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: 8px;
  width: 240px;
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 6px 0;
}

.tag-editor-dropdown .tag-search-input {
  background-image: none !important;
  padding: 8px 10px !important;
  margin: 0 8px 6px 8px;
  font-size: 13px;
  border: 0.5px solid var(--color-border-secondary);
  border-radius: 6px;
}

.tag-editor-list {
  padding: 0;
}

.tag-option {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 10px 15px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: normal;
  color: #333;
  margin: 0;
  border-bottom: 1px solid #f0f0f0;
  transition: background-color 0.2s;
  text-decoration: none;
}

.tag-option:last-child {
  border-bottom: none;
}

.tag-option:hover {
  background-color: #f5f5f5;
  text-decoration: none;
}

.tag-option.selected {
  background-color: #e8f0fe;
  color: #667eea;
  font-weight: 500;
}

.tag-option .checkmark {
  display: inline-block;
  width: 20px;
  text-align: center;
  margin-right: 5px;
  font-weight: bold;
  color: #667eea;
}

.tag-create-option {
  padding: 5px 0;
  border-top: 1px solid #ddd;
}

.tag-create-option .dropdown-item {
  color: #667eea;
  padding: 10px 15px;
  border-bottom: none;
  width: 100%;
  text-align: left;
  display: block;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  margin: 0;
}

.tag-create-option .dropdown-item:hover {
  background-color: #f5f5f5;
}
