/* MoleculeInput Component Styles */

.mint-molecule-input {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Dark --border-light equals --bg-card; row and band hairlines need --border-color there. */
:where(html.dark) .mint-molecule-input {
  --border-light: var(--border-color);
}

/* Field rules (1a / 1e). */
.mint-molecule-input:hover:not(:focus-within):not(.mint-molecule-input--error) {
  border-color: var(--_field-border-hover);
}

.mint-molecule-input:focus-within {
  border-color: var(--color-primary);
  box-shadow: var(--focus-ring-soft);
}

.mint-molecule-input--disabled {
  background-color: var(--bg-tertiary);
  color: var(--text-muted);
  pointer-events: none;
}

.mint-molecule-input--readonly {
  pointer-events: none;
}

.mint-molecule-input--error {
  border-color: var(--mint-error);
}

.mint-molecule-input--error:focus-within {
  box-shadow: var(--focus-ring-soft-error);
}

/* Editor container */
.mint-molecule-input__editor {
  position: relative;
  width: 100%;
  min-height: 200px;
  background-color: var(--bg-secondary);
}

.mint-molecule-input__editor iframe {
  border: none;
  display: block;
}

/* Skeleton loader */
.mint-molecule-input__skeleton {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  height: 100%;
  min-height: 200px;
  background-color: var(--bg-tertiary);
}

.mint-molecule-input__skeleton-icon {
  width: 3rem;
  height: 3rem;
  color: var(--text-muted);
  animation: mint-molecule-pulse 1.5s ease-in-out infinite;
}

.mint-molecule-input__skeleton-text {
  font-size: 0.875rem;
  color: var(--text-muted);
}

@keyframes mint-molecule-pulse {
  0%, 100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

/* Readonly SVG display */
.mint-molecule-input__readonly {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 1rem;
  background-color: var(--bg-tertiary);
}

.mint-molecule-input__readonly svg {
  max-width: 100%;
  max-height: 100%;
}

/* Empty state */
.mint-molecule-input__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 200px;
  padding: 1rem;
  color: var(--text-muted);
}

.mint-molecule-input__empty-icon {
  width: 2.5rem;
  height: 2.5rem;
}

.mint-molecule-input__empty-text {
  font-size: 0.875rem;
}

/* SMILES preview */
.mint-molecule-input__smiles {
  padding: 0.5rem 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary-strong);
  border-top: 1px solid var(--border-light);
  word-break: break-all;
  user-select: all;
}

.mint-molecule-input__smiles-label {
  color: var(--text-secondary);
  margin-right: 0.5rem;
}

/* Error state */
.mint-molecule-input__error {
  padding: 0.75rem;
  font-size: 0.875rem;
  color: var(--mint-error);
  background-color: var(--mint-error-bg);
  border-top: 1px solid var(--mint-error);
}

.mint-molecule-input__error-icon {
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
  vertical-align: middle;
}

/* Actions toolbar */
.mint-molecule-input__actions {
  display: flex;
  gap: 0.25rem;
  padding: 0.25rem 0.375rem;
  border-top: 1px solid var(--border-light);
}

.mint-molecule-input__action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: var(--text-secondary-strong);
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.mint-molecule-input__action-btn:hover:not(:disabled) {
  color: var(--text-primary);
  background-color: var(--bg-hover);
}

.mint-molecule-input__action-btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring-offset);
}

.mint-molecule-input__action-btn:disabled {
  opacity: var(--mint-disabled-opacity);
  cursor: not-allowed;
}

.mint-molecule-input__action-btn svg {
  width: 1rem;
  height: 1rem;
}
