:root {
  --form-control-height: 40px;
  --form-control-radius: 8px;
  --form-control-border: var(--line);
  --form-control-border-hover: #cbd5e1;
  --form-control-border-focus: #93c5fd;
  --form-control-focus-ring: 0 0 0 3px rgba(37, 99, 235, 0.1);
  --form-control-error: #ef4444;
  --form-control-error-ring: 0 0 0 3px rgba(239, 68, 68, 0.08);
}

.product-form-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.product-form-field > span:first-child,
.product-form-field > label:first-child {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  line-height: 20px;
}

.product-form-field em {
  color: var(--danger);
  font-style: normal;
}

.product-form-field small {
  color: var(--muted);
  font-weight: 400;
}

.product-form-field input:not([type="file"]):not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.product-form-field select,
.product-form-control {
  width: 100%;
  height: var(--form-control-height);
  min-height: var(--form-control-height);
  padding: 0 12px;
  border: 1px solid var(--form-control-border);
  border-radius: var(--form-control-radius);
  outline: 0;
  color: var(--text-secondary);
  background-color: var(--surface);
}

.product-form .product-form-control {
  height: var(--form-control-height);
  min-height: var(--form-control-height);
  padding: 0 12px;
  border-radius: var(--form-control-radius);
}

.product-form-field select,
select.product-form-control {
  appearance: none;
  padding-right: 38px;
  background-image: url("/static/product-shell/form-select-chevron.png");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 16px;
}

.product-form-field input[data-date-input] {
  padding-right: 38px;
  background-image: url("/static/product-shell/form-calendar.png");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 16px;
}

.product-form-field textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border: 1px solid var(--form-control-border);
  border-radius: var(--form-control-radius);
  outline: 0;
  color: var(--text-secondary);
  background: var(--surface);
  line-height: 20px;
  resize: vertical;
}

.product-form-field input:not([type="file"]):not([type="checkbox"]):not([type="radio"]):hover,
.product-form-field select:hover,
.product-form-field textarea:hover,
.product-form-control:hover {
  border-color: var(--form-control-border-hover);
}

.product-form-field input:not([type="file"]):not([type="checkbox"]):not([type="radio"]):focus,
.product-form-field select:focus,
.product-form-field textarea:focus,
.product-form-control:focus {
  border-color: var(--form-control-border-focus);
  box-shadow: var(--form-control-focus-ring);
}

.product-form-field input::placeholder,
.product-form-field textarea::placeholder {
  color: #9ca3af;
}

.product-form-field input:disabled,
.product-form-field select:disabled,
.product-form-field textarea:disabled,
.product-form-field input[readonly],
.product-form-field textarea[readonly],
.product-form-control:disabled,
.product-form-control[readonly] {
  color: var(--muted);
  background-color: #f8fafc;
  cursor: not-allowed;
}

.product-form-field input.is-invalid,
.product-form-field select.is-invalid,
.product-form-field textarea.is-invalid,
.product-form-field input[aria-invalid="true"],
.product-form-field select[aria-invalid="true"],
.product-form-field textarea[aria-invalid="true"],
.product-form-control.is-invalid,
.product-form-control[aria-invalid="true"] {
  border-color: var(--form-control-error);
  box-shadow: var(--form-control-error-ring);
}

.product-form-help,
.product-form-feedback {
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
}

.product-form-feedback[data-state="error"] {
  color: #dc2626;
}

.product-form-feedback[data-state="success"] {
  color: #15803d;
}

.product-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.product-form-button {
  display: inline-flex;
  height: var(--form-control-height);
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--form-control-radius);
  color: var(--text-secondary);
  background: var(--surface);
  cursor: pointer;
  font-weight: 500;
}

.product-form-button:hover {
  color: var(--brand);
  border-color: var(--brand-border);
  background: #f8fbff;
}

.product-form-button.is-primary {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
}

.product-form-button.is-primary:hover {
  color: #fff;
  border-color: var(--brand-hover);
  background: var(--brand-hover);
}

.product-form-button:disabled,
.product-form-button.is-loading {
  cursor: wait;
  opacity: 0.65;
}

.product-form-upload {
  position: relative;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: var(--surface);
  transition: border-color var(--duration-fast), background var(--duration-fast), box-shadow var(--duration-fast);
}

.product-form-upload:hover,
.product-form-upload:focus-within {
  border-color: var(--brand);
  background: #f8fbff;
  box-shadow: var(--form-control-focus-ring);
}

.product-form-upload.is-selected {
  border-color: #86efac;
  background: #f0fdf4;
}

.product-form-field.product-form-upload {
  padding: 12px;
}

.product-form-upload.is-invalid {
  border-color: var(--form-control-error);
  background: #fef2f2;
  box-shadow: var(--form-control-error-ring);
}

.product-form-file-input {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
}

.product-form-field .product-form-file-zone {
  display: flex;
  width: 100%;
  height: 64px;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px dashed var(--brand-border);
  border-radius: 10px;
  color: var(--brand);
  background: var(--brand-soft);
  cursor: pointer;
  font-weight: 400;
  text-align: center;
}

.product-field-error {
  display: block;
  color: #dc2626;
  font-size: 12px;
  line-height: 18px;
}

@media (prefers-reduced-motion: reduce) {
  .product-form-upload {
    transition: none;
  }
}
