/* Advoke CV — Editor Form Field (Label + Input + Helper + Error) */

.editor-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1-5);
  width: 100%;
  min-width: 0;
}

.editor-field__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  letter-spacing: -0.005em;
  line-height: 1.4;
  cursor: pointer;
}

.editor-field__label--required::after {
  content: "*";
  color: var(--color-danger);
  font-weight: var(--font-weight-bold);
  margin-left: 2px;
}

.editor-field__label--optional::after {
  content: "(optional)";
  color: var(--color-text-muted);
  font-weight: var(--font-weight-regular);
  font-size: var(--text-2xs);
  margin-left: var(--space-1);
}

.editor-field__label-aside {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-2xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
}

.editor-field__input,
.editor-field__select,
.editor-field__textarea {
  width: 100%;
  min-height: 38px;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: 1.4;
  color: var(--color-text);
  background-color: var(--white);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  transition:
    border-color var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) var(--ease-out);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -webkit-tap-highlight-color: transparent;
}

.editor-field__input::placeholder,
.editor-field__textarea::placeholder {
  color: var(--color-text-subtle);
}

.editor-field__input:hover:not(:disabled):not(:focus),
.editor-field__select:hover:not(:disabled):not(:focus),
.editor-field__textarea:hover:not(:disabled):not(:focus) {
  border-color: var(--color-text-muted);
}

.editor-field__input:focus,
.editor-field__select:focus,
.editor-field__textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(245, 184, 0, 0.2);
}

.editor-field__input:disabled,
.editor-field__select:disabled,
.editor-field__textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: var(--ink-50);
}

.editor-field__textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.editor-field__textarea--tall {
  min-height: 140px;
}

.editor-field__textarea--short {
  min-height: 64px;
}

.editor-field__select {
  padding-right: var(--space-10);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  background-size: 16px 16px;
  cursor: pointer;
}

.editor-field__input[type="date"],
.editor-field__input[type="month"],
.editor-field__input[type="number"] {
  font-variant-numeric: tabular-nums;
}

.editor-field__input[aria-invalid="true"],
.editor-field__select[aria-invalid="true"],
.editor-field__textarea[aria-invalid="true"] {
  border-color: var(--color-danger);
}

.editor-field__input[aria-invalid="true"]:focus,
.editor-field__select[aria-invalid="true"]:focus,
.editor-field__textarea[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.2);
}

.editor-field__helper {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  font-size: var(--text-2xs);
  line-height: 1.45;
  color: var(--color-text-muted);
  margin-top: 1px;
}

.editor-field__helper svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--color-text-subtle);
}

.editor-field__wrapper {
  position: relative;
  width: 100%;
}

.editor-field__clear {
  position: absolute;
  top: 50%;
  right: var(--space-2);
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background-color: var(--ink-100);
  color: var(--color-text-muted);
  border: none;
  cursor: pointer;
  transition: var(--transition-colors);
  padding: 0;
}

.editor-field__clear:hover {
  background-color: var(--ink-200);
  color: var(--color-text);
}

.editor-field__clear svg {
  width: 10px;
  height: 10px;
}

.editor-field__clear[hidden] {
  display: none;
}

.editor-field--inline {
  flex-direction: row;
  align-items: center;
  gap: var(--space-2);
}

.editor-field--inline .editor-field__label {
  width: auto;
  flex-shrink: 0;
}

.editor-field--compact .editor-field__input,
.editor-field--compact .editor-field__select {
  min-height: 32px;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-xs);
}

.editor-field--disabled {
  opacity: 0.6;
  pointer-events: none;
}

.editor-field__url-prefix {
  position: absolute;
  top: 50%;
  left: var(--space-3);
  transform: translateY(-50%);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  pointer-events: none;
}

.editor-field__wrapper--has-prefix .editor-field__input {
  padding-left: 3.5rem;
}

@media (max-width: 480px) {
  .editor-field__input,
  .editor-field__select {
    min-height: 44px;
    font-size: var(--text-base);
  }
  .editor-field__textarea {
    min-height: 88px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .editor-field__input,
  .editor-field__select,
  .editor-field__textarea,
  .editor-field__clear {
    transition: none;
  }
}