/* ==========================================================================
   components/inputs.css — form labels, inputs, selects, textareas, tags
   ========================================================================== */

/* === Form label === */

.fl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-m);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
  display: block;
}

/* === Text input === */

.fi {
  width: 100%;
  background: var(--surface2);
  border: 0.5px solid var(--border-m);
  border-radius: var(--r);
  padding: 11px 14px;
  color: var(--text);
  font-family: var(--fb);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 12px;
}

.fi:focus {
  border-color: var(--accent);
}

.fi::placeholder {
  color: var(--text-d);
}

/* === Form group / row === */

.fr {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.fg {
  margin-bottom: 12px;
}

/* === Select === */

.fs {
  width: 100%;
  background: var(--surface2);
  border: 0.5px solid var(--border-m);
  border-radius: var(--r);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--fb);
  font-size: 14px;
  outline: none;
  cursor: pointer;
  appearance: none;
}

/* === Textarea === */

.ft {
  width: 100%;
  background: var(--surface2);
  border: 0.5px solid var(--border-m);
  border-radius: var(--r);
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--fb);
  font-size: 14px;
  outline: none;
  resize: vertical;
  min-height: 80px;
}

.fs:focus,
.ft:focus,
.fi:focus {
  border-color: var(--accent);
}

/* === Tag input area (free-text chip container) === */
/* Used for keyword input (.kw-field) and competitor input on the
   Add Client wizard. Width is 100% of the parent form group; chips
   wrap onto new lines as needed. min-height is auto so the field
   is compact on first render but grows as chips accumulate. */

.tia {
  width: 100%;
  background: var(--surface2);
  border: 0.5px solid var(--border-m);
  border-radius: var(--r);
  padding: 10px 12px;
  min-height: 56px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  align-items: center;
  cursor: text;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.tia:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* === Chip / tag === */
/* max-width prevents one ultra-long phrase from breaking the layout;
   the inner .tg__label takes the ellipsis. The full text is exposed
   via the chip's title attribute (set by addTag in index.html). */

.tg,
.tgi {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px 10px;
  border-radius: 999px;
  font-family: var(--fm);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  max-width: 280px;
  animation: tg-pop-in 0.18s ease-out;
}

.tg  { background: var(--accent-dim);  color: var(--accent); }
.tgi { background: var(--accent2-dim); color: var(--accent2); }

.tg__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes tg-pop-in {
  from { opacity: 0; transform: scale(0.85); }
  to   { opacity: 1; transform: scale(1); }
}

/* === Inline remove (×) on chips === */

.tx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.7;
  font-size: 13px;
  line-height: 1;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
  flex-shrink: 0;
  user-select: none;
}

.tx:hover {
  opacity: 1;
  background: var(--red-dim);
  color: var(--red);
}

/* === Keyword / chip-input field text input ============================== */
/* Drop-in replacement for the previous inline-styled <input> inside .tia.
   Pure class — no inline styles. flex: 1 1 200px ensures the input always
   has at least 200px so the placeholder never truncates. */

.kw-input {
  flex: 1 1 200px;
  min-width: 200px;
  width: auto;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--fb);
  font-size: 14px;
  line-height: 1.4;
  padding: 2px 0;
  margin: 0;
}

.kw-input::placeholder {
  color: var(--text-m);
}

/* Tip line shown below the keyword field — gentle nudge for shorter terms. */
.kw-field__hint {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-d);
  font-family: var(--fb);
}
