/* processor */
.typstmate-settings-processor {
  margin: 0.5em 0;
  padding: 0.5em;
  border: 1px solid var(--background-modifier-border);
  border-radius: 4px;
  background-color: var(--background-primary);
  display: flex;
  flex-direction: column;
}

.typstmate-settings-processor > .typstmate-settings-processor-bottom {
  display: flex;
  align-items: stretch;
  gap: 4px;
}

.typstmate-settings-processor-bottom > .typstmate-settings-processor-move-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.typstmate-settings-processor-bottom .typstmate-button-danger {
  height: auto;
}

.typstmate-settings-processor-bottom textarea {
  width: 100%;
  min-height: 4em;
  resize: vertical;
  field-sizing: content;
  background: var(--background-primary);
  color: var(--text-normal);
  border: 1px solid var(--background-modifier-border);
  border-radius: 3px;
  padding: 4px 8px;
  font-family: var(--font-monospace);
  font-size: 0.9em;
}

/* preview */
.typstmate-settings-preview {
  margin: 1em 0;
  padding: 1em;
  background: var(--background-primary);
  border: 1px solid var(--background-modifier-border);
  border-radius: 4px;
}

.typstmate-settings-preview-preview {
  width: 100%;
  min-height: 100px;
  margin: 1em 0;
  padding: 0.5em;
  background: var(--background-primary);
  border: 1px solid var(--background-modifier-border);
  border-radius: 4px;
  font-family: var(--font-monospace);
  white-space: pre-wrap;
  overflow: auto;
}

.typstmate-settings-preview-input {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin: 0.5em 0;
  padding: 0.5em;
  background: var(--background-primary);
  border: 1px solid var(--background-modifier-border);
  border-radius: 4px;
}

.typstmate-settings-preview-input span {
  padding: 0 2px;
  color: var(--text-muted);
  font-family: var(--font-monospace);
  white-space: pre;
}

.typstmate-settings-preview-input input[type="text"] {
  flex: 1;
  min-width: 100px;
  padding: 4px 8px;
  border: 1px solid var(--background-modifier-border);
  border-radius: 3px;
  background: var(--background-primary);
  color: var(--text-normal);
  font-family: var(--font-monospace);
  font-size: 0.9em;
}

.typstmate-settings-preview-input textarea {
  width: 100%;
  min-height: 100px;
  display: block;
  border: 1px solid var(--background-modifier-border);
  border-radius: 3px;
  background: var(--background-primary);
  color: var(--text-normal);
  padding: 8px;
  font-family: var(--font-monospace);
  font-size: 0.9em;
  resize: vertical;
  outline: none;
  box-shadow: none;
  margin: 4px 0;
}

/* font, package */
.typstmate-settings-table {
  width: 100%;
  max-height: 320px;
  overflow: auto;
  margin: 1em 0;
  border: 1px solid var(--background-modifier-border);
  border-radius: 4px;
  background: var(--background-primary);
}

.typstmate-settings-table table {
  width: 100%;
  border-collapse: collapse;
}

.typstmate-settings-table th,
.typstmate-settings-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--background-modifier-border);
}

.typstmate-settings-table th {
  position: sticky;
  top: 0;
  background: var(--background-primary);
  font-weight: 600;
  box-shadow: 0 1px 0 var(--background-modifier-border);
}

/* Buttons and controls */
.typstmate-button-group {
  display: flex;
  gap: 4px;
  margin: 0.5em 0;
}

.typstmate-button-primary {
  background: var(--interactive-accent);
  color: var(--text-on-accent);
  border-color: var(--interactive-accent);
}

.typstmate-button-primary:hover {
  background: var(--interactive-accent-hover);
  border-color: var(--interactive-accent-hover);
}

/* Form elements */
.typstmate-form-group {
  margin: 1em 0;
}

.typstmate-form-label {
  display: block;
  margin-bottom: 0.5em;
  font-weight: 600;
  color: var(--text-normal);
}

.typstmate-form-control {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--background-modifier-border);
  border-radius: 3px;
  background: var(--background-primary);
  color: var(--text-normal);
  font-family: var(--font-family);
  font-size: 0.9em;
  field-sizing: content;
}

.typstmate-form-control.typstmate-preamble {
  min-height: 6em;
}

.typstmate-form-control:focus {
  border-color: var(--interactive-accent);
  box-shadow: 0 0 0 1px var(--interactive-accent);
  outline: none;
}

/* Font and Package Settings */
.typstmate-settings-table {
  width: 100%;
  max-height: 400px;
  overflow-y: auto;
  margin: 1em 0;
  border: 1px solid var(--background-modifier-border);
  border-radius: 6px;
  padding: 8px;
  background-color: var(--background-primary);
}

.typstmate-settings-table .setting-item {
  border-bottom: 1px solid var(--background-modifier-border);
  padding: 8px 0;
  margin: 0;
}

.typstmate-settings-table .setting-item:last-child {
  border-bottom: none;
}

.typstmate-settings-table .setting-item-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.typstmate-settings-table .setting-item-control {
  display: flex;
  gap: 4px;
}

.typstmate-button {
  padding: 4px 8px;
  border: 1px solid var(--background-modifier-border);
  border-radius: 4px;
  background: var(--background-primary);
  color: var(--text-normal);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.typstmate-button:hover {
  background-color: var(--background-modifier-hover);
}

.typstmate-button.typstmate-button-danger {
  color: var(--text-error);
  border-color: var(--background-modifier-error);
}

.typstmate-button-danger:hover {
  background-color: var(--background-modifier-error);
  color: var(--text-on-accent);
}

.typstmate-button-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

.typstmate-button-icon:hover {
  color: var(--text-normal);
  background-color: var(--background-modifier-hover);
  border-radius: 4px;
}

.typstmate-package-name {
  font-family: var(--font-monospace);
  font-size: 0.9em;
  color: var(--text-muted);
  margin-top: 2px;
}

.typstmate-font-info {
  font-size: 0.85em;
  color: var(--text-muted);
  margin-top: 4px;
  padding-left: 8px;
  border-left: 2px solid var(--background-modifier-border);
}

.typstmate-hidden {
  display: none;
}

/* Utility classes */
.typstmate-mt-1 {
  margin-top: 0.5em;
}

.typstmate-mt-2 {
  margin-top: 1em;
}

.typstmate-mb-1 {
  margin-bottom: 0.5em;
}

.typstmate-mb-2 {
  margin-bottom: 1em;
}

.typstmate-text-muted {
  color: var(--text-muted);
}

.typstmate-text-center {
  text-align: center;
}
