/* ============================================================
   Optma DS · Input · v0.1
   Inputs de texto, textarea, select. Label tradicional acima.
============================================================ */

.opt-field {
  display: flex;
  flex-direction: column;
  gap: var(--opt-space-2);
  font-family: var(--opt-font-body);
}

.opt-field__label {
  font-family: var(--opt-font-display);
  font-size: var(--opt-text-md);
  font-weight: var(--opt-weight-semibold);
  color: var(--opt-ink);
  letter-spacing: var(--opt-tracking-tight);
}

.opt-field__label .opt-required {
  color: var(--opt-error);
  margin-left: 2px;
}

.opt-field__hint {
  font-family: var(--opt-font-body);
  font-size: var(--opt-text-md);
  color: var(--opt-ink-muted);
  line-height: var(--opt-leading-normal);
}

.opt-field__error {
  font-family: var(--opt-font-body);
  font-size: var(--opt-text-md);
  color: var(--opt-error);
  display: inline-flex;
  align-items: center;
  gap: var(--opt-space-2);
  line-height: var(--opt-leading-normal);
}

.opt-field__error svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* -----------------------------------------
   Input wrap (necessário pra ícone à esquerda/direita)
   ----------------------------------------- */
.opt-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.opt-input-wrap .opt-input-icon {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--opt-ink-muted);
  pointer-events: none;
}

.opt-input-wrap .opt-input-icon svg {
  width: 100%;
  height: 100%;
}

.opt-input-wrap .opt-input-icon--left  { left: 14px; }
.opt-input-wrap .opt-input-icon--right { right: 14px; }

.opt-input-wrap:has(.opt-input-icon--left) .opt-input { padding-left: 42px; }
.opt-input-wrap:has(.opt-input-icon--right) .opt-input { padding-right: 42px; }

/* -----------------------------------------
   Input base
   ----------------------------------------- */
.opt-input {
  width: 100%;
  height: 48px;
  padding: 0 var(--opt-space-4);

  background: var(--opt-paper);
  border: 1.5px solid var(--opt-rule);
  border-radius: var(--opt-radius-md);

  font-family: var(--opt-font-body);
  font-size: var(--opt-text-lg);
  font-weight: var(--opt-weight-regular);
  color: var(--opt-ink);
  line-height: 1.4;

  transition: border-color var(--opt-duration-base) var(--opt-ease-out),
              box-shadow var(--opt-duration-base) var(--opt-ease-out),
              background-color var(--opt-duration-base) var(--opt-ease-out);
}

.opt-input::placeholder {
  color: var(--opt-ink-muted);
  font-weight: var(--opt-weight-regular);
}

.opt-input:hover:not(:disabled):not(:focus) {
  border-color: var(--opt-ink-muted);
}

.opt-input:focus {
  outline: none;
  border-color: var(--opt-green);
  box-shadow: var(--opt-ring-green);
}

.opt-input:disabled {
  background: var(--opt-paper-soft);
  color: var(--opt-ink-muted);
  cursor: not-allowed;
}

/* -----------------------------------------
   Estado · erro
   ----------------------------------------- */
.opt-field.is-error .opt-input,
.opt-input.is-error {
  border-color: var(--opt-error);
}

.opt-field.is-error .opt-input:focus,
.opt-input.is-error:focus {
  border-color: var(--opt-error);
  box-shadow: var(--opt-ring-error);
}

.opt-field.is-error .opt-input-icon {
  color: var(--opt-error);
}

/* -----------------------------------------
   Tamanhos
   ----------------------------------------- */
.opt-input--sm {
  height: 36px;
  padding: 0 var(--opt-space-3);
  font-size: var(--opt-text-md);
  border-radius: var(--opt-radius-sm);
}

.opt-input--lg {
  height: 56px;
  padding: 0 var(--opt-space-5);
  font-size: var(--opt-text-xl);
  border-radius: var(--opt-radius-lg);
}

/* -----------------------------------------
   Textarea
   ----------------------------------------- */
.opt-textarea {
  min-height: 120px;
  padding: var(--opt-space-3) var(--opt-space-4);
  line-height: var(--opt-leading-normal);
  resize: vertical;
}

/* -----------------------------------------
   Select (custom chevron)
   ----------------------------------------- */
.opt-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236A6F68' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
  padding-right: 42px;
  cursor: pointer;
}
