/* Estilos base */
input,
select,
textarea {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background-color: var(--color-bg-main);
  color: var(--color-text-primary);
  padding: 10px 14px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
}

input:disabled,
select:disabled,
textarea:disabled {
  background-color: var(--color-bg-tertiary);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%236b7280' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-sm) center;
  background-size: 12px;
  padding-right: calc(var(--space-sm) * 3);
}

/* Classes utilitárias para inputs */
.input-readonly-display {
  padding: 0.375rem 0.75rem;
  color: var(--color-muted);
  background-color: var(--color-bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-align: right;
}

/* Labels */
label {
  color: var(--color-text-primary);
}

.label-secondary {
  color: var(--color-text-secondary);
  font-size: var(--font-small);
}

.label-primary-bold {
  color: var(--color-primary);
  font-weight: bold;
}

/* Spans e elementos de informação */
.info-badge {
  display: flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  font-size: var(--font-small);
  flex-wrap: wrap;
  color: var(--color-muted);
  text-align: center;
  white-space: nowrap;
  background-color: var(--color-bg-disabled);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

.value-display-large {
  display: block;
  padding: 0.375rem 0.75rem;
  font-size: var(--font-large);
  color: var(--color-primary);
  background-color: var(--color-bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  text-align: right;
  font-weight: bold;
}

/* Checkbox posicionado */
.checkbox-absolute {
  position: absolute;
  margin-top: 0.3rem;
}

/* Floating labels */
.float-label {
  position: relative;
}

.float-label label,
.float-label > span {
  position: absolute;
  left: 4px;
  top: 50%;
  cursor: text;
  color: var(--color-text-secondary);
  background-color: var(--color-bg-main);
  transform: translateY(-50%);
  transition: all 0.2s ease;
  padding: 0 8px;
  z-index: 1;
  pointer-events: none;
  font-size: 14px;
}

.float-label input:focus + label,
.float-label input:not(:placeholder-shown) + label,
.float-label select:focus + label,
.float-label select:not([value=""]) + label,
.float-label textarea:focus + label,
.float-label textarea:not(:placeholder-shown) + label {
  top: 0;
  font-size: 13px;
  color: var(--color-primary);
  transform: translateY(-50%);
}

.float-label input::placeholder,
.float-label textarea::placeholder {
  opacity: 0;
}

/* Campo com label acima e ícone de ajuda */
.field-with-hint {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field-label-row label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
}

.field-label-row [data-hint] {
  position: relative;
  color: var(--color-text-muted);
  font-size: 14px;
  cursor: help;
  transition: color 0.2s ease;
}

.field-label-row [data-hint]:hover {
  color: var(--color-primary);
}

/* Tooltip real (elemento criado via JavaScript) */
.field-hint-tooltip {
  position: fixed;
  max-width: 200px;
  padding: 8px 10px;
  background-color: var(--color-bg-main);
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: normal;
  line-height: 1.4;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
  z-index: 9999;
  white-space: normal;
  word-wrap: break-word;
}

.field-hint-tooltip.visible {
  opacity: 1;
  pointer-events: auto;
}

/* Tooltip do header com texto centralizado */
.field-hint-tooltip.header-tooltip {
  text-align: center;
}

/* Link "Saiba mais" dentro do tooltip */
.help-tooltip-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  pointer-events: auto;
  cursor: pointer;
}

.help-tooltip-link:hover {
  text-decoration: underline;
}
